diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index c1e62ab95..333591d2d 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -493,7 +493,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -526,7 +526,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/core/transaction_history.dart b/lib/core/transaction_history.dart index 02cff8351..dd91fb203 100644 --- a/lib/core/transaction_history.dart +++ b/lib/core/transaction_history.dart @@ -19,6 +19,10 @@ abstract class TransactionHistoryBase { try { _isUpdating = true; final _transactions = await fetchTransactions(); + transactions.keys + .toSet() + .difference(_transactions.keys.toSet()) + .forEach((k) => transactions.remove(k)); _transactions.forEach((key, value) => transactions[key] = value); _isUpdating = false; } catch (e) { diff --git a/lib/monero/monero_wallet.dart b/lib/monero/monero_wallet.dart index 4a053b788..b1133dd5b 100644 --- a/lib/monero/monero_wallet.dart +++ b/lib/monero/monero_wallet.dart @@ -191,7 +191,12 @@ abstract class MoneroWalletBase extends WalletBase with Store { @override Future rescan({int height}) async { + monero_wallet.setRefreshFromBlockHeight(height: height); monero_wallet.rescanBlockchainAsync(); + await startSync(); + _askForUpdateBalance(); + await _askForUpdateTransactionHistory(); + await save(); } void _setListeners() { @@ -247,9 +252,7 @@ abstract class MoneroWalletBase extends WalletBase with Store { } Future _askForUpdateTransactionHistory() async { - print('start'); await transactionHistory.update(); - print('end'); } int _getFullBalance() => @@ -270,6 +273,7 @@ abstract class MoneroWalletBase extends WalletBase with Store { if (walletInfo.isRecovery) { _askForUpdateTransactionHistory(); + _askForUpdateBalance(); } final currentHeight = getCurrentHeight(); diff --git a/lib/router.dart b/lib/router.dart index 7407e9b11..1c579c708 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -236,7 +236,8 @@ class Router { case Routes.login: return CupertinoPageRoute( - builder: (context) => getIt.get(instanceName: 'login')); + builder: (context) => getIt.get(instanceName: 'login'), + fullscreenDialog: true); case Routes.accountCreation: return CupertinoPageRoute( diff --git a/lib/src/screens/root/root.dart b/lib/src/screens/root/root.dart index 7b3032513..1bb2054ab 100644 --- a/lib/src/screens/root/root.dart +++ b/lib/src/screens/root/root.dart @@ -65,7 +65,7 @@ class RootState extends State with WidgetsBindingObserver { }); } - return widget.child; + return WillPopScope(onWillPop: () async => false, child: widget.child); } void _reset() { diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 1bc42ccca..8080f65a8 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -425,8 +425,10 @@ class SendPage extends BasePage { EdgeInsets.only(left: 24, right: 24, bottom: 24), bottomSection: Observer(builder: (_) { return LoadingPrimaryButton( - onPressed: () { - if (_formKey.currentState.validate()) {} + onPressed: () async { + if (_formKey.currentState.validate()) { + await sendViewModel.createTransaction(); + } }, text: S.of(context).send, color: Theme.of(context).accentTextTheme.body2.color, @@ -445,6 +447,18 @@ class SendPage extends BasePage { return; } + _cryptoAmountController.addListener(() { + final amount = _cryptoAmountController.text; + + if (sendViewModel.sendAll && amount != S.current.all) { + sendViewModel.sendAll = false; + } + + if (amount != sendViewModel.cryptoAmount) { + sendViewModel.setCryptoAmount(amount); + } + }); + reaction((_) => sendViewModel.sendAll, (bool all) { if (all) { _cryptoAmountController.text = S.current.all; diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 399cae107..c62c9b2e8 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -47,6 +47,28 @@ abstract class SettingsStoreBase with Store { this.nodes = ObservableMap.of(nodes); _sharedPreferences = sharedPreferences; + reaction( + (_) => fiatCurrency, + (FiatCurrency fiatCurrency) => sharedPreferences.setString( + PreferencesKey.currentFiatCurrencyKey, fiatCurrency.serialize())); + + reaction( + (_) => transactionPriority, + (TransactionPriority priority) => sharedPreferences.setInt( + PreferencesKey.currentTransactionPriorityKey, + priority.serialize())); + + reaction( + (_) => shouldSaveRecipientAddress, + (bool shouldSaveRecipientAddress) => sharedPreferences.setBool( + PreferencesKey.shouldSaveRecipientAddressKey, + shouldSaveRecipientAddress)); + + reaction( + (_) => isDarkTheme, + (bool isDarkTheme) => sharedPreferences.setBool( + PreferencesKey.currentDarkTheme, isDarkTheme)); + reaction( (_) => allowBiometricalAuthentication, (bool biometricalAuthentication) => sharedPreferences.setBool( @@ -61,9 +83,10 @@ abstract class SettingsStoreBase with Store { reaction((_) => currentNode, (Node node) => _saveCurrentNode(node, WalletType.monero)); - reaction((_) => languageCode, - (String languageCode) => sharedPreferences.setString( - PreferencesKey.currentLanguageCode, languageCode)); + reaction( + (_) => languageCode, + (String languageCode) => sharedPreferences.setString( + PreferencesKey.currentLanguageCode, languageCode)); } static const defaultPinLength = 4; @@ -165,8 +188,7 @@ abstract class SettingsStoreBase with Store { initialDarkTheme: savedDarkTheme, actionlistDisplayMode: actionListDisplayMode, initialPinLength: pinLength, - initialLanguageCode: savedLanguageCode - ); + initialLanguageCode: savedLanguageCode); } Future _saveCurrentNode(Node node, WalletType walletType) async {