fix monero.com builds

do SP scanning only when enabled
This commit is contained in:
Czarek Nakamoto 2025-03-06 17:27:50 +01:00
parent c6de4c68db
commit 6b46cc7ad8
3 changed files with 18 additions and 2 deletions

View file

@ -714,4 +714,12 @@ class CWBitcoin extends Bitcoin {
return null;
}
}
@override
Future<bool> isSilentPaymentNodeEnabled(Object wallet) {
final electrumWallet = wallet as ElectrumWallet;
return electrumWallet.getNodeSupportsSilentPayments();
}
}

View file

@ -11,7 +11,6 @@ import 'package:cake_wallet/utils/feature_flag.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:connectivity_plus/connectivity_plus.dart';
import 'package:cw_bitcoin/electrum_wallet.dart';
import 'package:cw_core/node.dart';
import 'package:cw_core/sync_status.dart';
import 'package:cw_core/utils/print_verbose.dart';
@ -298,7 +297,9 @@ Future<void> onStart(ServiceInstance service) async {
var node = settingsStore.getCurrentNode(WalletType.bitcoin);
await wallet.connectToNode(node: node);
bool nodeSupportsSP = await (wallet as ElectrumWallet).getNodeSupportsSilentPayments();
bool isScanningActive = await bitcoin!.getScanningActive(wallet);
if (!isScanningActive) continue;
bool nodeSupportsSP = await bitcoin!.isSilentPaymentNodeEnabled(wallet);
if (!nodeSupportsSP) {
// printV("Configured node does not support silent payments, skipping wallet");
// setWalletNotification(
@ -552,6 +553,12 @@ Future<bool> onIosBackground(ServiceInstance service) async {
}
Future<void> initializeService(FlutterBackgroundService bgService, bool useNotifications) async {
final canUseNotifications = await canShowNotification();
if (!canUseNotifications) {
useNotifications = false;
}
if (useNotifications) {
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();

View file

@ -241,6 +241,7 @@ abstract class Bitcoin {
dynamic getStatusRequest(Object wallet);
String? getUnusedMwebAddress(Object wallet);
String? getUnusedSegwitAddress(Object wallet);
Future<bool> isSilentPaymentNodeEnabled(Object wallet);
}
""";