skip confirm dialog on chromeapp

Signed-off-by: Matias Alejo Garcia <ematiu@gmail.com>
This commit is contained in:
Matias Alejo Garcia 2015-06-28 11:03:28 -03:00
commit 653ce433e1

View file

@ -129,16 +129,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
}; };
$scope.selectWallet = function(walletId, walletName) { $scope.selectWallet = function(walletId, walletName) {
$scope.gettingAddress=true; $scope.gettingAddress = true;
$scope.selectedWalletName=walletName; $scope.selectedWalletName = walletName;
$timeout(function(){ $timeout(function() {
$scope.$apply(); $scope.$apply();
}); });
addressService.getAddress(walletId, false, function(err,addr) { addressService.getAddress(walletId, false, function(err, addr) {
$scope.gettingAddress=false; $scope.gettingAddress = false;
if (!err || addr) if (!err || addr)
$modalInstance.close(addr); $modalInstance.close(addr);
else { else {
parseError(err); parseError(err);
self.error = err; self.error = err;
$modalInstance.dismiss('cancel'); $modalInstance.dismiss('cancel');
@ -392,7 +392,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.generatingAddress = true; self.generatingAddress = true;
$timeout(function() { $timeout(function() {
addressService.getAddress(fc.credentials.walletId, forceNew, function(err,addr){ addressService.getAddress(fc.credentials.walletId, forceNew, function(err, addr) {
self.generatingAddress = false; self.generatingAddress = false;
if (err) { if (err) {
@ -1022,25 +1022,38 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
this.setForm(null, amount); this.setForm(null, amount);
}; };
this.confirmDialog = function(msg, cb) {
if (isCordova) {
navigator.notification.confirm(
msg,
function(buttonIndex) {
if (buttonIndex == 1) {
$timeout(function() {
return cb(true);
}, 1);
} else {
return cb(false);
}
}
);
} else if (isChromeApp) {
// No feedback, alert/confirm not supported.
return cb(true);
} else {
return cb(confirm(msg));
}
};
this.sendAll = function(amount, feeStr) { this.sendAll = function(amount, feeStr) {
var self = this; var self = this;
var msg = gettextCatalog.getString("{{fee}} will be discounted for bitcoin networking fees", { var msg = gettextCatalog.getString("{{fee}} will be discounted for bitcoin networking fees", {
fee: feeStr fee: feeStr
}); });
if (isCordova) {
navigator.notification.confirm( this.confirmDialog(msg, function(confirmed){
msg, if (confirmed)
function(buttonIndex) { self._doSendAll(amount);
if (buttonIndex == 1) });
$timeout(function() {
self._doSendAll(amount);
}, 1);
}
);
} else {
if (confirm(msg))
this._doSendAll(amount);
}
} }
/* Start setup */ /* Start setup */