From e6b9a49a284d4286f49061eb556be999a2413ddb Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Wed, 11 Sep 2024 21:03:47 -0700 Subject: [PATCH] silent payments fix --- lib/entities/background_tasks.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/entities/background_tasks.dart b/lib/entities/background_tasks.dart index 02de8949e..89ec1a5c4 100644 --- a/lib/entities/background_tasks.dart +++ b/lib/entities/background_tasks.dart @@ -11,6 +11,7 @@ import 'package:cake_wallet/utils/feature_flag.dart'; import 'package:cake_wallet/view_model/settings/sync_mode.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_bitcoin/electrum_wallet.dart'; import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:flutter/widgets.dart'; @@ -151,6 +152,8 @@ Future onStart(ServiceInstance service) async { final node = getIt.get().getCurrentNode(bitcoinWallets[i].type); await wallet.connectToNode(node: node); await wallet.startSync(); + // TODO: use proxy layer: + await (wallet as ElectrumWallet).setSilentPaymentsScanning(true); syncingWallets.add(wallet); } } else { @@ -166,6 +169,7 @@ Future onStart(ServiceInstance service) async { // } } + print("STARTING SYNC TIMER"); _syncTimer?.cancel(); _syncTimer = Timer.periodic(const Duration(milliseconds: 2000), (timer) { // final wallet = getIt.get().wallet; @@ -209,8 +213,6 @@ Future onStart(ServiceInstance service) async { ), ); } - - }); }); } @@ -263,6 +265,8 @@ Future initializeService(FlutterBackgroundService bgService, bool useNotif } } catch (_) {} + print("INITIALIZING SERVICE"); + await bgService.configure( androidConfiguration: AndroidConfiguration( onStart: onStart,