mirror of
https://github.com/wownero/cyberwow.git
synced 2026-10-17 15:31:47 +02:00
use Future.delayed helper
This commit is contained in:
@@ -27,6 +27,7 @@ import 'rpc/rpc.dart' as rpc;
|
||||
|
||||
import '../config.dart';
|
||||
import '../logging.dart';
|
||||
import '../helper.dart';
|
||||
|
||||
typedef GetNotificationFunc = AppLifecycleState Function();
|
||||
|
||||
@@ -37,9 +38,10 @@ Stream<Null> pull(GetNotificationFunc getNotification, final String puller) asyn
|
||||
|
||||
if (_appState == AppLifecycleState.resumed) {
|
||||
yield null;
|
||||
await Future.delayed(const Duration(milliseconds: 1000), () => null);
|
||||
await tick();
|
||||
} else {
|
||||
await Future.delayed(const Duration(seconds: 2), () => null);
|
||||
await tick();
|
||||
await tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,3 +69,5 @@ List<dynamic> asList(dynamic x) => x ?? [];
|
||||
List<Map<String, dynamic>> asJsonArray(dynamic x) => x?.cast<Map<String, dynamic>>() ?? [];
|
||||
|
||||
Map<String, dynamic> asMap(dynamic x) => x ?? {};
|
||||
|
||||
Future<void> tick() async => await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
@@ -199,7 +199,7 @@ class _CyberWOW_PageState extends State<CyberWOW_Page> with WidgetsBindingObserv
|
||||
_exiting = true;
|
||||
inputStreamController.sink.add('exit');
|
||||
|
||||
await Future.delayed(const Duration(seconds: 5), () => null);
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
|
||||
// the process controller should call exit(0) for us
|
||||
log.warning('Daemon took too long to shut down!');
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../controller/helper.dart';
|
||||
import '../config.dart' as config;
|
||||
import '../logging.dart';
|
||||
import '../helper.dart';
|
||||
|
||||
import 'prototype.dart';
|
||||
import 'syncing.dart';
|
||||
@@ -49,10 +50,11 @@ class LoadingState extends AppState {
|
||||
|
||||
for (final String char in chars) {
|
||||
append(char);
|
||||
await Future.delayed(Duration(milliseconds: config.c.splashDelay), () => "1");
|
||||
await Future.delayed(Duration(milliseconds: config.c.splashDelay));
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: 2), () => "1");
|
||||
await tick();
|
||||
await tick();
|
||||
}
|
||||
|
||||
SharedPreferences _prefs = await SharedPreferences.getInstance();
|
||||
@@ -60,7 +62,7 @@ class LoadingState extends AppState {
|
||||
|
||||
if (_bannerShown == null) {
|
||||
await showBanner();
|
||||
_prefs.setBool(config.bannerShownKey, true);
|
||||
await _prefs.setBool(config.bannerShownKey, true);
|
||||
}
|
||||
|
||||
SyncingState _next = SyncingState(appHook);
|
||||
|
||||
Reference in New Issue
Block a user