mirror of
https://github.com/wownero/cyberwow.git
synced 2026-12-04 22:23:57 +01:00
refresh faster while in foreground
This commit is contained in:
@@ -29,20 +29,6 @@ import '../config.dart';
|
||||
|
||||
typedef GetNotificationFunc = AppLifecycleState Function();
|
||||
|
||||
Stream<int> targetHeight(GetNotificationFunc getNotification) async* {
|
||||
while (true) {
|
||||
final _appState = getNotification();
|
||||
// print('refresh targetHeight: app state: ${_appState}');
|
||||
|
||||
if (_appState == AppLifecycleState.resumed) {
|
||||
final _targetHeight = await rpc.targetHeight();
|
||||
yield _targetHeight;
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: 2), () => "1");
|
||||
}
|
||||
}
|
||||
|
||||
Stream<Null> pull(GetNotificationFunc getNotification) async* {
|
||||
while (true) {
|
||||
final _appState = getNotification();
|
||||
@@ -50,8 +36,9 @@ Stream<Null> pull(GetNotificationFunc getNotification) async* {
|
||||
|
||||
if (_appState == AppLifecycleState.resumed) {
|
||||
yield null;
|
||||
await Future.delayed(const Duration(milliseconds: 400), () => null);
|
||||
} else {
|
||||
await Future.delayed(const Duration(seconds: 2), () => null);
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: 2), () => "1");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user