Merge pull request #6338 from gabrielbazan7/fix/defaultTitle

avoid default title and fixes for buttons translations
This commit is contained in:
Gustavo Maximiliano Cortez 2017-06-30 16:04:34 -03:00 committed by GitHub
commit 2626f675ff
1 changed files with 14 additions and 8 deletions

View File

@ -7,13 +7,13 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
/*************** Ionic ****************/
var _ionicAlert = function(title, message, cb, buttonName) {
var _ionicAlert = function(title, message, cb, okText) {
if (!cb) cb = function() {};
$ionicPopup.alert({
title: title,
subTitle: message,
okType: 'button-clear button-positive',
okText: buttonName || gettextCatalog.getString('OK'),
okText: okText || gettextCatalog.getString('OK'),
}).then(cb);
};
@ -46,9 +46,11 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
/*************** Cordova ****************/
var _cordovaAlert = function(title, message, cb, buttonName) {
var _cordovaAlert = function(title, message, cb, okText) {
if (!cb) cb = function() {};
navigator.notification.alert(message, cb, title, buttonName);
title = title ? title : '';
okText = okText || gettextCatalog.getString('OK');
navigator.notification.alert(message, cb, title, okText);
};
var _cordovaConfirm = function(title, message, okText, cancelText, cb) {
@ -58,6 +60,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
}
okText = okText || gettextCatalog.getString('OK');
cancelText = cancelText || gettextCatalog.getString('Cancel');
title = title ? title : '';
navigator.notification.confirm(message, onConfirm, title, [cancelText, okText]);
};
@ -66,7 +69,10 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
if (results.buttonIndex == 1) return cb(results.input1);
else return cb();
}
navigator.notification.prompt(message, onPrompt, title, null, opts.defaultText);
var okText = gettextCatalog.getString('OK');
var cancelText = gettextCatalog.getString('Cancel');
title = title ? title : '';
navigator.notification.prompt(message, onPrompt, title, [cancelText, okText], opts.defaultText);
};
/**
@ -77,14 +83,14 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
* @param {Callback} Function (optional)
*/
this.showAlert = function(title, msg, cb, buttonName) {
this.showAlert = function(title, msg, cb, okText) {
var message = (msg && msg.message) ? msg.message : msg;
$log.warn(title ? (title + ': ' + message) : message);
if (isCordova)
_cordovaAlert(title, message, cb, buttonName);
_cordovaAlert(title, message, cb, okText);
else
_ionicAlert(title, message, cb, buttonName);
_ionicAlert(title, message, cb, okText);
};
/**