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

@ -6,7 +6,7 @@ angular.module('copayApp.controllers').controller('glideraController',
$scope.network = glideraService.getEnvironment(); $scope.network = glideraService.getEnvironment();
$scope.openExternalLink = function(url, target) { $scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target); externalLinkService.open(url);
}; };
var initGlidera = function(accessToken) { var initGlidera = function(accessToken) {
@ -27,7 +27,9 @@ angular.module('copayApp.controllers').controller('glideraController',
} }
$scope.token = glidera.token; $scope.token = glidera.token;
$scope.permissions = glidera.permissions; $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(); initGlidera();
}); });

View file

@ -971,8 +971,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
if (lodash.isEmpty(profileService.getWallets())) { if (lodash.isEmpty(profileService.getWallets())) {
$log.debug('No wallets and no disclaimer... redirecting'); $log.debug('No wallets and no disclaimer... redirecting');
$state.go('onboarding.welcome'); $state.go('onboarding.welcome');
} } else {
else {
$log.debug('Display disclaimer... redirecting'); $log.debug('Display disclaimer... redirecting');
$state.go('onboarding.disclaimer', { $state.go('onboarding.disclaimer', {
resume: true resume: true
@ -981,8 +980,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} else { } else {
throw new Error(err); // TODO throw new Error(err); // TODO
} }
} } else {
else {
profileService.storeProfileIfDirty(); profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.'); $log.debug('Profile loaded ... Starting UX.');
scannerService.gentleInitialize(); scannerService.gentleInitialize();

View file

@ -1,13 +1,17 @@
'use strict'; '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) { if (platformInfo.isNW) {
nodeWebkitService.openExternalLink(url); nodeWebkitService.openExternalLink(url);
} else { } else {
target = target || '_blank'; desc = desc || 'this link';
var ref = window.open(url, target, 'location=no'); 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);
} }
}; };

View file

@ -24,7 +24,7 @@
<div class="text-left m30v size-12"> <div class="text-left m30v size-12">
Amazon.com Gift Cards never expire and can be redeemed towards millions of items at Amazon.com Gift Cards never expire and can be redeemed towards millions of items at
<a ng-click="openExternalLink('https://www.amazon.com')">www.amazon.com</a> <a ng-click="openExternalLink('https://www.amazon.com', 'Amazon')">www.amazon.com</a>
</div> </div>
</div> </div>

View file

@ -17,7 +17,7 @@
BitPay Invoice ID: {{buy.errorInfo.invoiceId}}. BitPay Invoice ID: {{buy.errorInfo.invoiceId}}.
</div> </div>
<div class="text-center"> <div class="text-center">
<a ng-click="openExternalLink(buy.errorInfo.invoiceUrl)">Open invoice</a> <a ng-click="openExternalLink(buy.errorInfo.invoiceUrl, 'Amazon invoice error')">Open invoice</a>
</div> </div>
</div> </div>
@ -88,7 +88,7 @@
<div class="size-12 p15h"> <div class="size-12 p15h">
Thank you for participating in the BitPay offer. It is our pleasure to send Thank you for participating in the BitPay offer. It is our pleasure to send
you this Amazon.com Gift Card* that can be redeemed towards millions of items at you this Amazon.com Gift Card* that can be redeemed towards millions of items at
<a ng-click="openExternalLink('https://www.amazon.com')">www.amazon.com</a>. <a ng-click="openExternalLink('https://www.amazon.com', 'Amazon')">www.amazon.com</a>.
You may want to print this screen for easy reference later you will need the gift card claim code below. You may want to print this screen for easy reference later you will need the gift card claim code below.
</div> </div>
@ -105,19 +105,19 @@
</div> </div>
<div class="m10t"> <div class="m10t">
<button class="button button-positive" <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, 'Amazon gift card redemtion')">
Redeem Now Redeem Now
</button> </button>
</div> </div>
<div class="m10t text-center"> <div class="m10t text-center">
<a class="button button-clear button-calm" ng-click="openExternalLink(buy.giftCard.invoiceUrl)">See invoice</a> <a class="button button-clear button-calm" ng-click="openExternalLink(buy.giftCard.invoiceUrl, 'this Amazon gift card redemtion')">See invoice</a>
</div> </div>
</div> </div>
<div class="oh m20t p15h size-12"> <div class="oh m20t p15h size-12">
To redeem your gift card, follow these steps: To redeem your gift card, follow these steps:
<ol class="m10t size-12"> <ol class="m10t size-12">
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a> <li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc', 'Amazon gift card information')">www.amazon.com/gc</a>
<li>2. Click Apply to Account and enter the Claim Code when prompted. <li>2. Click Apply to Account and enter the Claim Code when prompted.
<li>3. Gift card funds will be applied automatically to eligible orders during the checkout process. <li>3. Gift card funds will be applied automatically to eligible orders during the checkout process.
<li>4. You must pay for any remaining balance on your order with another payment method. <li>4. You must pay for any remaining balance on your order with another payment method.
@ -130,7 +130,7 @@
<p class="size-12"> <p class="size-12">
If you have questions about redeeming your gift card, please visit If you have questions about redeeming your gift card, please visit
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem')">www.amazon.com/gc-redeem</a>. <a ng-click="openExternalLink('https://www.amazon.com/gc-redeem', 'Amazon git card hel & support')">www.amazon.com/gc-redeem</a>.
If you have questions regarding the BitPay Introductory offer, please contact BitPay. If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p> </p>
@ -139,14 +139,14 @@
</div> </div>
<div class="size-12 white p15 m20t"> <div class="size-12 white p15 m20t">
* <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion. * <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a> is not a sponsor of this promotion.
Except as required by law, <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> Except as required by law, <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a>
Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of
eligible goods at <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its eligible goods at <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a> or certain of its
affiliated websites. For complete terms and conditions, see affiliated websites. For complete terms and conditions, see
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>. <a ng-click="openExternalLink('https://www.amazon.com/gc-legal', 'Amazon')">www.amazon.com/gc-legal</a>.
GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP
of <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates. of <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a>, Inc. or its affiliates.
No expiration date or service fees. No expiration date or service fees.
</div> </div>

View file

@ -37,7 +37,7 @@
<p class="m20t text-gray size-12">Connect your Glidera account to get started</p> <p class="m20t text-gray size-12">Connect your Glidera account to get started</p>
<button class="button button-block button-positive" <button class="button button-block button-positive"
ng-click="openExternalLink(glidera.getAuthenticateUrl(), '_system'); showOauthForm = true"> ng-click="openExternalLink(glidera.getAuthenticateUrl(), 'Glidera authentication'); showOauthForm = true">
Connect to Glidera Connect to Glidera
</button> </button>
<div class="m10t"> <div class="m10t">
@ -96,9 +96,8 @@
<h4 class="text-bold"> Complete Setup</h4> <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> <div>Your Glidera account is not ready to transact. Please, verify it at <b>Glidera.io</b></div>
<a class="button" <a class="button"
ng-init="glideraUrl = network == 'testnet' ? 'https://sandbox.glidera.io/login' : ng-init="glideraUrl = network == 'testnet' ? 'https://sandbox.glidera.io/login' : 'https://glidera.io/login'"
'https://glidera.io/login'" ng-click="openExternalLink(glideraUrl, 'Glidera account verification')">
ng-click="openExternalLink(glideraUrl)">
Go to Glidera Go to Glidera
</a> </a>
</div> </div>

View file

@ -23,7 +23,7 @@
</div> </div>
<div class="m10t" ng-show="card.cardStatus == 'Fulfilled'"> <div class="m10t" ng-show="card.cardStatus == 'Fulfilled'">
<button class="button button-positive" <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, 'Amazon gift card redemption')">
Redeem Now Redeem Now
</button> </button>
</div> </div>
@ -48,7 +48,7 @@
</div> </div>
</div> </div>
<div class="m10t text-center"> <div class="m10t text-center">
<a class="button button-clear button-calm" ng-click="openExternalLink(card.invoiceUrl)">See invoice</a> <a class="button button-clear button-calm" ng-click="openExternalLink(card.invoiceUrl, 'Amazon gift card invoice')">See invoice</a>
</div> </div>
</div> </div>
@ -60,7 +60,7 @@
To redeem your gift card, follow these steps: To redeem your gift card, follow these steps:
<ol class="m10t size-12"> <ol class="m10t size-12">
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a> <li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc', 'Amazon gift card information')">www.amazon.com/gc</a>
<li>2. Click Apply to Account and enter the Claim Code when prompted. <li>2. Click Apply to Account and enter the Claim Code when prompted.
<li>3. Gift card funds will be applied automatically to eligible orders during the checkout process. <li>3. Gift card funds will be applied automatically to eligible orders during the checkout process.
<li>4. You must pay for any remaining balance on your order with another payment method. <li>4. You must pay for any remaining balance on your order with another payment method.
@ -73,7 +73,7 @@
<p class="size-12"> <p class="size-12">
If you have questions about redeeming your gift card, please visit If you have questions about redeeming your gift card, please visit
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem')">www.amazon.com/gc-redeem</a>. <a ng-click="openExternalLink('https://www.amazon.com/gc-redeem', 'Amazon git card hel & support')">www.amazon.com/gc-redeem</a>.
If you have questions regarding the BitPay Introductory offer, please contact BitPay. If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p> </p>
@ -81,13 +81,13 @@
<div class="size-12 p15 m30v"> <div class="size-12 p15 m30v">
* <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion. * <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion.
Except as required by law, <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> Except as required by law, <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a>
Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of
eligible goods at <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its eligible goods at <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a> or certain of its
affiliated websites. For complete terms and conditions, see affiliated websites. For complete terms and conditions, see
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>. <a ng-click="openExternalLink('https://www.amazon.com/gc-legal', 'Amazon gift card legal information')">www.amazon.com/gc-legal</a>.
GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP
of <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates. of <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a>, Inc. or its affiliates.
No expiration date or service fees. No expiration date or service fees.
</div> </div>

View file

@ -10,7 +10,7 @@
<ion-content class="has-header" scroll="false"> <ion-content class="has-header" scroll="false">
<ion-scroll ng-include="'views/includes/terms.html'" direction="y" ng-style="{'height': '60%'}"></ion-scroll> <ion-scroll ng-include="'views/includes/terms.html'" direction="y" ng-style="{'height': '60%'}"></ion-scroll>
<div id="agree-to-terms"> <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', 'BitPay terms and conditions')" ng-show="lang != 'en'" translate>Official English Disclaimer</a>
<ion-checkbox ng-model="terms.accept3"></ion-checkbox> <ion-checkbox ng-model="terms.accept3"></ion-checkbox>
<p translate>I have read, understood, and agree with the Terms of use.</p> <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> <button ng-disabled="!terms.accept3" class="button button-block button-positive" ng-click="termsModal.hide(); confirm()" translate>Confirm & Finish</button>

View file

@ -70,7 +70,7 @@
</div> </div>
<div class="item item-icon-left" <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-' : '', 'blockchain transaction') + 'insight.bitpay.com/tx/' + btx.txid)">
<i class="icon ion-ios-upload-outline"></i> <i class="icon ion-ios-upload-outline"></i>
<span class="text-gray" translate>View transaction on the blockchain</span> <span class="text-gray" translate>View transaction on the blockchain</span>
</div> </div>

View file

@ -16,7 +16,7 @@
v{{version}} v{{version}}
</span> </span>
</div> </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, 'latest commit')">
<i class="icon ion-social-github-outline"></i> <i class="icon ion-social-github-outline"></i>
<span translate>Commit hash</span> <span translate>Commit hash</span>
<span class="item-note"> <span class="item-note">

View file

@ -14,10 +14,10 @@
</div> </div>
<div class="padding"> <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> <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>. <a ng-click="openExternalLink('https://crowdin.com/project/copay', 'Crowdin')">https://crowdin.com/project/copay</a>.
<span translate> <span translate>
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language. Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.
</span> </span>
</div> </div>
</ion-content> </ion-content>
</ion-view> </ion-view>

View file

@ -123,7 +123,7 @@
</a> </a>
<div class="item item-divider"></div> <div class="item item-divider"></div>
<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", "BitPay Help & Support")>
<i class="icon big-icon-svg"> <i class="icon big-icon-svg">
<img src="img/icon-help-support.svg" class="bg"/> <img src="img/icon-help-support.svg" class="bg"/>
</i> </i>

View file

@ -11,7 +11,7 @@
</div> </div>
<button class="button button-block button-positive" <button class="button button-block button-positive"
ng-show="lang != 'en'" ng-show="lang != 'en'"
ng-click="openExternalLink(disclaimerUrl)" translate> ng-click="openExternalLink(disclaimerUrl, 'Bitpay disclaimer')" translate>
Official English Disclaimer Official English Disclaimer
</button> </button>
</ion-content> </ion-content>

View file

@ -22,7 +22,7 @@
<div class="padding"> <div class="padding">
<p> <p>
<span translate>All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at</span> <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>. <a ng-click="openExternalLink('https://crowdin.com/project/copay', 'crowdin')">https://crowdin.com/project/copay</a>.
</p> </p>
<span translate> <span translate>
Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language. Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language.

View file

@ -90,7 +90,7 @@
</div> </div>
</div> </div>
<div class="wallet-details-release size-12" ng-show="newRelease" ng-click="openExternalLink('https://github.com/bitpay/copay/releases/latest')"> <div class="wallet-details-release size-12" ng-show="newRelease" ng-click="openExternalLink('https://github.com/bitpay/copay/releases/latest', 'release information')">
<span>{{newRelease}}</span><i class="icon-arrow-right3 right size-18"></i> <span>{{newRelease}}</span><i class="icon-arrow-right3 right size-18"></i>
</div> </div>