exit wallet when backing out from wallet view on mobile

This commit is contained in:
sneurlax 2024-02-06 18:53:29 -06:00
parent 15aeb39776
commit 469ab91dfd

View file

@ -59,6 +59,7 @@ import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/show_loading.dart';
import 'package:stackwallet/utilities/text_styles.dart';
@ -305,6 +306,26 @@ class _WalletViewState extends ConsumerState<WalletView> {
BackupFrequencyType.afterClosingAWallet) {
unawaited(ref.read(autoSWBServiceProvider).doBackup());
}
// Close the wallet according to syncing preferences.
switch (ref.read(prefsChangeNotifierProvider).syncType) {
case SyncingType.currentWalletOnly:
// Close the wallet.
unawaited(ref.watch(pWallets).getWallet(walletId).exit());
// unawaited so we don't lag the UI.
case SyncingType.selectedWalletsAtStartup:
// Close if this wallet is not in the list to be synced.
if (!ref
.read(prefsChangeNotifierProvider)
.walletIdsSyncOnStartup
.contains(widget.walletId)) {
unawaited(ref.watch(pWallets).getWallet(walletId).exit());
// unawaited so we don't lag the UI.
}
case SyncingType.allWalletsOnStartup:
// Do nothing.
break;
}
}
Widget _buildNetworkIcon(WalletSyncStatus status) {