2021-01-11 17:15:27 +00:00
|
|
|
import 'package:cake_wallet/entities/balance.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
|
|
|
import 'package:cake_wallet/core/wallet_base.dart';
|
|
|
|
import 'package:cake_wallet/entities/sync_status.dart';
|
|
|
|
|
|
|
|
ReactionDisposer _onWalletSyncStatusChangeReaction;
|
|
|
|
|
2021-01-11 17:15:27 +00:00
|
|
|
void startWalletSyncStatusChangeReaction(WalletBase<Balance> wallet) {
|
2020-09-21 11:50:26 +00:00
|
|
|
_onWalletSyncStatusChangeReaction?.reaction?.dispose();
|
|
|
|
_onWalletSyncStatusChangeReaction =
|
|
|
|
reaction((_) => wallet.syncStatus, (SyncStatus status) async {
|
|
|
|
if (status is ConnectedSyncStatus) {
|
|
|
|
await wallet.startSync();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|