use refresh controller

pull/1/head
fuwa 5 years ago
parent 31eb3dac8e
commit 33f8ba5cf6

@ -32,7 +32,7 @@ Stream<int> targetHeight(GetNotificationFunc getNotification) async* {
if (_appState == AppLifecycleState.resumed) {
final _targetHeight = await rpc.targetHeight();
yield _targetHeight
yield _targetHeight;
}
await Future.delayed(const Duration(seconds: 2), () => "1");

@ -178,17 +178,8 @@ class SyncedState extends HookedState {
Future<ReSyncingState> next() async {
print("Synced next");
while (true) {
final _appState = getNotification();
// print('synced: app state: ${_appState}');
if (_appState == AppLifecycleState.resumed) {
final _targetHeight = await rpc.targetHeight();
if (_targetHeight > 0) break;
height = await rpc.height();
}
await Future.delayed(const Duration(seconds: 2), () => "1");
await for (var _targetHeight in refresh.targetHeight(getNotification)) {
if (_targetHeight > 0) break;
}
// print('synced: loop exit');