Removes function showAlert
This commit is contained in:
parent
92bb8e01bc
commit
50fdeff138
2 changed files with 13 additions and 42 deletions
|
|
@ -1,24 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, $ionicNavBarDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, $ionicPopup, txStatus, gettext, txFormatService, ongoingProcess, $ionicModal) {
|
||||
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, $ionicNavBarDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, $ionicPopup, txStatus, gettext, txFormatService, ongoingProcess, $ionicModal, popupService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Confirm'));
|
||||
var cachedTxp = {};
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
|
||||
// An alert dialog
|
||||
var showAlert = function(title, msg, cb) {
|
||||
var message = msg.message ? msg.message : msg;
|
||||
$log.warn(title + ": " + message);
|
||||
|
||||
var alertPopup = $ionicPopup.alert({
|
||||
title: title,
|
||||
template: message
|
||||
});
|
||||
|
||||
if (!cb) cb = function() {};
|
||||
alertPopup.then(cb);
|
||||
};
|
||||
|
||||
$scope.showDescriptionPopup = function() {
|
||||
var commentPopup = $ionicPopup.show({
|
||||
templateUrl: "views/includes/note.html",
|
||||
|
|
@ -52,7 +38,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
if (!wallet) return cb();
|
||||
|
||||
if (isChromeApp) {
|
||||
showAlert(gettext('Payment Protocol not supported on Chrome App'));
|
||||
popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
|
||||
return cb(true);
|
||||
}
|
||||
|
||||
|
|
@ -69,15 +55,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$log.warn('Could not fetch payment request:', err);
|
||||
var msg = err.toString();
|
||||
if (msg.match('HTTP')) {
|
||||
msg = gettext('Could not fetch payment information');
|
||||
msg = gettextCatalog.getString('Could not fetch payment information');
|
||||
}
|
||||
showAlert(msg);
|
||||
popupService.showAlert(msg);
|
||||
return cb(true);
|
||||
}
|
||||
|
||||
if (!paypro.verified) {
|
||||
$log.warn('Failed to verify payment protocol signatures');
|
||||
showAlert(gettext('Payment Protocol Invalid'));
|
||||
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
|
||||
return cb(true);
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +175,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
};
|
||||
|
||||
var setSendError = function(msg) {
|
||||
showAlert(gettext('Error at confirm:'), msg);
|
||||
popupService.showAlert(gettextCatalog.getString('Error at confirm:'), msg);
|
||||
};
|
||||
|
||||
function apply(txp) {
|
||||
|
|
@ -212,13 +198,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
if (description && !wallet.credentials.sharedEncryptingKey) {
|
||||
var msg = 'Could not add message to imported wallet without shared encrypting key';
|
||||
$log.warn(msg);
|
||||
return setSendError(gettext(msg));
|
||||
return setSendError(msg);
|
||||
}
|
||||
|
||||
if (toAmount > Number.MAX_SAFE_INTEGER) {
|
||||
var msg = 'Amount too big';
|
||||
$log.warn(msg);
|
||||
return setSendError(gettext(msg));
|
||||
return setSendError(msg);
|
||||
};
|
||||
|
||||
outputs.push({
|
||||
|
|
@ -263,13 +249,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
var wallet = $scope.wallet;
|
||||
var txp = $scope.txp;
|
||||
if (!wallet) {
|
||||
return setSendError(gettext('No wallet selected'));
|
||||
return;
|
||||
return setSendError(gettextCatalog.getString('No wallet selected'));
|
||||
};
|
||||
|
||||
if (!txp) {
|
||||
return setSendError(gettext('No transaction'));
|
||||
return;
|
||||
return setSendError(gettextCatalog.getString('No transaction'));
|
||||
};
|
||||
|
||||
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressbookModalController', function($scope, $log, $state, $timeout, $ionicPopup, addressbookService, lodash) {
|
||||
angular.module('copayApp.controllers').controller('addressbookModalController', function($scope, $log, $state, $timeout, $ionicPopup, addressbookService, lodash, popupService) {
|
||||
|
||||
var contacts;
|
||||
|
||||
// An alert dialog
|
||||
var showAlert = function(title, msg, cb) {
|
||||
$log.warn(title + ": " + msg);
|
||||
var alertPopup = $ionicPopup.alert({
|
||||
title: title,
|
||||
template: msg
|
||||
});
|
||||
|
||||
if (!cb) cb = function() {};
|
||||
|
||||
alertPopup.then(cb);
|
||||
};
|
||||
|
||||
$scope.initAddressbook = function() {
|
||||
addressbookService.list(function(err, ab) {
|
||||
if (err) $log.error(err);
|
||||
|
|
@ -94,7 +81,7 @@ angular.module('copayApp.controllers').controller('addressbookModalController',
|
|||
$timeout(function() {
|
||||
addressbookService.add(addressbook, function(err, ab) {
|
||||
if (err) {
|
||||
showAlert(err);
|
||||
popupService.showAlert(err);
|
||||
return;
|
||||
}
|
||||
$scope.initAddressbook();
|
||||
|
|
@ -108,7 +95,7 @@ angular.module('copayApp.controllers').controller('addressbookModalController',
|
|||
$timeout(function() {
|
||||
addressbookService.remove(addr, function(err, ab) {
|
||||
if (err) {
|
||||
showAlert(err);
|
||||
popupService.showAlert(err);
|
||||
return;
|
||||
}
|
||||
$scope.initAddressbook();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue