added additional options to external service to provide custom message. disabled confirm dialog where needed

This commit is contained in:
Jamal Jackson 2016-10-12 15:29:06 -04:00
parent 3d9e40b4c5
commit fa7c746f5e
19 changed files with 73 additions and 57 deletions

View File

@ -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();
});
});

View File

@ -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

View File

@ -5,8 +5,8 @@ angular.module('copayApp.controllers').controller('glideraController',
$scope.network = glideraService.getEnvironment();
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url);
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
externalLinkService.open(url, optIn, title, message, okText, cancelText);
};
var initGlidera = function(accessToken) {

View File

@ -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);
};
});

View File

@ -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() {

View File

@ -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);
};
});

View File

@ -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);
};
});

View File

@ -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) {

View File

@ -1,8 +1,8 @@
'use strict';
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog) {
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog, $window, $log, $timeout) {
this.open = function(url, optIn, title, desc, okText, cancelText) {
this.open = function(url, optIn, title, message, okText, cancelText) {
var old = $window.handleOpenURL;
$window.handleOpenURL = function(url) {
@ -17,12 +17,16 @@ angular.module('copayApp.services').service('externalLinkService', function(plat
if (platformInfo.isNW) {
nodeWebkitService.openExternalLink(url);
} else {
var message = gettextCatalog.getString(desc),
title = gettextCatalog.getString(title),
openBrowser = function(res) {
if (res) window.open(url, '_system');
};
popupService.showConfirm(title, message, 'Open', 'Cancel', openBrowser);
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');
}
};

View File

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

View File

@ -17,7 +17,7 @@
BitPay Invoice ID: {{buy.errorInfo.invoiceId}}.
</div>
<div class="text-center">
<a ng-click="openExternalLink(buy.errorInfo.invoiceUrl, 'Amazon invoice error')">Open invoice</a>
<a ng-click="openExternalLink(buy.errorInfo.invoiceUrl, false)">Open invoice</a>
</div>
</div>
@ -88,7 +88,7 @@
<div class="size-12 p15h">
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
<a ng-click="openExternalLink('https://www.amazon.com', 'Amazon')">www.amazon.com</a>.
<a ng-click="openExternalLink('https://www.amazon.com', false)">www.amazon.com</a>.
You may want to print this screen for easy reference later you will need the gift card claim code below.
</div>
@ -105,19 +105,19 @@
</div>
<div class="m10t">
<button class="button button-positive"
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + buy.giftCard.claimCode, 'Amazon gift card redemtion')">
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + buy.giftCard.claimCode, false)">
Redeem Now
</button>
</div>
<div class="m10t text-center">
<a class="button button-clear button-calm" ng-click="openExternalLink(buy.giftCard.invoiceUrl, 'this Amazon gift card redemtion')">See invoice</a>
<a class="button button-clear button-calm" ng-click="openExternalLink(buy.giftCard.invoiceUrl, false)">See invoice</a>
</div>
</div>
<div class="oh m20t p15h size-12">
To redeem your gift card, follow these steps:
<ol class="m10t size-12">
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc', 'Amazon gift card information')">www.amazon.com/gc</a>
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc', false)">www.amazon.com/gc</a>
<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>4. You must pay for any remaining balance on your order with another payment method.
@ -130,7 +130,7 @@
<p class="size-12">
If you have questions about redeeming your gift card, please visit
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem', 'Amazon git card hel & support')">www.amazon.com/gc-redeem</a>.
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem', false)">www.amazon.com/gc-redeem</a>.
If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p>
@ -139,14 +139,14 @@
</div>
<div class="size-12 white p15 m20t">
* <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')">Amazon.com</a>
* <a ng-click="openExternalLink('http://amazon.com', false)">Amazon.com</a> is not a sponsor of this promotion.
Except as required by law, <a ng-click="openExternalLink('http://amazon.com', false)">Amazon.com</a>
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')">Amazon.com</a> or certain of its
eligible goods at <a ng-click="openExternalLink('http://amazon.com', false)">Amazon.com</a> or certain of its
affiliated websites. For complete terms and conditions, see
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal', 'Amazon')">www.amazon.com/gc-legal</a>.
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal', false)">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
of <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a>, Inc. or its affiliates.
of <a ng-click="openExternalLink('http://amazon.com', false)">Amazon.com</a>, Inc. or its affiliates.
No expiration date or service fees.
</div>

View File

@ -36,7 +36,7 @@
<p class="m20t text-gray size-12">Connect your Glidera account to get started</p>
<button class="button button-block button-positive"
ng-click="openExternalLink(glidera.getAuthenticateUrl(), 'Glidera authentication'); showOauthForm = true">
ng-click="openExternalLink(glidera.getAuthenticateUrl(), false); showOauthForm = true">
Connect to Glidera
</button>
<div class="m10t">
@ -96,7 +96,7 @@
<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-click="openExternalLink(glideraUrl, 'Glidera account verification')">
ng-click="openExternalLink(glideraUrl, false)">
Go to Glidera
</a>
</div>

View File

@ -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, 'Amazon gift card redemption')">
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + card.claimCode, false)">
Redeem Now
</button>
</div>
@ -48,7 +48,7 @@
</div>
</div>
<div class="m10t text-center">
<a class="button button-clear button-calm" ng-click="openExternalLink(card.invoiceUrl, 'Amazon gift card invoice')">See invoice</a>
<a class="button button-clear button-calm" ng-click="openExternalLink(card.invoiceUrl, false)">See invoice</a>
</div>
</div>
@ -60,7 +60,7 @@
To redeem your gift card, follow these steps:
<ol class="m10t size-12">
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc', 'Amazon gift card information')">www.amazon.com/gc</a>
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc', false)">www.amazon.com/gc</a>
<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>4. You must pay for any remaining balance on your order with another payment method.
@ -73,7 +73,7 @@
<p class="size-12">
If you have questions about redeeming your gift card, please visit
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem', 'Amazon git card hel & support')">www.amazon.com/gc-redeem</a>.
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem', false)">www.amazon.com/gc-redeem</a>.
If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p>
@ -81,13 +81,13 @@
<div class="size-12 p15 m30v">
* <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')">Amazon.com</a>
Except as required by law, <a ng-click="openExternalLink('http://amazon.com', false)">Amazon.com</a>
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')">Amazon.com</a> or certain of its
eligible goods at <a ng-click="openExternalLink('http://amazon.com', false)">Amazon.com</a> or certain of its
affiliated websites. For complete terms and conditions, see
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal', 'Amazon gift card legal information')">www.amazon.com/gc-legal</a>.
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal', false)">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
of <a ng-click="openExternalLink('http://amazon.com', 'Amazon')">Amazon.com</a>, Inc. or its affiliates.
of <a ng-click="openExternalLink('http://amazon.com', false)">Amazon.com</a>, Inc. or its affiliates.
No expiration date or service fees.
</div>

View File

@ -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', 'BitPay terms and conditions')" 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>

View File

@ -70,7 +70,7 @@
</div>
<div class="item item-icon-left"
ng-click="openExternalLink('https://' + (getShortNetworkName() == 'test' ? 'test-' : '', 'blockchain transaction') + 'insight.bitpay.com/tx/' + btx.txid)">
ng-click="openExternalLink('https://' + (getShortNetworkName() == 'test' ? 'test-' : '', 'blockchain transaction') + 'insight.bitpay.com/tx/' + btx.txid, yes, '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>

View File

@ -16,7 +16,7 @@
v{{version}}
</span>
</div>
<div class="item item-icon-left" ng-click="openExternalLink('https://github.com/bitpay/'+name+'/tree/'+commitHash, 'latest commit')">
<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">

View File

@ -13,8 +13,10 @@
</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', 'Crowdin')">https://crowdin.com/project/copay</a>.
<span translate>Were 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. Were 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>

View File

@ -123,7 +123,7 @@
</a>
<div class="item item-divider"></div>
<a class="item item-icon-left item-icon-right" ng-click=openExternalLink("https://help.bitpay.com", "BitPay Help & Support")>
<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>

View File

@ -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', 'crowdin')">https://crowdin.com/project/copay</a>.
<span translate>Were 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. Were 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.