Touchid before Unlock on iOS

This commit is contained in:
Gustavo Maximiliano Cortez 2016-01-20 15:25:54 -03:00
commit 0a5c32b9f3
4 changed files with 97 additions and 95 deletions

View file

@ -170,12 +170,12 @@
</ul> </ul>
</div> </div>
<div class="columns text-center m20t" ng-if="tx.canBeRemoved"> <div class="columns text-center m20t" ng-if="tx.canBeRemoved || (tx.status == 'accepted' && !tx.broadcastedOn)">
<div class="text-gray size-12 m20b" ng-if="!tx.isGlidera && isShared" translate> <div class="text-gray size-12 m20b" ng-show="!tx.isGlidera && isShared" translate>
* A payment proposal can be deleted if 1) you are the creator, and no other copayer has signed, or 2) 24 hours have passed since the proposal was created. * A payment proposal can be deleted if 1) you are the creator, and no other copayer has signed, or 2) 24 hours have passed since the proposal was created.
</div> </div>
<button class="tiny round outline dark-gray warning" ng-click="remove(tx)" <button class="tiny round outline dark-gray warning" ng-click="remove(tx)"
ng-disabled="loading" ng-show="tx.canBeRemoved"> ng-disabled="loading">
<i class="fi-trash size-14 m5r"></i> <i class="fi-trash size-14 m5r"></i>
<span translate>Delete Payment Proposal</span> <span translate>Delete Payment Proposal</span>
</button> </button>

View file

@ -1485,6 +1485,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
return cb(err, pass); return cb(err, pass);
}, },
}; };
$timeout(function() {
$rootScope.$apply();
});
}); });
lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) { lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {

View file

@ -335,35 +335,35 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.sign = function(txp) { $scope.sign = function(txp) {
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
$scope.error = null;
if (!fc.canSign() && !fc.isPrivKeyExternal()) if (!fc.canSign() && !fc.isPrivKeyExternal())
return; return;
if (fc.isPrivKeyEncrypted()) {
profileService.unlockFC(function(err) {
if (err) {
$scope.error = bwsError.msg(err);
return;
}
return $scope.sign(txp);
});
return;
};
self._setOngoingForSigning();
$scope.loading = true; $scope.loading = true;
$scope.error = null;
$timeout(function() { $timeout(function() {
requestTouchid(function(err) { requestTouchid(function(err) {
if (err) { if (err) {
self.setOngoingProcess();
$scope.loading = false; $scope.loading = false;
profileService.lockFC();
$scope.error = err; $scope.error = err;
$timeout(function() {
$scope.$digest(); $scope.$digest();
});
return; return;
} }
profileService.unlockFC(function(err) {
if (err) {
$scope.loading = false;
$scope.error = bwsError.msg(err);
$timeout(function() {
$scope.$digest();
});
return;
}
self._setOngoingForSigning();
profileService.signTxProposal(txp, function(err, txpsi) { profileService.signTxProposal(txp, function(err, txpsi) {
self.setOngoingProcess(); self.setOngoingProcess();
if (err) { if (err) {
@ -400,6 +400,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
} }
}); });
}); });
});
}, 100); }, 100);
}; };
@ -833,6 +834,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
var currentSpendUnconfirmed = configWallet.spendUnconfirmed; var currentSpendUnconfirmed = configWallet.spendUnconfirmed;
var currentFeeLevel = walletSettings.feeLevel || 'normal'; var currentFeeLevel = walletSettings.feeLevel || 'normal';
this.resetError();
if (isCordova && this.isWindowsPhoneApp) { if (isCordova && this.isWindowsPhoneApp) {
this.hideAddress = false; this.hideAddress = false;
this.hideAmount = false; this.hideAmount = false;
@ -844,14 +847,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
return; return;
} }
if (fc.isPrivKeyEncrypted()) {
profileService.unlockFC(function(err) {
if (err) return self.setSendError(err);
return self.submitForm();
});
return;
};
var comment = form.comment.$modelValue; var comment = form.comment.$modelValue;
// ToDo: use a credential's (or fc's) function for this // ToDo: use a credential's (or fc's) function for this
@ -869,7 +864,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
} }
}; };
self.setOngoingProcess(gettextCatalog.getString('Creating transaction'));
$timeout(function() { $timeout(function() {
var paypro = self._paypro; var paypro = self._paypro;
var address, amount; var address, amount;
@ -879,8 +873,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
requestTouchid(function(err) { requestTouchid(function(err) {
if (err) { if (err) {
profileService.lockFC();
self.setOngoingProcess();
self.error = err; self.error = err;
$timeout(function() { $timeout(function() {
$scope.$digest(); $scope.$digest();
@ -888,6 +880,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
return; return;
} }
profileService.unlockFC(function(err) {
if (err) {
return self.setSendError(err);
}
self.setOngoingProcess(gettextCatalog.getString('Creating transaction'));
getFee(function(err, feePerKb) { getFee(function(err, feePerKb) {
if (err) $log.debug(err); if (err) $log.debug(err);
fc.sendTxProposal({ fc.sendTxProposal({
@ -900,7 +898,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
}, function(err, txp) { }, function(err, txp) {
if (err) { if (err) {
self.setOngoingProcess(); self.setOngoingProcess();
profileService.lockFC();
return self.setSendError(err); return self.setSendError(err);
} }
@ -928,6 +925,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
}); });
}); });
}); });
});
}, 100); }, 100);
}; };

View file

@ -630,6 +630,7 @@ angular.module('copayApp.services')
root.unlockFC = function(cb) { root.unlockFC = function(cb) {
var fc = root.focusedClient; var fc = root.focusedClient;
if (!fc.isPrivKeyEncrypted()) return cb();
$log.debug('Wallet is encrypted'); $log.debug('Wallet is encrypted');
$rootScope.$emit('Local/NeedsPassword', false, function(err2, password) { $rootScope.$emit('Local/NeedsPassword', false, function(err2, password) {
if (err2 || !password) { if (err2 || !password) {