fix alert messages

This commit is contained in:
Gabriel Bazán 2016-10-26 17:10:21 -03:00
commit f6806fcdf3
11 changed files with 38 additions and 33 deletions

View file

@ -39,7 +39,7 @@ angular.module('copayApp.controllers').controller('activityController',
ongoingProcess.set('loadingTxInfo', false);
if (err) {
$log.warn('No txp found');
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found'));
}
txpModalService.open(_txp);
});
@ -61,7 +61,7 @@ angular.module('copayApp.controllers').controller('activityController',
if (!tx) {
$log.warn('No tx found');
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found'));
}
$scope.wallet = wallet;

View file

@ -47,7 +47,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
$timeout(function() {
addressbookService.remove(addr, function(err, ab) {
if (err) {
popupService.showAlert(err);
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
initAddressbook();
@ -56,7 +56,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
}, 100);
};
$scope.$on("$ionicView.beforeEnter", function(event, data){
$scope.$on("$ionicView.beforeEnter", function(event, data) {
initAddressbook();
});

View file

@ -27,7 +27,7 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
$timeout(function() {
addressbookService.add(addressbook, function(err, ab) {
if (err) {
popupService.showAlert(err);
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
if ($scope.fromSendTab) $scope.goHome();

View file

@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('amazonController',
var initAmazon = function() {
amazonService.getPendingGiftCards(function(err, gcds) {
if (err) {
popupService.showAlert(err);
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.giftCards = lodash.isEmpty(gcds) ? null : gcds;
@ -31,7 +31,7 @@ angular.module('copayApp.controllers').controller('amazonController',
$log.debug("creating gift card");
amazonService.createGiftCard(dataFromStorage, function(err, giftCard) {
if (err) {
popupService.showAlert(bwcError.msg(err));
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
if (giftCard.status != 'PENDING') {
@ -51,7 +51,7 @@ angular.module('copayApp.controllers').controller('amazonController',
$log.debug("Saving new gift card");
amazonService.getPendingGiftCards(function(err, gcds) {
if (err) {
popupService.showAlert(err);
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.giftCards = gcds;

View file

@ -4,12 +4,14 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
var self = this;
var runningBalance;
$scope.dateRange = { value: 'last30Days'};
$scope.dateRange = {
value: 'last30Days'
};
$scope.network = bitpayCardService.getEnvironment();
var updateHistoryFromCache = function(cb) {
bitpayCardService.getBitpayDebitCardsHistory($scope.cardId, function(err, data) {
if (err || lodash.isEmpty(data)) return cb();
if (err ||  lodash.isEmpty(data)) return cb();
$scope.historyCached = true;
self.bitpayCardTransactionHistory = data.transactions;
self.bitpayCardCurrentBalance = data.balance;
@ -19,8 +21,8 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
var setDateRange = function(preset) {
var startDate, endDate;
preset = preset || 'last30Days';
switch(preset) {
preset = preset ||  'last30Days';
switch (preset) {
case 'last30Days':
startDate = moment().subtract(30, 'days').toISOString();
endDate = moment().toISOString();
@ -138,7 +140,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
disableAnimate: true
});
$state.go('tabs.home');
popupService.showAlert(null, msg);
popupService.showAlert(gettextCatalog.getString('Error'), msg);
} else {
updateHistoryFromCache(function() {
self.update();
@ -147,4 +149,3 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
});
});

View file

@ -24,11 +24,13 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
obj.otp = otp;
bitpayCardService.bitAuthPair(obj, function(err, data) {
if (err) {
popupService.showAlert(null, err);
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
var title = gettextCatalog.getString('Add BitPay Card Account?');
var msg = gettextCatalog.getString('Would you like to add this account ({{email}}) to your wallet?', {email: obj.email});
var msg = gettextCatalog.getString('Would you like to add this account ({{email}}) to your wallet?', {
email: obj.email
});
var ok = gettextCatalog.getString('Add Account');
var cancel = gettextCatalog.getString('Go back');
popupService.showConfirm(title, msg, ok, cancel, function(res) {
@ -43,7 +45,9 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
});
$state.go('tabs.home').then(function() {
if (data.cards[0]) {
$state.transitionTo('tabs.bitpayCard', {id: data.cards[0].id});
$state.transitionTo('tabs.bitpayCard', {
id: data.cards[0].id
});
}
});
});

View file

@ -28,7 +28,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if ($scope.paypro) {
return setFromPayPro($scope.paypro, function(err) {
if (err && !isChromeApp) {
popupService.showAlert(gettext('Could not fetch payment'));
popupService.showAlert(gettextCatalog.getString('Error'), gettext('Could not fetch payment'));
}
});
}
@ -159,7 +159,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (!wallet) return cb();
if (isChromeApp) {
popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
return cb(true);
}
@ -178,13 +178,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (msg.match('HTTP')) {
msg = gettextCatalog.getString('Could not fetch payment information');
}
popupService.showAlert(msg);
popupService.showAlert(gettextCatalog.getString('Error'), msg);
return cb(true);
}
if (!paypro.verified) {
$log.warn('Failed to verify payment protocol signatures');
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Payment Protocol Invalid'));
return cb(true);
}
@ -338,7 +338,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.approve = function(onSendStatusChange) {
if ($scope._paypro && $scope.paymentExpired.value) {
popupService.showAlert(null, gettextCatalog.getString('The payment request has expired'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('The payment request has expired'));
$scope.sendStatus = '';
$timeout(function() {
$scope.$apply();

View file

@ -60,7 +60,7 @@ angular.module('copayApp.controllers').controller('importController',
};
if (info.type == 1 && info.hasPassphrase)
popupService.showAlert(gettextCatalog.getString('Password required. Make sure to enter your password in advanced options'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Password required. Make sure to enter your password in advanced options'));
$scope.formData.derivationPath = info.derivationPath;
$scope.formData.testnetEnabled = info.network == 'testnet' ? true : false;
@ -236,7 +236,7 @@ angular.module('copayApp.controllers').controller('importController',
var words = $scope.formData.words || null;
if (!words) {
popupService.showAlert(gettextCatalog.getString('Please enter the recovery phrase'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the recovery phrase'));
} else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) {
return _importExtendedPrivateKey(words, opts);
} else if (words.indexOf('xpub') == 0 || words.indexOf('tpuv') == 0) {
@ -245,7 +245,7 @@ angular.module('copayApp.controllers').controller('importController',
var wordList = words.split(/[\u3000\s]+/);
if ((wordList.length % 3) != 0) {
popupService.showAlert(gettextCatalog.getString('Wrong number of recovery words:') + wordList.length);
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Wrong number of recovery words: ') + wordList.length);
return;
}
}
@ -280,7 +280,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.importHW = function(form) {
if (form.$invalid || $scope.formData.ccount < 0) {
popupService.showAlert(gettextCatalog.getString('There is an error in the form'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('There is an error in the form'));
return;
}
@ -290,7 +290,7 @@ angular.module('copayApp.controllers').controller('importController',
if ($scope.seedSource.id == 'trezor') {
if (account < 1) {
popupService.showAlert(gettextCatalog.getString('Invalid account number'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return;
}
account = account - 1;

View file

@ -41,7 +41,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
ongoingProcess.set('loadingTxInfo', false);
if (err) {
$log.warn('No txp found');
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found'));
}
txpModalService.open(_txp);
});
@ -63,7 +63,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
if (!tx) {
$log.warn('No tx found');
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Transaction not found'));
}
$scope.wallet = wallet;

View file

@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('tabsController', function($ro
$scope.onScan = function(data) {
if (!incomingData.redir(data)) {
popupService.showAlert(null, gettextCatalog.getString('Invalid data'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid data'));
}
};
@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('tabsController', function($ro
}, 1);
};
$scope.$on("$ionicView.beforeEnter", function(event, data){
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$rootScope.hideTabs = '';
});

View file

@ -83,11 +83,11 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
wallet.notAuthorized = true;
$state.go('tabs.home');
} else if (err instanceof errors.NOT_FOUND) {
popupService.showAlert(gettextCatalog.getString('Could not access Wallet Service: Not found'));
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not access Wallet Service: Not found'));
} else {
var msg = ""
$rootScope.$emit('Local/ClientError', (err.error ? err.error : err));
popupService.showAlert(bwcError.msg(err, gettextCatalog.getString('Error at Wallet Service')));
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, gettextCatalog.getString('Error at Wallet Service')));
}
};
root.handleError = lodash.debounce(_handleError, 1000);