2016-09-05 14:59:11 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2016-10-12 08:57:08 -04:00
|
|
|
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog) {
|
2016-09-05 14:59:11 -03:00
|
|
|
|
2016-10-12 08:57:08 -04:00
|
|
|
this.open = function(url, desc) {
|
2016-09-05 14:59:11 -03:00
|
|
|
if (platformInfo.isNW) {
|
|
|
|
|
nodeWebkitService.openExternalLink(url);
|
|
|
|
|
} else {
|
2016-10-12 08:57:08 -04:00
|
|
|
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);
|
2016-09-05 14:59:11 -03:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|