Touchid before Unlock on iOS
This commit is contained in:
parent
8e65298ff9
commit
0a5c32b9f3
4 changed files with 97 additions and 95 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -335,69 +335,70 @@ 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;
|
||||||
$scope.$digest();
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
profileService.signTxProposal(txp, function(err, txpsi) {
|
profileService.unlockFC(function(err) {
|
||||||
self.setOngoingProcess();
|
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.$emit('UpdateTx');
|
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not accept payment'));
|
$scope.error = bwsError.msg(err);
|
||||||
$scope.$digest();
|
$timeout(function() {
|
||||||
} else {
|
$scope.$digest();
|
||||||
//if txp has required signatures then broadcast it
|
});
|
||||||
var txpHasRequiredSignatures = txpsi.status == 'accepted';
|
return;
|
||||||
if (txpHasRequiredSignatures) {
|
|
||||||
self.setOngoingProcess(gettextCatalog.getString('Broadcasting transaction'));
|
|
||||||
$scope.loading = true;
|
|
||||||
fc.broadcastTxProposal(txpsi, function(err, txpsb, memo) {
|
|
||||||
self.setOngoingProcess();
|
|
||||||
$scope.loading = false;
|
|
||||||
if (err) {
|
|
||||||
$scope.$emit('UpdateTx');
|
|
||||||
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not broadcast payment'));
|
|
||||||
$scope.$digest();
|
|
||||||
} else {
|
|
||||||
$log.debug('Transaction signed and broadcasted')
|
|
||||||
if (memo)
|
|
||||||
$log.info(memo);
|
|
||||||
|
|
||||||
refreshUntilItChanges = true;
|
|
||||||
$modalInstance.close(txpsb);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$scope.loading = false;
|
|
||||||
$modalInstance.close(txpsi);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self._setOngoingForSigning();
|
||||||
|
profileService.signTxProposal(txp, function(err, txpsi) {
|
||||||
|
self.setOngoingProcess();
|
||||||
|
if (err) {
|
||||||
|
$scope.$emit('UpdateTx');
|
||||||
|
$scope.loading = false;
|
||||||
|
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not accept payment'));
|
||||||
|
$scope.$digest();
|
||||||
|
} else {
|
||||||
|
//if txp has required signatures then broadcast it
|
||||||
|
var txpHasRequiredSignatures = txpsi.status == 'accepted';
|
||||||
|
if (txpHasRequiredSignatures) {
|
||||||
|
self.setOngoingProcess(gettextCatalog.getString('Broadcasting transaction'));
|
||||||
|
$scope.loading = true;
|
||||||
|
fc.broadcastTxProposal(txpsi, function(err, txpsb, memo) {
|
||||||
|
self.setOngoingProcess();
|
||||||
|
$scope.loading = false;
|
||||||
|
if (err) {
|
||||||
|
$scope.$emit('UpdateTx');
|
||||||
|
$scope.error = bwsError.msg(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||||
|
$scope.$digest();
|
||||||
|
} else {
|
||||||
|
$log.debug('Transaction signed and broadcasted')
|
||||||
|
if (memo)
|
||||||
|
$log.info(memo);
|
||||||
|
|
||||||
|
refreshUntilItChanges = true;
|
||||||
|
$modalInstance.close(txpsb);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$scope.loading = false;
|
||||||
|
$modalInstance.close(txpsi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, 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;
|
||||||
|
|
@ -842,15 +845,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
if (form.$invalid) {
|
if (form.$invalid) {
|
||||||
this.error = gettext('Unable to send transaction proposal');
|
this.error = gettext('Unable to send transaction proposal');
|
||||||
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;
|
||||||
|
|
||||||
|
|
@ -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,42 +880,48 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFee(function(err, feePerKb) {
|
profileService.unlockFC(function(err) {
|
||||||
if (err) $log.debug(err);
|
if (err) {
|
||||||
fc.sendTxProposal({
|
return self.setSendError(err);
|
||||||
toAddress: address,
|
}
|
||||||
amount: amount,
|
|
||||||
message: comment,
|
self.setOngoingProcess(gettextCatalog.getString('Creating transaction'));
|
||||||
payProUrl: paypro ? paypro.url : null,
|
getFee(function(err, feePerKb) {
|
||||||
feePerKb: feePerKb,
|
if (err) $log.debug(err);
|
||||||
excludeUnconfirmedUtxos: currentSpendUnconfirmed ? false : true
|
fc.sendTxProposal({
|
||||||
}, function(err, txp) {
|
toAddress: address,
|
||||||
if (err) {
|
amount: amount,
|
||||||
self.setOngoingProcess();
|
message: comment,
|
||||||
profileService.lockFC();
|
payProUrl: paypro ? paypro.url : null,
|
||||||
return self.setSendError(err);
|
feePerKb: feePerKb,
|
||||||
}
|
excludeUnconfirmedUtxos: currentSpendUnconfirmed ? false : true
|
||||||
|
}, function(err, txp) {
|
||||||
if (!fc.canSign() && !fc.isPrivKeyExternal()) {
|
|
||||||
$log.info('No signing proposal: No private key')
|
|
||||||
self.setOngoingProcess();
|
|
||||||
self.resetForm();
|
|
||||||
txStatus.notify(txp, function() {
|
|
||||||
return $scope.$emit('Local/TxProposalAction');
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.signAndBroadcast(txp, function(err) {
|
|
||||||
self.setOngoingProcess();
|
|
||||||
self.resetForm();
|
|
||||||
if (err) {
|
if (err) {
|
||||||
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
|
self.setOngoingProcess();
|
||||||
$scope.$emit('Local/TxProposalAction');
|
return self.setSendError(err);
|
||||||
$timeout(function() {
|
}
|
||||||
$scope.$digest();
|
|
||||||
}, 1);
|
if (!fc.canSign() && !fc.isPrivKeyExternal()) {
|
||||||
} else go.walletHome();
|
$log.info('No signing proposal: No private key')
|
||||||
|
self.setOngoingProcess();
|
||||||
|
self.resetForm();
|
||||||
|
txStatus.notify(txp, function() {
|
||||||
|
return $scope.$emit('Local/TxProposalAction');
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.signAndBroadcast(txp, function(err) {
|
||||||
|
self.setOngoingProcess();
|
||||||
|
self.resetForm();
|
||||||
|
if (err) {
|
||||||
|
self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen');
|
||||||
|
$scope.$emit('Local/TxProposalAction');
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
}, 1);
|
||||||
|
} else go.walletHome();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue