diff --git a/www/js/services/crypto-services.js b/www/js/services/crypto-services.js index 036742d5c8294eed81ee987c803ded19d1f0d40d..5ad567ce312e89a1ee26ab09c386f210da142105 100644 --- a/www/js/services/crypto-services.js +++ b/www/js/services/crypto-services.js @@ -168,9 +168,9 @@ angular.module('cesium.crypto.services', ['cesium.utils.services']) }; this.util.decode_base58 = function (a) { // TODO : move to abstract factory var i; - a = that.base58.decode(a); - var b = new Uint8Array(a.length); - for (i = 0; i < a.length; i++) b[i] = a[i]; + d = that.base58.decode(a); + var b = new Uint8Array(d.length); + for (i = 0; i < d.length; i++) b[i] = d[i]; return b; }; this.util.decode_base64 = function (a) { diff --git a/www/plugins/es/js/controllers/message-controllers.js b/www/plugins/es/js/controllers/message-controllers.js index 3056a9ba69c5d14ce52aa77bcd375145c84db38e..5ba240e7bd172d97bff4f8f1d0b86bf7a640b83b 100644 --- a/www/plugins/es/js/controllers/message-controllers.js +++ b/www/plugins/es/js/controllers/message-controllers.js @@ -472,6 +472,7 @@ function ESMessageComposeController($scope, $controller) { $scope.$on('$ionicView.enter',$scope.enter); $scope.cancel = function() { + $scope.sending = false; $scope.showHome(); }; @@ -480,6 +481,7 @@ function ESMessageComposeController($scope, $controller) { }; $scope.closeModal = function() { + $scope.sending = false; $scope.showHome(); }; @@ -500,6 +502,7 @@ function ESMessageComposeModalController($scope, Modals, UIUtils, csWallet, esHt $scope.destPub = null; $scope.isResponse = false; $scope.enableSelectWallet = true; + $scope.sending = false; $scope.setParameters = function(parameters) { if (!parameters) return; @@ -570,6 +573,7 @@ function ESMessageComposeModalController($scope, Modals, UIUtils, csWallet, esHt }); } + $scope.sending = true; UIUtils.loading.show(); var data = { issuer: wallet.data.pubkey, @@ -585,7 +589,15 @@ function ESMessageComposeModalController($scope, Modals, UIUtils, csWallet, esHt UIUtils.loading.hide(); $scope.closeModal(id); }) - .catch(UIUtils.onError('MESSAGE.ERROR.SEND_MSG_FAILED')); + .catch(function(err) { + $scope.sending = false; + // silent, if user cancelled; + if (err === 'CANCELLED') { + UIUtils.loading.hide(); + return; + } + UIUtils.onError('MESSAGE.ERROR.SEND_MSG_FAILED')(err); + }); }; diff --git a/www/plugins/es/templates/message/compose_form.html b/www/plugins/es/templates/message/compose_form.html index c7bacc370e1cb272ad7d285341bfc859485c4c47..8ad1f9c88a2f0b5da2814796d0ca35a281029100 100644 --- a/www/plugins/es/templates/message/compose_form.html +++ b/www/plugins/es/templates/message/compose_form.html @@ -83,7 +83,7 @@ <button class="button button-clear button-dark ink" ng-click="cancel()" type="button" translate>COMMON.BTN_CANCEL</button> - <button class="button button-positive ink" type="submit" + <button class="button button-positive ink" type="submit" ng-disabled="sending" translate>TRANSFER.BTN_SEND</button> </div>