mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-24 08:09:19 +00:00
sync status fixes, potential fix for background state issue
This commit is contained in:
parent
ac6dc67356
commit
5a2a207aec
4 changed files with 25 additions and 8 deletions
cw_bitcoin/lib
cw_mweb/ios/Classes
ios/Runner
lib/utils
|
@ -408,7 +408,9 @@ abstract class ElectrumWalletBase
|
|||
@override
|
||||
Future<void> startSync() async {
|
||||
try {
|
||||
syncStatus = SyncronizingSyncStatus();
|
||||
if (this is! LitecoinWallet) {
|
||||
syncStatus = SyncronizingSyncStatus();
|
||||
}
|
||||
|
||||
if (hasSilentPaymentsScanning) {
|
||||
await _setInitialHeight();
|
||||
|
@ -426,10 +428,12 @@ abstract class ElectrumWalletBase
|
|||
await updateFeeRates();
|
||||
Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
|
||||
|
||||
if (alwaysScan == true) {
|
||||
_setListeners(walletInfo.restoreHeight);
|
||||
} else {
|
||||
syncStatus = SyncedSyncStatus();
|
||||
if (this is! LitecoinWallet) {
|
||||
if (alwaysScan == true) {
|
||||
_setListeners(walletInfo.restoreHeight);
|
||||
} else {
|
||||
syncStatus = SyncedSyncStatus();
|
||||
}
|
||||
}
|
||||
} catch (e, stacktrace) {
|
||||
print(stacktrace);
|
||||
|
|
|
@ -18,7 +18,7 @@ public class CwMwebPlugin: NSObject, FlutterPlugin {
|
|||
result("iOS " + UIDevice.current.systemVersion)
|
||||
case "start":
|
||||
let args = call.arguments as? [String: String]
|
||||
print("args: \(args)")
|
||||
// print("args: \(args)")
|
||||
let dataDir = args?["dataDir"]
|
||||
var error: NSError?
|
||||
|
||||
|
@ -27,18 +27,22 @@ public class CwMwebPlugin: NSObject, FlutterPlugin {
|
|||
|
||||
if let server = CwMwebPlugin.server {
|
||||
do {
|
||||
print("starting server \(CwMwebPlugin.port)")
|
||||
print("starting server2 \(CwMwebPlugin.port)")
|
||||
try server.start(0, ret0_: &CwMwebPlugin.port)
|
||||
result(CwMwebPlugin.port)
|
||||
} catch let startError as NSError {
|
||||
print("Server Start Error: \(startError.localizedDescription)")
|
||||
result(FlutterError(code: "Server Start Error", message: startError.localizedDescription, details: nil))
|
||||
}
|
||||
} else if let error = error {
|
||||
print("Server Creation Error: \(error.localizedDescription)")
|
||||
result(FlutterError(code: "Server Creation Error", message: error.localizedDescription, details: nil))
|
||||
} else {
|
||||
print("Unknown Error: Failed to create server")
|
||||
result(FlutterError(code: "Unknown Error", message: "Failed to create server", details: nil))
|
||||
}
|
||||
} else {
|
||||
print("Server already running on port: \(CwMwebPlugin.port)")
|
||||
// result(FlutterError(code: "Server Already Running", message: "The server is already running", details: nil))
|
||||
result(CwMwebPlugin.port)
|
||||
}
|
||||
|
@ -51,6 +55,7 @@ public class CwMwebPlugin: NSObject, FlutterPlugin {
|
|||
}
|
||||
|
||||
deinit {
|
||||
print("Stopping and cleaning up server")
|
||||
// Perform cleanup tasks
|
||||
CwMwebPlugin.server?.stop()
|
||||
CwMwebPlugin.server = nil
|
||||
|
|
|
@ -143,4 +143,12 @@ import workmanager
|
|||
}
|
||||
}
|
||||
|
||||
override func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
}
|
||||
|
||||
override func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class ExceptionHandler {
|
|||
}
|
||||
|
||||
static void onError(FlutterErrorDetails errorDetails) async {
|
||||
if (kDebugMode) {
|
||||
if (kDebugMode || kProfileMode) {
|
||||
FlutterError.presentError(errorDetails);
|
||||
debugPrint(errorDetails.toString());
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue