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

@ -27,7 +27,6 @@
<ion-side-menu-content>
<div notifications="right top"></div>
<div ng-include="'views/includes/password.html'" ng-if="index.askPassword"></div>
<div ng-include="'views/includes/alert.html'" ng-if="index.showAlert"></div>
<div ng-include="'views/includes/confirm-tx.html'" ng-if="index.confirmTx"></div>
<div id="sectionContainer">

View file

@ -1,4 +1,10 @@
<input type="text" ng-model="data.comment" autofocus>
<div class="columns m20t">
<label class="size-14 text-center">
<span ng-show="!comment" translate>Enter a new comment</span>
<span ng-show="comment" translate>Edit comment</span>
</label>
<input type="text" ng-model="data.comment">
</div>
<div class="small-6 columns">
<button class="round outline dark-gray expand" ng-click="commentPopupClose()" translate>CANCEL</button>
</div>

View file

@ -1,49 +1,42 @@
<div class="modalMask">
</div>
<div ng-controller="passwordController as pass" class="passModal"
ng-class="{'animated bounceInDown':index.askPassword}"
>
<div class="columns m20t">
<label class="size-14 text-center" for="password" ng-if="index.askPassword.isSetup">
<span ng-show="!pass.isVerification" translate>Set up a spending password</span>
<span ng-show="pass.isVerification" translate>Repeat the spending password</span>
<label class="size-14 text-center" for="password" ng-if="isSetup">
<span ng-show="!isVerification" translate>Set up a spending password</span>
<span ng-show="isVerification" translate>Repeat the spending password</span>
</label>
<label class="size-14 text-center" for="password" ng-if="!index.askPassword.isSetup">
<label class="size-14 text-center" for="password" ng-if="!isSetup">
<span translate>Enter your spending password</span>
</label>
<div class="input m20t">
<input type="password" placeholder="{{'Your spending password'|translate}}"
id="passwordInput" name="password" ng-model="password">
id="passwordInput" name="password" ng-model="data.password">
</div>
</div>
<div class="row">
<div class="small-6 columns">
<button
class="round small-6 columns outline dark-gray expand"
ng-click="pass.close(index.askPassword.callback)"
ng-disabled="pass.loading" translate>
ng-click="cancel()"
ng-disabled="loading" translate>
CANCEL
</button>
</div>
<div class="small-6 columns">
<button class="round expand"
ng-click="pass.set(index.askPassword.isSetup, index.askPassword.callback)"
ng-disabled="!password || pass.loading"
ng-click="set()"
ng-disabled="!data.password || loading"
ng-style="{'background-color':index.backgroundColor}">
<span ng-if="index.askPassword.isSetup" translate>SET</span>
<span ng-if="!index.askPassword.isSetup">OK</span>
<span ng-if="isSetup" translate>SET</span>
<span ng-if="!isSetup">OK</span>
</button>
</div>
</div>
<p class="text-warning size-12 columns m20t text-center" ng-show="index.askPassword.isSetup">
<p class="text-warning size-12 columns m20t text-center" ng-show="isSetup">
<i class="fi-alert"></i>
<span translate ng-show="!pass.error"> Your wallet key will be encrypted. The Spending Password cannot be recovered. Be sure to write it down</span>
<span ng-show="!error" translate> Your wallet key will be encrypted. The Spending Password cannot be recovered. Be sure to write it down</span>
<span ng-show="pass.error">{{pass.error|translate}}</span>
<span ng-show="error" translate>{{error}}</span>
</p>
</div>

View file

@ -28,6 +28,10 @@
width: 300px;
}
.popup-head {
display: none;
}
.bct {
background-color: transparent !important;
margin-top: -25px;

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