diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index b6fb6e62d..6836cc4dc 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -150,7 +150,7 @@ class CWBitcoin extends Bitcoin { return bitcoinWallet.unspentCoins; } - void updateUnspents(Object wallet) async { + Future updateUnspents(Object wallet) async { final bitcoinWallet = wallet as ElectrumWallet; await bitcoinWallet.updateUnspent(); } diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 1279beeca..68e76d423 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -186,7 +186,10 @@ Future defaultSettingsMigration( await rewriteSecureStoragePin(secureStorage: secureStorage); break; case 26: - await insecureStorageMigration(secureStorage: secureStorage, sharedPreferences: sharedPreferences); + /// commented out as it was a probable cause for some users to have white screen issues + /// maybe due to multiple access on Secure Storage at once + /// or long await time on start of the app + // await insecureStorageMigration(secureStorage: secureStorage, sharedPreferences: sharedPreferences); break; default: break; @@ -507,7 +510,7 @@ Future changeLitecoinCurrentElectrumServerToDefault( Future changeBitcoinCashCurrentNodeToDefault( {required SharedPreferences sharedPreferences, required Box nodes}) async { final server = getBitcoinCashDefaultElectrumServer(nodes: nodes); - final serverId = server?.key as int ?? 0; + final serverId = server?.key as int? ?? 0; await sharedPreferences.setInt(PreferencesKey.currentBitcoinCashNodeIdKey, serverId); } diff --git a/lib/monero/cw_monero.dart b/lib/monero/cw_monero.dart index 947d274a8..959ae92ce 100644 --- a/lib/monero/cw_monero.dart +++ b/lib/monero/cw_monero.dart @@ -331,7 +331,7 @@ class CWMonero extends Monero { } @override - void updateUnspents(Object wallet) async { + Future updateUnspents(Object wallet) async { final moneroWallet = wallet as MoneroWallet; await moneroWallet.updateUnspent(); } diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index 41fc29713..c4dcae32c 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -283,15 +283,17 @@ class ExchangeTradeState extends State { if (state is TransactionCommitted) { WidgetsBinding.instance.addPostFrameCallback((_) { - showPopUp( - context: context, - builder: (BuildContext popupContext) { - return AlertWithOneAction( - alertTitle: S.of(popupContext).sending, - alertContent: S.of(popupContext).transaction_sent, - buttonText: S.of(popupContext).ok, - buttonAction: () => Navigator.of(popupContext).pop()); - }); + if (context.mounted) { + showPopUp( + context: context, + builder: (BuildContext popupContext) { + return AlertWithOneAction( + alertTitle: S.of(popupContext).sending, + alertContent: S.of(popupContext).transaction_sent, + buttonText: S.of(popupContext).ok, + buttonAction: () => Navigator.of(popupContext).pop()); + }); + } }); } }); diff --git a/lib/src/screens/root/root.dart b/lib/src/screens/root/root.dart index b3d503162..5704c99ad 100644 --- a/lib/src/screens/root/root.dart +++ b/lib/src/screens/root/root.dart @@ -53,16 +53,16 @@ class RootState extends State with WidgetsBindingObserver { @override void initState() { - WidgetsBinding.instance.addPostFrameCallback((_) async { - bool value = await widget.authService.requireAuth(); - setState(() { - _requestAuth = value; + WidgetsBinding.instance.addObserver(this); + + widget.authService.requireAuth().then((value) { + WidgetsBinding.instance.addPostFrameCallback((_) { + setState(() => _requestAuth = value); }); }); _isInactiveController = StreamController.broadcast(); _isInactive = false; _postFrameCallback = false; - WidgetsBinding.instance.addObserver(this); super.initState(); if (DeviceInfo.instance.isMobile) { initUniLinks(); diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 0ffedec90..253adf3ea 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -922,7 +922,7 @@ abstract class SettingsStoreBase with Store { final allowBiometricalAuthentication = await SecureKey.getBool( secureStorage: secureStorage, sharedPreferences: sharedPreferences, - key: SecureKey.pinTimeOutDuration, + key: SecureKey.allowBiometricalAuthenticationKey, ) ?? false; @@ -1247,6 +1247,16 @@ abstract class SettingsStoreBase with Store { ) ?? totpSecretKey; + final timeOutDuration = await SecureKey.getInt( + secureStorage: _secureStorage, + sharedPreferences: sharedPreferences, + key: SecureKey.pinTimeOutDuration, + ); + + pinTimeOutDuration = timeOutDuration != null + ? PinCodeRequiredDuration.deserialize(raw: timeOutDuration) + : defaultPinCodeTimeOutDuration; + allowBiometricalAuthentication = await SecureKey.getBool( secureStorage: _secureStorage, sharedPreferences: sharedPreferences, diff --git a/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart b/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart index 1815b1689..6380bb07e 100644 --- a/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart +++ b/lib/view_model/unspent_coins/unspent_coins_list_view_model.dart @@ -16,30 +16,17 @@ abstract class UnspentCoinsListViewModelBase with Store { UnspentCoinsListViewModelBase( {required this.wallet, required Box unspentCoinsInfo}) : _unspentCoinsInfo = unspentCoinsInfo { + _updateUnspentCoinsInfo(); _updateUnspents(); } WalletBase wallet; final Box _unspentCoinsInfo; - @computed - ObservableList get items => ObservableList.of(_getUnspents().map((elem) { - final info = - getUnspentCoinInfo(elem.hash, elem.address, elem.value, elem.vout, elem.keyImage); + final ObservableList _items = ObservableList(); - return UnspentCoinsItem( - address: elem.address, - amount: '${formatAmountToString(elem.value)} ${wallet.currency.title}', - hash: elem.hash, - isFrozen: info.isFrozen, - note: info.note, - isSending: info.isSending, - amountRaw: elem.value, - vout: elem.vout, - keyImage: elem.keyImage, - isChange: elem.isChange, - ); - })); + @computed + ObservableList get items => _items; Future saveUnspentCoinInfo(UnspentCoinsItem item) async { try { @@ -77,9 +64,14 @@ abstract class UnspentCoinsListViewModelBase with Store { } Future _updateUnspents() async { - if (wallet.type == WalletType.monero) return monero!.updateUnspents(wallet); - if ([WalletType.bitcoin, WalletType.litecoin, WalletType.bitcoinCash].contains(wallet.type)) - return bitcoin!.updateUnspents(wallet); + if (wallet.type == WalletType.monero) { + await monero!.updateUnspents(wallet); + } + if ([WalletType.bitcoin, WalletType.litecoin, WalletType.bitcoinCash].contains(wallet.type)) { + await bitcoin!.updateUnspents(wallet); + } + + _updateUnspentCoinsInfo(); } List _getUnspents() { @@ -88,4 +80,26 @@ abstract class UnspentCoinsListViewModelBase with Store { return bitcoin!.getUnspents(wallet); return List.empty(); } + + @action + void _updateUnspentCoinsInfo() { + _items.clear(); + _items.addAll(_getUnspents().map((elem) { + final info = + getUnspentCoinInfo(elem.hash, elem.address, elem.value, elem.vout, elem.keyImage); + + return UnspentCoinsItem( + address: elem.address, + amount: '${formatAmountToString(elem.value)} ${wallet.currency.title}', + hash: elem.hash, + isFrozen: info.isFrozen, + note: info.note, + isSending: info.isSending, + amountRaw: elem.value, + vout: elem.vout, + keyImage: elem.keyImage, + isChange: elem.isChange, + ); + })); + } } diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 9301b4a89..8de5be02c 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.10.1" -MONERO_COM_BUILD_NUMBER=73 +MONERO_COM_VERSION="1.10.2" +MONERO_COM_BUILD_NUMBER=74 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_SCHEME="monero.com" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.13.1" -CAKEWALLET_BUILD_NUMBER=190 +CAKEWALLET_VERSION="4.13.2" +CAKEWALLET_BUILD_NUMBER=191 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_SCHEME="cakewallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index 4642fbc64..c7d62a40a 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.10.1" -MONERO_COM_BUILD_NUMBER=71 +MONERO_COM_VERSION="1.10.2" +MONERO_COM_BUILD_NUMBER=72 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.13.1" -CAKEWALLET_BUILD_NUMBER=209 +CAKEWALLET_VERSION="4.13.2" +CAKEWALLET_BUILD_NUMBER=210 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" diff --git a/scripts/macos/app_env.sh b/scripts/macos/app_env.sh index 4e9c7a09b..c2c7493af 100755 --- a/scripts/macos/app_env.sh +++ b/scripts/macos/app_env.sh @@ -16,13 +16,13 @@ if [ -n "$1" ]; then fi MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.0.1" -MONERO_COM_BUILD_NUMBER=3 +MONERO_COM_VERSION="1.0.2" +MONERO_COM_BUILD_NUMBER=4 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="1.6.1" -CAKEWALLET_BUILD_NUMBER=51 +CAKEWALLET_VERSION="1.6.2" +CAKEWALLET_BUILD_NUMBER=52 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then diff --git a/tool/configure.dart b/tool/configure.dart index ce894d197..4421d4f3f 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -127,7 +127,7 @@ abstract class Bitcoin { String bitcoinTransactionPriorityWithLabel(TransactionPriority priority, int rate); List getUnspents(Object wallet); - void updateUnspents(Object wallet); + Future updateUnspents(Object wallet); WalletService createBitcoinWalletService(Box walletInfoSource, Box unspentCoinSource); WalletService createLitecoinWalletService(Box walletInfoSource, Box unspentCoinSource); TransactionPriority getBitcoinTransactionPriorityMedium(); @@ -270,7 +270,7 @@ abstract class Monero { List getMoneroWordList(String language); List getUnspents(Object wallet); - void updateUnspents(Object wallet); + Future updateUnspents(Object wallet); WalletCredentials createMoneroRestoreWalletFromKeysCredentials({ required String name,