Fixed migration for pin length. Fixed issue for change of current address on dashboard address page.

This commit is contained in:
M 2020-11-06 15:12:38 +02:00
parent 164fb8b916
commit 8a55d566c6
3 changed files with 14 additions and 4 deletions

View file

@ -157,7 +157,7 @@ Future setup(
});
getIt.registerFactory<WalletAddressListViewModel>(
() => WalletAddressListViewModel(wallet: getIt.get<AppStore>().wallet));
() => WalletAddressListViewModel(appStore: getIt.get<AppStore>()));
getIt.registerFactory(() => BalanceViewModel(
appStore: getIt.get<AppStore>(),

View file

@ -8,6 +8,7 @@ import 'package:cake_wallet/entities/encrypt.dart';
import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cake_wallet/entities/ios_legacy_helper.dart'
as ios_legacy_helper;
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/entities/secret_store_key.dart';
import 'package:cake_wallet/entities/wallet_info.dart';
import 'package:cake_wallet/entities/wallet_type.dart';
@ -98,7 +99,7 @@ Future<void> ios_migrate_user_defaults() async {
//assign the pin lenght
final pinLength = await ios_legacy_helper.getInt('pin-length');
await prefs.setInt('pin-length', pinLength);
await prefs.setInt(PreferencesKey.currentPinLength, pinLength);
//default value for display list key?
final walletName = await ios_legacy_helper.getString('current_wallet_name');

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/store/app_store.dart';
import 'package:flutter/foundation.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart';
@ -54,9 +55,12 @@ class BitcoinURI extends PaymentURI {
}
abstract class WalletAddressListViewModelBase with Store {
WalletAddressListViewModelBase({@required WalletBase wallet}) {
WalletAddressListViewModelBase(
{@required AppStore appStore}) {
hasAccounts = _wallet is MoneroWallet;
_wallet = wallet;
_appStore = appStore;
_wallet = _appStore.wallet;
_onWalletChangeReaction = reaction((_) => _appStore.wallet, (WalletBase wallet) => _wallet = wallet);
_init();
}
@ -111,10 +115,15 @@ abstract class WalletAddressListViewModelBase with Store {
bool hasAccounts;
@observable
WalletBase _wallet;
List<ListItem> _baseItems;
AppStore _appStore;
ReactionDisposer _onWalletChangeReaction;
@computed
String get accountLabel {
final wallet = _wallet;