fix tor background sync (will work on test builds after is merged and this PR is rebased on top)

This commit is contained in:
Czarek Nakamoto 2025-04-03 14:31:40 +02:00
parent 7636aaedc2
commit 40a1cf9f7b
2 changed files with 7 additions and 2 deletions

View file

@ -11,7 +11,7 @@ jobs:
- name: Check for http package usage
if: github.event_name == 'pull_request'
run: |
GIT_GREP_OUT="$(git grep package:http | (grep .dart: || test $? = 1) || true)"
GIT_GREP_OUT="$(git grep package:http | (grep .dart: || test $? = 1) | (grep -v proxy_wrapper.dart || test $? = 1) || true)"
[[ "x$GIT_GREP_OUT" == "x" ]] && exit 0
echo "$GIT_GREP_OUT"
echo "There are .dart files which use http imports"

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/feature_flag.dart';
import 'package:cake_wallet/utils/tor.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:cw_core/sync_status.dart';
@ -91,6 +92,11 @@ class BackgroundSync {
}
Future<void> sync() async {
final settingsStore = getIt.get<SettingsStore>();
if (settingsStore.currentBuiltinTor) {
printV("Starting Tor");
await ensureTorStarted(context: null);
}
printV("Background sync started");
await _syncWallets();
printV("Background sync completed");
@ -101,7 +107,6 @@ class BackgroundSync {
final walletListViewModel = getIt.get<WalletListViewModel>();
final settingsStore = getIt.get<SettingsStore>();
final List<WalletListItem> moneroWallets = walletListViewModel.wallets
.where((element) => !element.isHardware)
.where((element) => ![WalletType.haven, WalletType.decred].contains(element.type))