adding ionic pop up to password request and delete popup header

This commit is contained in:
Gabriel Bazán 2016-06-03 11:30:04 -03:00 committed by Javier
commit 1118183eca
7 changed files with 72 additions and 76 deletions

View file

@ -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) {

View file

@ -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,
});

View file

@ -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);
};
});