added new logic to external link service to open in system browser with confirm message to notify them they're leaving and give option to cancel

This commit is contained in:
Jamal Jackson 2016-10-12 08:57:08 -04:00
commit f808a3afcd
15 changed files with 47 additions and 44 deletions

View file

@ -1,13 +1,17 @@
'use strict';
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService) {
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog) {
this.open = function(url, target) {
this.open = function(url, desc) {
if (platformInfo.isNW) {
nodeWebkitService.openExternalLink(url);
} else {
target = target || '_blank';
var ref = window.open(url, target, 'location=no');
desc = desc || 'this link';
var message = gettextCatalog.getString('You are leaving to view ' + desc + ''),
openBrowser = function(res) {
if (res) window.open(url, '_system');
};
popupService.showConfirm('Opening Browser', message, 'Open', 'Cancel', openBrowser);
}
};