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 (#2094)
* 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>
This commit is contained in:
parent
d44621e6c7
commit
686580ff78
60 changed files with 853 additions and 352 deletions
|
@ -1,9 +1,9 @@
|
|||
import 'package:flutter/services.dart';
|
||||
|
||||
void setIsAppSecureNative(bool isAppSecure) {
|
||||
Future<void> setIsAppSecureNative(bool isAppSecure) async {
|
||||
try {
|
||||
final utils = const MethodChannel('com.cake_wallet/native_utils');
|
||||
|
||||
utils.invokeMethod<Uint8List>('setIsAppSecure', {'isAppSecure': isAppSecure});
|
||||
await utils.invokeMethod<Uint8List>('setIsAppSecure', {'isAppSecure': isAppSecure});
|
||||
} catch (_) {}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,12 @@ abstract class WalletBase<BalanceType extends Balance, HistoryType extends Trans
|
|||
// there is a default definition here because only coins with a pow node (nano based) need to override this
|
||||
Future<void> connectToPowNode({required Node node}) async {}
|
||||
|
||||
// startBackgroundSync is used to start sync in the background, without doing any
|
||||
// extra things in the background.
|
||||
// startSync is used as a fallback.
|
||||
Future<void> startBackgroundSync() => startSync();
|
||||
Future<void> stopBackgroundSync(String password) => stopSync();
|
||||
|
||||
Future<void> startSync();
|
||||
|
||||
Future<void> stopSync() async {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue