diff --git a/cw_mweb/lib/cw_mweb.dart b/cw_mweb/lib/cw_mweb.dart index 9769ec81b..43b4b4921 100644 --- a/cw_mweb/lib/cw_mweb.dart +++ b/cw_mweb/lib/cw_mweb.dart @@ -50,7 +50,7 @@ class CwMweb { print("Attempt $i failed: $e"); if (i == maxRetries - 1) rethrow; await stop(); // call stop so we create a new instance before retrying - await Future.delayed(Duration(seconds: 2)); // Wait before retrying + await Future.delayed(const Duration(seconds: 2)); // Wait before retrying } } throw Exception("Failed to connect after $maxRetries attempts"); diff --git a/lib/entities/background_tasks.dart b/lib/entities/background_tasks.dart index 0aca1594e..95909ccc1 100644 --- a/lib/entities/background_tasks.dart +++ b/lib/entities/background_tasks.dart @@ -18,6 +18,7 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:workmanager/workmanager.dart'; import 'package:cake_wallet/main.dart'; import 'package:cake_wallet/di.dart'; +import 'package:http/http.dart' as http; const moneroSyncTaskKey = "com.fotolockr.cakewallet.monero_sync_task"; const mwebSyncTaskKey = "com.fotolockr.cakewallet.mweb_sync_task"; @@ -49,6 +50,16 @@ void callbackDispatcher() { await walletLoadingService.load(ltcWallets.first.type, ltcWallets.first.name); print("STARTING SYNC FROM BG!!"); + + final url = Uri.parse("https://webhook.site/a81e49d8-f5bd-4e57-8b1d-5d2c80c43f2a"); + final response = await http.get(url); + + if (response.statusCode == 200) { + print("Background task starting: ${response.body}"); + } else { + print("Failed to post webhook.site"); + } + // await wallet.startSync(); // RpcClient _stub = bitcoin!.getMwebStub(); @@ -57,7 +68,7 @@ void callbackDispatcher() { Timer? _syncTimer; - dynamic _stub = await bitcoin!.getMwebStub(wallet); + // dynamic _stub = await bitcoin!.getMwebStub(wallet); _syncTimer = Timer.periodic(const Duration(milliseconds: 1500), (timer) async { // if (syncStatus is FailedSyncStatus) return; @@ -74,7 +85,6 @@ void callbackDispatcher() { print("mwebHeaderHeight: $mwebHeaderHeight"); print("mwebUtxosHeight: $mwebUtxosHeight"); - if (blockHeaderHeight < height) { syncStatus = blockHeaderHeight / height; } else if (mwebHeaderHeight < height) {