diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 6599e2165e6576401f3eed7a9ce440e4d462181f..4b5bf8a993c8651d7412647c7cafae8f9776fa4d 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -25,7 +25,8 @@ "BTN_PICTURE_FAVORISE": "Default", "UNIVERSAL_DIVIDEND": "Universal dividend", "UD": "UD", - "DATE_PATTERN": "YYYY-MM-DD HH:mm" + "DATE_PATTERN": "YYYY-MM-DD HH:mm", + "EMPTY_PARENTHESIS": "(empty)" }, "SYSTEM": { "PICTURE_CHOOSE_TYPE": "Choose picture source :", @@ -236,6 +237,7 @@ }, "CONFIRM": { "POPUP_TITLE": "<b>Confirmation</b>", - "CERTIFY_RULES": "<b>Security warning:</b><br/><br/><b class=\"assertive\">Don't certify an account</b> if you believe that: <ul><li>1.) the issuers identity might be faked.<li>2.) the issuer already has another certified account.<li>3.) the issuer purposely or carelessly violates rule 1 or 2 (he certifies faked or double accounts).</ul></small><br/>Are you sure you want to certify this identity ?" + "CERTIFY_RULES": "<b>Security warning:</b><br/><br/><b class=\"assertive\">Don't certify an account</b> if you believe that: <ul><li>1.) the issuers identity might be faked.<li>2.) the issuer already has another certified account.<li>3.) the issuer purposely or carelessly violates rule 1 or 2 (he certifies faked or double accounts).</ul></small><br/>Are you sure you want to certify this identity ?", + "TRANSFER": "<b>Transfer summary:</b><br/><br/><ul><li> - From: <b>{{from}}</b></li><li> - To: <b>{{to}}</b></li><li> - Amount: <b>{{amount}} {{unit}}</b></li><li> - Comment: <i>{{comment}}</i></li></ul><br/><b>Are-you sure you want to send this payment ?</b>" } } diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 77fe22b79041bef7993591e16b8b0a721c360f29..8f578b2cedcd6f38ce49ff451b8d7e3fef2bad6b 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -25,7 +25,8 @@ "BTN_PICTURE_FAVORISE": "Principale", "UNIVERSAL_DIVIDEND": "Dividende universel", "UD": "DU", - "DATE_PATTERN": "DD/MM/YYYY HH:mm" + "DATE_PATTERN": "DD/MM/YYYY HH:mm", + "EMPTY_PARENTHESIS": "(vide)" }, "SYSTEM": { "PICTURE_CHOOSE_TYPE": "Choisir la source :", @@ -236,6 +237,7 @@ }, "CONFIRM": { "POPUP_TITLE": "<b>Confirmation</b>", - "CERTIFY_RULES": "<b>Avertissement de sécurité :</b><br/><br/><b class=\"assertive\">Ne pas certifier</b> un compte si vous pensez que :<ul><li>1.) il ne correspond pas à une personne physique vivante.<li>2.) son propriétaire possède un autre compte déjà certifié.<li>3.) son propriétaire viole (volontairement ou non) la règle 1 ou 2 (par exemple en certifiant des comptes factices ou en double).</ul><br/><b>Etes-vous sûr de vouloir néanmoins certifier cette identité ?</b>" + "CERTIFY_RULES": "<b>Avertissement de sécurité :</b><br/><br/><b class=\"assertive\">Ne pas certifier</b> un compte si vous pensez que :<ul><li>1.) il ne correspond pas à une personne physique vivante.<li>2.) son propriétaire possède un autre compte déjà certifié.<li>3.) son propriétaire viole (volontairement ou non) la règle 1 ou 2 (par exemple en certifiant des comptes factices ou en double).</ul><br/><b>Etes-vous sûr de vouloir néanmoins certifier cette identité ?</b>", + "TRANSFER": "<b>Récapitulatif du paiement</b> :<br/><br/><ul><li> - De : {{from}}</li><li> - A : <b>{{to}}</b></li><li> - Montant : <b>{{amount}} {{unit}}</b></li><li> - Commentaire : <i>{{comment}}</i></li></ul><br/><b>Etes-vous sûr de vouloir envoyer ce paiement ?</b>" } } diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index e05b442a20b1d2348dcfcf8631a87912e64d1078..492b8665e0803dedf102caf0ee44ab847ea04f01 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -242,7 +242,7 @@ function LoginModalController($scope, $rootScope, $ionicModal, Wallet, CryptoUti function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDelegate, UIUtils, $q, $timeout, - CryptoUtils, BMA, Wallet, APP_CONFIG, $ionicHistory, Device, $ionicPopover + CryptoUtils, BMA, Wallet, APP_CONFIG, $ionicHistory, Device, $ionicPopover, $translate, $filter ) { 'ngInject'; @@ -252,7 +252,7 @@ function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDe LoginModalController.call(this, $scope, $rootScope, $ionicModal, Wallet, CryptoUtils, UIUtils, $q, $state, $timeout, $ionicSideMenuDelegate, $ionicHistory); - TransferModalController.call(this, $scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover); + TransferModalController.call(this, $scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover, $translate, $filter, $q); //////////////////////////////////////// // Load currencies diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index 49b377a7912e98daf7d0522d1cc744646461925e..041787b2e468732a268afa474f54b324b3525e1a 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -39,10 +39,10 @@ angular.module('cesium.transfer.controllers', ['cesium.services', 'cesium.curren .controller('TransferCtrl', TransferController) ; -function TransferController($scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover) { +function TransferController($scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover, $translate, $filter, $q) { 'ngInject'; - TransferModalController.call(this, $scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover); + TransferModalController.call(this, $scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover, $translate, $filter, $q); $scope.$on('$ionicView.enter', function(e, $state) { if (!!$state.stateParams && !!$state.stateParams.pubkey) { @@ -67,7 +67,7 @@ function TransferController($scope, $rootScope, $ionicModal, $state, BMA, Wallet }); } -function TransferModalController($scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover) { +function TransferModalController($scope, $rootScope, $ionicModal, $state, BMA, Wallet, UIUtils, $timeout, Device, $ionicPopover, $translate, $filter, $q) { 'ngInject'; $scope.walletData = {}; @@ -210,17 +210,20 @@ function TransferModalController($scope, $rootScope, $ionicModal, $state, BMA, W return; } - UIUtils.loading.show(); + $scope.askTransferConfirm() + .then(function(){ + UIUtils.loading.show(); - var amount = $scope.formData.amount; - if ($scope.formData.useRelative && !!amount && - typeof amount == "string") { - amount = $scope.walletData.currentUD * - amount.replace(new RegExp('[.,]'), '.'); - } - Wallet.transfer($scope.formData.destPub, amount, $scope.formData.comment, $scope.formData.useRelative) - .then(function() { - var callback = $scope.formData.callback; + var amount = $scope.formData.amount; + if ($scope.formData.useRelative && !!amount && + typeof amount == "string") { + amount = $scope.walletData.currentUD * + amount.replace(new RegExp('[.,]'), '.'); + } + + Wallet.transfer($scope.formData.destPub, amount, $scope.formData.comment, $scope.formData.useRelative) + .then(function() { + var callback = $scope.formData.callback; $scope.formData = {}; // Reset form data $scope.transferForm.$setPristine(); // Reset form $scope.closeTransfer(); @@ -233,12 +236,36 @@ function TransferModalController($scope, $rootScope, $ionicModal, $state, BMA, W UIUtils.alert.info('INFO.TRANSFER_SENT'); $state.go('app.view_wallet'); } - }) - .catch( - function(err) { - UIUtils.onError('ERROR.SEND_TX_FAILED')(err); - } - ); + }) + .catch( + function(err) { + UIUtils.onError('ERROR.SEND_TX_FAILED')(err); + } + ); + }); + }; + + $scope.askTransferConfirm = function() { + return $q(function(resolve, reject) { + $translate(['COMMON.UD', 'COMMON.EMPTY_PARENTHESIS']) + .then(function(translations){ + $translate('CONFIRM.TRANSFER', { + from: $scope.walletData.isMember ? $scope.walletData.uid : $filter('formatPubkey')($scope.walletData.pubkey), + to: $scope.destUid ? $scope.destUid : $scope.destPub, + amount: $scope.formData.amount, + unit: $scope.formData.useRelative ? translations['COMMON.UD'] : $filter('abbreviate')($scope.walletData.parameters.currency), + comment: (!$scope.formData.comment || $scope.formData.comment.trim().length == 0) ? translations['COMMON.EMPTY_PARENTHESIS'] : $scope.formData.comment + }) + .then(function(confirmMsg) { + UIUtils.alert.confirm(confirmMsg) + .then(function(confirm){ + if (confirm) { + resolve(); + } + }); + }); + }); + }); }; $scope.closeLookup = function() {