From 176c6a9afb7fbb716d303dd86f02846e0016cc59 Mon Sep 17 00:00:00 2001 From: lenondupe Date: Thu, 21 Dec 2017 14:11:42 +0100 Subject: [PATCH] #48 separate alert group for warning of missing memo enables us to clear out warning if destination is changed and on the other hand keep the warning if it is not changed (if user navigates back to sendSetup screen from confirm screen) --- controllers/send-widget.controller.es6 | 25 ++++++++++++++++--------- templates/send-widget.template.html | 11 ++++++++--- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/controllers/send-widget.controller.es6 b/controllers/send-widget.controller.es6 index 827924d..f1193cd 100644 --- a/controllers/send-widget.controller.es6 +++ b/controllers/send-widget.controller.es6 @@ -65,11 +65,17 @@ export default class SendWidgetController { }); Alerts.registerGroup(this.amountAlertGroup); - this.memoAlertGroup = new AlertGroup(); - this.memoAlertGroup.registerUpdateListener(alerts => { - this.memoAlerts = alerts; + this.memoErrorAlertGroup = new AlertGroup(); + this.memoErrorAlertGroup.registerUpdateListener(alerts => { + this.memoErrorAlerts = alerts; }); - Alerts.registerGroup(this.memoAlertGroup); + Alerts.registerGroup(this.memoErrorAlertGroup); + + this.memoWarningAlertGroup = new AlertGroup(); + this.memoWarningAlertGroup.registerUpdateListener(alerts => { + this.memoWarningAlerts = alerts; + }); + Alerts.registerGroup(this.memoWarningAlertGroup); this.useLedger = this.session.data && this.session.data['useLedger']; this.bip32Path = this.session.data && this.session.data['bip32Path']; @@ -78,6 +84,7 @@ export default class SendWidgetController { loadDestination($event) { this.loadingDestination = true; this.addressAlertGroup.clear(); + this.memoWarningAlertGroup.clear(); let resetState = () => { this.destination = null; @@ -133,7 +140,7 @@ export default class SendWidgetController { text: 'The payment destination (' + knownAccounts[this.destination].name +') requires you to specify a memo to identify your account.', type: Alert.TYPES.WARNING }); - this.memoAlertGroup.show(alert); + this.memoWarningAlertGroup.show(alert); } this.loadingDestination = false; @@ -171,7 +178,7 @@ export default class SendWidgetController { if ($event) { $event.preventDefault(); } - this.memoAlertGroup.clear(); + this.memoErrorAlertGroup.clear(); this.memo = false; this.memoType = null; this.memoValue = null; @@ -194,7 +201,7 @@ export default class SendWidgetController { this.addressAlertGroup.clear(); this.amountAlertGroup.clear(); - this.memoAlertGroup.clear(); + this.memoErrorAlertGroup.clear(); if (!Account.isValidAccountId(this.destination)) { let alert = new Alert({ @@ -242,11 +249,11 @@ export default class SendWidgetController { text: memoError, type: Alert.TYPES.ERROR }); - this.memoAlertGroup.show(alert); + this.memoErrorAlertGroup.show(alert); } } - if (this.addressAlerts.length || this.amountAlerts.length || this.memoAlerts.length) { + if (this.addressAlerts.length || this.amountAlerts.length || this.memoErrorAlerts.length) { this.sending = false; return; } diff --git a/templates/send-widget.template.html b/templates/send-widget.template.html index db97add..35f388c 100644 --- a/templates/send-widget.template.html +++ b/templates/send-widget.template.html @@ -65,7 +65,7 @@

Send lumens

@@ -75,8 +75,13 @@

Send lumens

Note: The specified federation address requires this transaction's memo to be a certain value. -
- +
+ + {{alert.title}} {{alert.text}} + +
+
+ {{alert.title}} {{alert.text}}