From 1118183ecae44f1ce2346e41d7071d70ac5ac5f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 3 Jun 2016 11:30:04 -0300 Subject: [PATCH] adding ionic pop up to password request and delete popup header --- public/index.html | 1 - public/views/includes/note.html | 8 +++- public/views/includes/password.html | 35 +++++++--------- src/css/ionic-migration.css | 4 ++ src/js/controllers/index.js | 56 +++++++++++++++++++++----- src/js/controllers/modals/txDetails.js | 1 - src/js/controllers/password.js | 43 -------------------- 7 files changed, 72 insertions(+), 76 deletions(-) delete mode 100644 src/js/controllers/password.js diff --git a/public/index.html b/public/index.html index dc1d2b39b..1c9de69a6 100644 --- a/public/index.html +++ b/public/index.html @@ -27,7 +27,6 @@
-
diff --git a/public/views/includes/note.html b/public/views/includes/note.html index 49008491b..ce0be26e4 100644 --- a/public/views/includes/note.html +++ b/public/views/includes/note.html @@ -1,4 +1,10 @@ - +
+ + +
diff --git a/public/views/includes/password.html b/public/views/includes/password.html index cf50268b2..d2bc23831 100644 --- a/public/views/includes/password.html +++ b/public/views/includes/password.html @@ -1,49 +1,42 @@ -
-
- -
-
-

+

- Your wallet key will be encrypted. The Spending Password cannot be recovered. Be sure to write it down + Your wallet key will be encrypted. The Spending Password cannot be recovered. Be sure to write it down - {{pass.error|translate}} + {{error}}

-
diff --git a/src/css/ionic-migration.css b/src/css/ionic-migration.css index bb776eceb..7a7ac7a1c 100644 --- a/src/css/ionic-migration.css +++ b/src/css/ionic-migration.css @@ -28,6 +28,10 @@ width: 300px; } +.popup-head { + display: none; +} + .bct { background-color: transparent !important; margin-top: -25px; diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index f6c8dd754..1a38d871a 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) { +angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) { var self = this; var SOFT_CONFIRMATION_LIMIT = 12; var errors = bwcService.getErrors(); @@ -1877,16 +1877,54 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); $rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) { - self.askPassword = { - isSetup: isSetup, - callback: function(err, pass) { - self.askPassword = null; - return cb(err, pass); - }, + + function openPasswordPopup(isSetup, cb) { + $scope.data = {}; + $scope.data.password = null; + $scope.isSetup = isSetup; + $scope.isVerification = false; + $scope.loading = false; + var pass = null; + + self.passwordPopup = $ionicPopup.show({ + templateUrl: 'views/includes/password.html', + scope: $scope, + }); + + $scope.cancel = function() { + return cb('No spending password given'); + }; + + $scope.set = function() { + $scope.loading = true; + $scope.error = null; + + $timeout(function() { + if (isSetup && !$scope.isVerification) { + $scope.loading = false; + $scope.isVerification = true; + pass = $scope.data.password; + $scope.data.password = null; + return; + } + if (isSetup && pass != $scope.data.password) { + $scope.loading = false; + $scope.error = gettext('Spending Passwords do not match'); + $scope.isVerification = false; + $scope.data.password = null; + pass = null; + return; + } + return cb(null, $scope.data.password); + }, 100); + }; }; - $timeout(function() { - $rootScope.$apply(); + + openPasswordPopup(isSetup, function(err, pass) { + self.passwordPopup.close(); + return cb(err, pass); }); + }); lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) { diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index ba007c002..2ebbe4ace 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -34,7 +34,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio var commentPopup = $ionicPopup.show({ templateUrl: "views/includes/note.html", - title: !$scope.comment ? gettextCatalog.getString('Enter a new comment') : gettextCatalog.getString('Edit comment'), scope: $scope, }); diff --git a/src/js/controllers/password.js b/src/js/controllers/password.js deleted file mode 100644 index 4adc100cf..000000000 --- a/src/js/controllers/password.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('passwordController', - function($rootScope, $scope, $timeout, profileService, notification, go, gettext) { - - var pass1; - - this.isVerification = false; - - document.getElementById("passwordInput").focus(); - - this.close = function(cb) { - return cb('No spending password given'); - }; - - this.set = function(isSetup, cb) { - this.loading = true; - this.error = false; - - var self = this; - - $timeout(function() { - if (isSetup && !self.isVerification) { - self.loading = false; - document.getElementById("passwordInput").focus(); - self.isVerification = true; - pass1 = $scope.password; - $scope.password = null; - return; - } - if (isSetup && pass1 != $scope.password) { - self.loading = false; - self.error = gettext('Spending Passwords do not match'); - self.isVerification = false; - $scope.password = null; - pass1 = null; - return; - } - return cb(null, $scope.password); - }, 100); - }; - - });