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