Fixes
M committed
Sep 28, 2020 at 22:02 UTC
e08e10bc3537bd6f854b75a8ad2bf9525c83b36a
7 files changed
+59
-14
ios/Runner.xcodeproj/project.pbxproj
+3
-3
@@ -354,7 +354,7 @@
354
buildSettings = {
355
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
356
CLANG_ENABLE_MODULES = YES;
357
- CURRENT_PROJECT_VERSION = 1;
357
+ CURRENT_PROJECT_VERSION = 2;
358
DEVELOPMENT_TEAM = 32J6BB6VUS;
359
ENABLE_BITCODE = NO;
360
FRAMEWORK_SEARCH_PATHS = (
@@ -493,7 +493,7 @@
493
buildSettings = {
494
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
495
CLANG_ENABLE_MODULES = YES;
496
- CURRENT_PROJECT_VERSION = 1;
496
+ CURRENT_PROJECT_VERSION = 2;
497
DEVELOPMENT_TEAM = 32J6BB6VUS;
498
ENABLE_BITCODE = NO;
499
FRAMEWORK_SEARCH_PATHS = (
@@ -526,7 +526,7 @@
526
buildSettings = {
527
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
528
CLANG_ENABLE_MODULES = YES;
529
- CURRENT_PROJECT_VERSION = 1;
529
+ CURRENT_PROJECT_VERSION = 2;
530
DEVELOPMENT_TEAM = 32J6BB6VUS;
531
ENABLE_BITCODE = NO;
532
FRAMEWORK_SEARCH_PATHS = (
lib/core/transaction_history.dart
+4
@@ -19,6 +19,10 @@ abstract class TransactionHistoryBase<TransactionType extends TransactionInfo> {
19
try {
20
_isUpdating = true;
21
final _transactions = await fetchTransactions();
22
+ transactions.keys
23
+ .toSet()
24
+ .difference(_transactions.keys.toSet())
25
+ .forEach((k) => transactions.remove(k));
26
_transactions.forEach((key, value) => transactions[key] = value);
27
_isUpdating = false;
28
} catch (e) {
lib/monero/monero_wallet.dart
+6
-2
@@ -191,7 +191,12 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
191
192
@override
193
Future<void> rescan({int height}) async {
194
+ monero_wallet.setRefreshFromBlockHeight(height: height);
195
monero_wallet.rescanBlockchainAsync();
196
+ await startSync();
197
+ _askForUpdateBalance();
198
+ await _askForUpdateTransactionHistory();
199
+ await save();
200
}
201
202
void _setListeners() {
@@ -247,9 +252,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
252
}
253
254
Future<void> _askForUpdateTransactionHistory() async {
250
- print('start');
255
await transactionHistory.update();
252
- print('end');
256
}
257
258
int _getFullBalance() =>
@@ -270,6 +273,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
273
274
if (walletInfo.isRecovery) {
275
_askForUpdateTransactionHistory();
276
+ _askForUpdateBalance();
277
}
278
279
final currentHeight = getCurrentHeight();
lib/router.dart
+2
-1
@@ -236,7 +236,8 @@ class Router {
236
237
case Routes.login:
238
return CupertinoPageRoute<void>(
239
- builder: (context) => getIt.get<AuthPage>(instanceName: 'login'));
239
+ builder: (context) => getIt.get<AuthPage>(instanceName: 'login'),
240
+ fullscreenDialog: true);
241
242
case Routes.accountCreation:
243
return CupertinoPageRoute<String>(
lib/src/screens/root/root.dart
+1
-1
@@ -65,7 +65,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
65
});
66
}
67
68
- return widget.child;
68
+ return WillPopScope(onWillPop: () async => false, child: widget.child);
69
}
70
71
void _reset() {
lib/src/screens/send/send_page.dart
+16
-2
@@ -425,8 +425,10 @@ class SendPage extends BasePage {
425
EdgeInsets.only(left: 24, right: 24, bottom: 24),
426
bottomSection: Observer(builder: (_) {
427
return LoadingPrimaryButton(
428
- onPressed: () {
429
- if (_formKey.currentState.validate()) {}
428
+ onPressed: () async {
429
+ if (_formKey.currentState.validate()) {
430
+ await sendViewModel.createTransaction();
431
+ }
432
},
433
text: S.of(context).send,
434
color: Theme.of(context).accentTextTheme.body2.color,
@@ -445,6 +447,18 @@ class SendPage extends BasePage {
447
return;
448
}
449
450
+ _cryptoAmountController.addListener(() {
451
+ final amount = _cryptoAmountController.text;
452
+
453
+ if (sendViewModel.sendAll && amount != S.current.all) {
454
+ sendViewModel.sendAll = false;
455
+ }
456
+
457
+ if (amount != sendViewModel.cryptoAmount) {
458
+ sendViewModel.setCryptoAmount(amount);
459
+ }
460
+ });
461
+
462
reaction((_) => sendViewModel.sendAll, (bool all) {
463
if (all) {
464
_cryptoAmountController.text = S.current.all;
lib/store/settings_store.dart
+27
-5
@@ -47,6 +47,28 @@ abstract class SettingsStoreBase with Store {
47
this.nodes = ObservableMap<WalletType, Node>.of(nodes);
48
_sharedPreferences = sharedPreferences;
49
50
+ reaction(
51
+ (_) => fiatCurrency,
52
+ (FiatCurrency fiatCurrency) => sharedPreferences.setString(
53
+ PreferencesKey.currentFiatCurrencyKey, fiatCurrency.serialize()));
54
+
55
+ reaction(
56
+ (_) => transactionPriority,
57
+ (TransactionPriority priority) => sharedPreferences.setInt(
58
+ PreferencesKey.currentTransactionPriorityKey,
59
+ priority.serialize()));
60
+
61
+ reaction(
62
+ (_) => shouldSaveRecipientAddress,
63
+ (bool shouldSaveRecipientAddress) => sharedPreferences.setBool(
64
+ PreferencesKey.shouldSaveRecipientAddressKey,
65
+ shouldSaveRecipientAddress));
66
+
67
+ reaction(
68
+ (_) => isDarkTheme,
69
+ (bool isDarkTheme) => sharedPreferences.setBool(
70
+ PreferencesKey.currentDarkTheme, isDarkTheme));
71
+
72
reaction(
73
(_) => allowBiometricalAuthentication,
74
(bool biometricalAuthentication) => sharedPreferences.setBool(
@@ -61,9 +83,10 @@ abstract class SettingsStoreBase with Store {
83
reaction((_) => currentNode,
84
(Node node) => _saveCurrentNode(node, WalletType.monero));
85
64
- reaction((_) => languageCode,
65
- (String languageCode) => sharedPreferences.setString(
66
- PreferencesKey.currentLanguageCode, languageCode));
86
+ reaction(
87
+ (_) => languageCode,
88
+ (String languageCode) => sharedPreferences.setString(
89
+ PreferencesKey.currentLanguageCode, languageCode));
90
}
91
92
static const defaultPinLength = 4;
@@ -165,8 +188,7 @@ abstract class SettingsStoreBase with Store {
188
initialDarkTheme: savedDarkTheme,
189
actionlistDisplayMode: actionListDisplayMode,
190
initialPinLength: pinLength,
168
- initialLanguageCode: savedLanguageCode
169
- );
191
+ initialLanguageCode: savedLanguageCode);
192
}
193
194
Future<void> _saveCurrentNode(Node node, WalletType walletType) async {