mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-12 13:55:32 +00:00
[skip ci] save
This commit is contained in:
parent
fbc10608b9
commit
9f3e37123f
2 changed files with 13 additions and 3 deletions
|
@ -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");
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue