mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
* Implement background sync for xmr using flutter_daemon * - initialize app config in background thread - initializeAppConfigs without loading the wallet. * - properly do awaited calls in methodChannel - prevent locking main thread during background sync * add back background sync debug page fix issues caused by xmr wallet being view only (and read only) * changes from review improve starting of bgsync task * update stopBackgroundSync, await listener functions, ensure that listener always start (call _start in constructor) * DO-NOT-MERGE: extre verbose monero logs * stop background service when app is being opened * improve monitoring of background sync * update flutter_daemon to ensure network constraint prevent throwing errors on isBackgroundSyncEnabled check network before syncing * Update lib/main.dart * revert Update main.dart [skip ci] * continously run network check * disable charging requirement, fix status reporting of background sync in UI * Refactor background sync logic, and add UI notifications for battery optimization. Updated flutter_daemon version modified build.gradle for signing config to allow testing in both release and debug modes. * verbose monero only when requested in code. Do not start background sync when battery optimization is on * fix background sync mode not properly reflecting state changes * drop unnecessary dependency --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
28 lines
977 B
Dart
28 lines
977 B
Dart
import 'package:cake_wallet/di.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:cake_wallet/store/app_store.dart';
|
|
import 'package:cake_wallet/entities/preferences_key.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
import 'package:cake_wallet/core/wallet_loading_service.dart';
|
|
|
|
Future<void> loadCurrentWallet({String? password}) async {
|
|
final appStore = getIt.get<AppStore>();
|
|
final name = getIt
|
|
.get<SharedPreferences>()
|
|
.getString(PreferencesKey.currentWalletName);
|
|
final typeRaw =
|
|
getIt.get<SharedPreferences>().getInt(PreferencesKey.currentWalletType) ??
|
|
0;
|
|
|
|
if (name == null) {
|
|
throw Exception('Incorrect current wallet name: $name');
|
|
}
|
|
|
|
final type = deserializeFromInt(typeRaw);
|
|
final walletLoadingService = getIt.get<WalletLoadingService>();
|
|
final wallet = await walletLoadingService.load(
|
|
type,
|
|
name,
|
|
password: password);
|
|
await appStore.changeCurrentWallet(wallet);
|
|
}
|