actual fix

This commit is contained in:
Matthew Fosse 2024-12-19 13:28:57 -05:00
parent 26ed988240
commit ddd89bfb83

View file

@ -93,7 +93,8 @@ void setNotificationStarting(
);
}
void setNotificationWalletsSynced(FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin) async {
void setNotificationWalletsSynced(
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin) async {
flutterLocalNotificationsPlugin.cancelAll();
setMainNotification(
flutterLocalNotificationsPlugin,
@ -250,9 +251,9 @@ Future<void> onStart(ServiceInstance service) async {
}
printV("STARTING SYNC TIMER");
int syncedTicks = 0;
_syncTimer?.cancel();
_syncTimer = Timer.periodic(const Duration(milliseconds: 2000), (timer) async {
int syncedTicks = 0;
for (int i = 0; i < syncingWallets.length; i++) {
final wallet = syncingWallets[i];
final syncStatus = wallet.syncStatus;
@ -280,7 +281,7 @@ Future<void> onStart(ServiceInstance service) async {
syncedTicks = 0;
printV("WALLET $i SYNCED");
try {
wallet.stopSync();
await wallet.stopSync();
} catch (e) {
printV("error stopping sync: $e");
}
@ -319,6 +320,10 @@ Future<void> onStart(ServiceInstance service) async {
} else {
throw Exception("sync type not covered");
}
if (syncedTicks > 0) {
content += " - Finishing up...";
}
} else {
if (syncStatus is! NotConnectedSyncStatus) {
wallet.stopSync();