Merge pull request #397 from jamal-jackson/feature/external_link_open_system_browser
open external link in system browser
This commit is contained in:
commit
f29d3137cc
21 changed files with 64 additions and 51 deletions
|
|
@ -5,8 +5,8 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
|
||||
$scope.network = amazonService.getEnvironment();
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
var initAmazon = function() {
|
||||
|
|
@ -83,7 +83,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
initAmazon();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
$log.debug('Wallet changed: ' + w.name);
|
||||
});
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
this.confirm = function() {
|
||||
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {amount: $scope.formData.fiat});
|
||||
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {
|
||||
amount: $scope.formData.fiat
|
||||
});
|
||||
var ok = gettextCatalog.getString('Buy');
|
||||
popupService.showConfirm(null, message, ok, null, function(res) {
|
||||
if (res) self.createTx();
|
||||
|
|
@ -209,8 +211,10 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.formData = { fiat: null };
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$scope.formData = {
|
||||
fiat: null
|
||||
};
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: network,
|
||||
onlyComplete: true
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
var initGlidera = function(accessToken) {
|
||||
|
|
@ -27,7 +27,9 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({fullUpdate: true});
|
||||
$scope.update({
|
||||
fullUpdate: true
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -113,7 +115,7 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
initGlidera();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, bwcError, amazonService, lodash, ongoingProcess, popupService, gettextCatalog) {
|
||||
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, bwcError, amazonService, lodash, ongoingProcess, popupService, gettextCatalog, externalLinkService) {
|
||||
|
||||
$scope.cancelGiftCard = function() {
|
||||
ongoingProcess.set('Canceling gift card...', true);
|
||||
|
|
@ -62,4 +62,8 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
|||
$scope.amazonCardDetailsModal.hide();
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
});
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ angular.module('copayApp.controllers').controller('termsController', function($s
|
|||
});
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('preferencesAbout',
|
|||
$scope.commitHash = $window.commitHash;
|
||||
$scope.name = $window.appConfig.gitHubRepoName;
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
$scope.wallets = profileService.getWallets();
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
|
|
|||
|
|
@ -970,8 +970,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
if (lodash.isEmpty(profileService.getWallets())) {
|
||||
$log.debug('No wallets and no disclaimer... redirecting');
|
||||
$state.go('onboarding.welcome');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$log.debug('Display disclaimer... redirecting');
|
||||
$state.go('onboarding.disclaimer', {
|
||||
resume: true
|
||||
|
|
@ -980,8 +979,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
} else {
|
||||
throw new Error(err); // TODO
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
profileService.storeProfileIfDirty();
|
||||
$log.debug('Profile loaded ... Starting UX.');
|
||||
scannerService.gentleInitialize();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').service('externalLinkService', function($window, $timeout, $log, platformInfo, nodeWebkitService) {
|
||||
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog, $window, $log, $timeout) {
|
||||
|
||||
this.open = function(url, target) {
|
||||
this.open = function(url, optIn, title, message, okText, cancelText) {
|
||||
var old = $window.handleOpenURL;
|
||||
|
||||
$window.handleOpenURL = function(url) {
|
||||
|
|
@ -17,8 +17,16 @@ angular.module('copayApp.services').service('externalLinkService', function($win
|
|||
if (platformInfo.isNW) {
|
||||
nodeWebkitService.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
if (optIn) {
|
||||
var message = gettextCatalog.getString(message),
|
||||
title = gettextCatalog.getString(title),
|
||||
okText = gettextCatalog.getString(okText),
|
||||
cancelText = gettextCatalog.getString(cancelText),
|
||||
openBrowser = function(res) {
|
||||
if (res) window.open(url, '_system');
|
||||
};
|
||||
popupService.showConfirm(title, message, okText, cancelText, openBrowser);
|
||||
} else window.open(url, '_system');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@
|
|||
</div>
|
||||
<div class="m10t">
|
||||
<button class="button button-positive"
|
||||
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + buy.giftCard.claimCode, '_system')">
|
||||
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + buy.giftCard.claimCode)">
|
||||
Redeem Now
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -35,9 +35,8 @@
|
|||
</p>
|
||||
|
||||
<p class="m20t text-gray size-12">Connect your Glidera account to get started</p>
|
||||
|
||||
<button class="button button-standard button-primary"
|
||||
ng-click="openExternalLink(glidera.getAuthenticateUrl(), '_system'); showOauthForm = true">
|
||||
<button class="button button-block button-positive"
|
||||
ng-click="openExternalLink(glidera.getAuthenticateUrl()); showOauthForm = true">
|
||||
Connect to Glidera
|
||||
</button>
|
||||
<div class="m10t">
|
||||
|
|
@ -96,8 +95,7 @@
|
|||
<h4 class="text-bold"> Complete Setup</h4>
|
||||
<div>Your Glidera account is not ready to transact. Please, verify it at <b>Glidera.io</b></div>
|
||||
<a class="button"
|
||||
ng-init="glideraUrl = network == 'testnet' ? 'https://sandbox.glidera.io/login' :
|
||||
'https://glidera.io/login'"
|
||||
ng-init="glideraUrl = network == 'testnet' ? 'https://sandbox.glidera.io/login' : 'https://glidera.io/login'"
|
||||
ng-click="openExternalLink(glideraUrl)">
|
||||
Go to Glidera
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
<div class="m10t" ng-show="card.cardStatus == 'Fulfilled'">
|
||||
<button class="button button-positive"
|
||||
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + card.claimCode, '_system')">
|
||||
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + card.claimCode)">
|
||||
Redeem Now
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<ion-content class="has-header" scroll="false">
|
||||
<ion-scroll ng-include="'views/includes/terms.html'" direction="y" ng-style="{'height': '60%'}"></ion-scroll>
|
||||
<div id="agree-to-terms">
|
||||
<a ng-click="openExternalLink('https://copay.io/disclaimer')" ng-show="lang != 'en'" translate>Official English Disclaimer</a>
|
||||
<a ng-click="openExternalLink('https://copay.io/disclaimer', true, 'View Terms of Service', 'The official English Terms of Service are available on the BitPay website. Would you like to view them?', 'Open Website', 'Go Back')" ng-show="lang != 'en'" translate>Official English Disclaimer</a>
|
||||
<ion-checkbox ng-model="terms.accept3"></ion-checkbox>
|
||||
<p translate>I have read, understood, and agree with the Terms of use.</p>
|
||||
<button ng-disabled="!terms.accept3" class="button button-block button-positive" ng-click="termsModal.hide(); confirm()" translate>Confirm & Finish</button>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
</div>
|
||||
|
||||
<div class="item item-icon-left"
|
||||
ng-click="openExternalLink('https://' + (getShortNetworkName() == 'test' ? 'test-' : '') + 'insight.bitpay.com/tx/' + btx.txid)">
|
||||
ng-click="openExternalLink('https://' + (getShortNetworkName() == 'test' ? 'test-' : '') + 'insight.bitpay.com/tx/' + btx.txid, true, 'View Transaction on Insight', 'Would you like to view this transaction on the Insight blockchain explorer?
', 'Open Insight', 'Go back')">
|
||||
<i class="icon ion-ios-upload-outline"></i>
|
||||
<span class="text-gray" translate>View transaction on the blockchain</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
v{{version}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item item-icon-left" ng-click="openExternalLink('https://github.com/bitpay/'+name+'/tree/'+commitHash)">
|
||||
<div class="item item-icon-left" ng-click="openExternalLink('https://github.com/bitpay/'+name+'/tree/'+commitHash+'', true, 'Open GitHub Project', 'You can see the latest developments and contribute to this open source app by visiting our project on GitHub.', 'Open GitHub', 'Go Back')">
|
||||
<i class="icon ion-social-github-outline"></i>
|
||||
<span translate>Commit hash</span>
|
||||
<span class="item-note">
|
||||
|
|
|
|||
|
|
@ -13,11 +13,13 @@
|
|||
</ion-radio>
|
||||
</div>
|
||||
<div class="padding">
|
||||
<span translate>All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at</span>
|
||||
<a ng-click="openExternalLink('https://crowdin.com/project/copay', '_system')">https://crowdin.com/project/copay</a>.
|
||||
<span translate>We’re always looking for translation contributions! You can make corrections or help to make this app available in your native language by joining our community on Crowdin.</span>
|
||||
<button class="button button-standard button-primary" ng-click="openExternalLink(true, 'Open Translation Community', 'You can make contributions by signing up on our Crowdin community translation website. We’re looking forward to hearing from you!
|
||||
', 'Open Crowdin', 'Go Back')" translate>Contribute Translations
|
||||
</button>
|
||||
<span translate>
|
||||
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.
|
||||
</span>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
</ion-view>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<span translate>Address Book</span>
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</a>
|
||||
<a class="item item-icon-left item-icon-right" ng-click=openExternalLink("https://help.bitpay.com")>
|
||||
<a class="item item-icon-left item-icon-right" ng-click="openExternalLink('https://help.bitpay.com', true, 'BitPay Help Center', 'Help and support information is available at the BitPay Help Center website. Would you like to go there now?', 'Open Help Center', 'Go Back')">
|
||||
<i class="icon big-icon-svg">
|
||||
<img src="img/icon-help-support.svg" class="bg"/>
|
||||
</i>
|
||||
|
|
@ -135,7 +135,6 @@
|
|||
<span translate>About</span> {{appName}}
|
||||
<i class="icon bp-arrow-right"></i>
|
||||
</a>
|
||||
|
||||
<div class="item item-divider"></div>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
</div>
|
||||
<button class="button button-standard button-primary"
|
||||
ng-show="lang != 'en'"
|
||||
ng-click="openExternalLink(disclaimerUrl)" translate>
|
||||
ng-click="openExternalLink(disclaimerUrl, true, 'View Terms of Service', 'The official English Terms of Service are available on the BitPay website. Would you like to view them?', 'Open Website', 'Go Back')" translate>
|
||||
Official English Disclaimer
|
||||
</button>
|
||||
</ion-content>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@
|
|||
</div>
|
||||
<div class="padding">
|
||||
<p>
|
||||
<span translate>All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at</span>
|
||||
<a ng-click="openExternalLink('https://crowdin.com/project/copay', '_system')">https://crowdin.com/project/copay</a>.
|
||||
<span translate>We’re always looking for translation contributions! You can make corrections or help to make this app available in your native language by joining our community on Crowdin.</span>
|
||||
<button class="button button-standard button-primary" ng-click="openExternalLink(true, 'Open Translation Community', 'You can make contributions by signing up on our Crowdin community translation website. We’re looking forward to hearing from you!
|
||||
', 'Open Crowdin', 'Go Back')" translate>Contribute Translations
|
||||
</button>
|
||||
</p>
|
||||
<span translate>
|
||||
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.
|
||||
|
|
|
|||
|
|
@ -90,10 +90,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wallet-details-release size-12" ng-show="newRelease" ng-click="openExternalLink('https://github.com/bitpay/copay/releases/latest')">
|
||||
<span>{{newRelease}}</span><i class="icon-arrow-right3 right size-18"></i>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card list" ng-if="txps[0]">
|
||||
<div class="item item-heading" translate>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue