mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 18:07:44 +00:00
21 lines
717 B
Dart
21 lines
717 B
Dart
import 'package:mobx/mobx.dart';
|
|
import 'package:cw_core/transaction_history.dart';
|
|
import 'package:cw_core/wallet_base.dart';
|
|
import 'package:cw_core/balance.dart';
|
|
import 'package:cw_core/transaction_info.dart';
|
|
import 'package:cw_core/sync_status.dart';
|
|
|
|
ReactionDisposer _onWalletSyncStatusChangeReaction;
|
|
|
|
void startWalletSyncStatusChangeReaction(
|
|
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
|
|
TransactionInfo>
|
|
wallet) {
|
|
_onWalletSyncStatusChangeReaction?.reaction?.dispose();
|
|
_onWalletSyncStatusChangeReaction =
|
|
reaction((_) => wallet.syncStatus, (SyncStatus status) async {
|
|
if (status is ConnectedSyncStatus) {
|
|
await wallet.startSync();
|
|
}
|
|
});
|
|
}
|