|
1 | 1 | import 'dart:async'; |
2 | 2 | import 'dart:ffi'; |
| 3 | +import 'dart:io'; |
3 | 4 |
|
4 | 5 | import 'package:cw_monero/api/convert_utf8_to_string.dart'; |
5 | 6 | import 'package:cw_monero/api/exceptions/setup_wallet_exception.dart'; |
@@ -367,23 +368,25 @@ bool priorityInQueue = false; |
367 | 368 |
|
368 | 369 | Future<bool> store({bool prioritySave = false}) async { |
369 | 370 | // Delay saves |
370 | | - if (priorityInQueue) { |
371 | | - return false; |
372 | | - } |
373 | | - print( |
374 | | - "${DateTime.now().millisecondsSinceEpoch} $prioritySave $priorityInQueue"); |
375 | | - if (DateTime.now().millisecondsSinceEpoch < storeTime + 90000 && |
376 | | - prioritySave) { |
377 | | - priorityInQueue = true; |
378 | | - await Future.delayed(Duration(seconds: 1)); |
379 | | - priorityInQueue = false; |
380 | | - return store(prioritySave: prioritySave); |
381 | | - } else if (DateTime.now().millisecondsSinceEpoch < storeTime + 90000 && |
382 | | - !prioritySave) { |
383 | | - return false; |
| 371 | + if (Platform.isAndroid) { |
| 372 | + if (priorityInQueue) { |
| 373 | + return false; |
| 374 | + } |
| 375 | + print( |
| 376 | + "${DateTime.now().millisecondsSinceEpoch} $prioritySave $priorityInQueue"); |
| 377 | + if (DateTime.now().millisecondsSinceEpoch < storeTime + 90000 && |
| 378 | + prioritySave) { |
| 379 | + priorityInQueue = true; |
| 380 | + await Future.delayed(Duration(seconds: 1)); |
| 381 | + priorityInQueue = false; |
| 382 | + return store(prioritySave: prioritySave); |
| 383 | + } else if (DateTime.now().millisecondsSinceEpoch < storeTime + 90000 && |
| 384 | + !prioritySave) { |
| 385 | + return false; |
| 386 | + } |
| 387 | + print("released $storeTime"); |
| 388 | + storeTime = DateTime.now().millisecondsSinceEpoch; |
384 | 389 | } |
385 | | - print("released $storeTime"); |
386 | | - storeTime = DateTime.now().millisecondsSinceEpoch; |
387 | 390 | await compute<int, void>(_storeSync, 0); |
388 | 391 | return true; |
389 | 392 | } |
|
0 commit comments