fix external link translations

This commit is contained in:
Gabriel Bazán 2016-12-12 17:29:11 -03:00
parent b413303c85
commit 80863a7f4d
28 changed files with 82 additions and 52 deletions

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('addressbookListController', function($scope, $log, $timeout, addressbookService, lodash, popupService) { angular.module('copayApp.controllers').controller('addressbookListController', function($scope, $log, $timeout, addressbookService, lodash, popupService, gettextCatalog) {
var contacts; var contacts;

View File

@ -5,8 +5,8 @@ angular.module('copayApp.controllers').controller('amazonController',
$scope.network = amazonService.getEnvironment(); $scope.network = amazonService.getEnvironment();
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function(url) {
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url);
}; };
var initAmazon = function() { var initAmazon = function() {
@ -20,7 +20,9 @@ angular.module('copayApp.controllers').controller('amazonController',
$scope.$digest(); $scope.$digest();
}); });
if ($scope.cardClaimCode) { if ($scope.cardClaimCode) {
var card = lodash.find($scope.giftCards, { claimCode: $scope.cardClaimCode }); var card = lodash.find($scope.giftCards, {
claimCode: $scope.cardClaimCode
});
if (lodash.isEmpty(card)) { if (lodash.isEmpty(card)) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Card not found')); popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Card not found'));
return; return;

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('rateAppController', function($scope, $state, $stateParams, $window, lodash, externalLinkService, configService, gettextCatalog, platformInfo, feedbackService, ongoingProcess, popupService) { angular.module('copayApp.controllers').controller('rateAppController', function($scope, $state, $stateParams, $window, lodash, externalLinkService, configService, platformInfo, feedbackService, ongoingProcess, popupService) {
$scope.score = parseInt($stateParams.score); $scope.score = parseInt($stateParams.score);
var isAndroid = platformInfo.isAndroid; var isAndroid = platformInfo.isAndroid;
var isIOS = platformInfo.isIOS; var isIOS = platformInfo.isIOS;

View File

@ -62,8 +62,8 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
$scope.amazonCardDetailsModal.hide(); $scope.amazonCardDetailsModal.hide();
}; };
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function(url) {
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url);
}; };
}); });

View File

@ -1,8 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, $window, uxLanguage, profileService, externalLinkService) { angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, $window, uxLanguage, profileService, externalLinkService, gettextCatalog) {
$scope.lang = uxLanguage.currentLanguage; $scope.lang = uxLanguage.currentLanguage;
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl;
$scope.confirm = function() { $scope.confirm = function() {
profileService.setDisclaimerAccepted(function(err) { profileService.setDisclaimerAccepted(function(err) {
@ -15,7 +14,13 @@ angular.module('copayApp.controllers').controller('termsController', function($s
}); });
}; };
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function() {
var url = $window.appConfig.disclaimerUrl;
var optIn = true;
var title = gettextCatalog.getString('View Terms of Service');
var message = gettextCatalog.getString('The official English Terms of Service are available on the BitPay website. Would you like to view them?');
var okText = gettextCatalog.getString('Open Website');
var cancelText = gettextCatalog.getString('Go Back');
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url, optIn, title, message, okText, cancelText);
}; };

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesController', angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $timeout, $log, $stateParams, $ionicHistory, gettextCatalog, configService, profileService, fingerprintService, walletService) { function($scope, $rootScope, $timeout, $log, $stateParams, $ionicHistory, configService, profileService, fingerprintService, walletService) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.credentials.walletId; var walletId = wallet.credentials.walletId;
$scope.wallet = wallet; $scope.wallet = wallet;

View File

@ -5,10 +5,14 @@ angular.module('copayApp.controllers').controller('preferencesAbout',
$scope.title = gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase; $scope.title = gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase;
$scope.version = $window.version; $scope.version = $window.version;
$scope.commitHash = $window.commitHash;
$scope.name = $window.appConfig.gitHubRepoName;
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function() {
var url = 'https://github.com/bitpay/' + $window.appConfig.gitHubRepoName + '/tree/' + $window.commitHash + '';
var optIn = true;
var title = gettextCatalog.getString('Open GitHub Project');
var message = gettextCatalog.getString('You can see the latest developments and contribute to this open source app by visiting our project on GitHub.');
var okText = gettextCatalog.getString('Open GitHub');
var cancelText = gettextCatalog.getString('Go Back');
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url, optIn, title, message, okText, cancelText);
}; };
}); });

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesAliasController', angular.module('copayApp.controllers').controller('preferencesAliasController',
function($scope, $timeout, $stateParams, $ionicHistory, gettextCatalog, configService, profileService, walletService) { function($scope, $timeout, $stateParams, $ionicHistory, configService, profileService, walletService) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.credentials.walletId; var walletId = wallet.credentials.walletId;
var config = configService.getSync(); var config = configService.getSync();

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController', angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
function($scope, $log, $timeout, $ionicHistory, gettextCatalog, configService, rateService, lodash, profileService, walletService) { function($scope, $log, $timeout, $ionicHistory, configService, rateService, lodash, profileService, walletService) {
var next = 10; var next = 10;
var completeAlternativeList; var completeAlternativeList;

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $timeout, $log, $stateParams, $ionicHistory, gettextCatalog, configService, profileService) { angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $timeout, $log, $stateParams, $ionicHistory, configService, profileService) {
var wallet = profileService.getWallet($stateParams.walletId); var wallet = profileService.getWallet($stateParams.walletId);
$scope.wallet = wallet; $scope.wallet = wallet;
var walletId = wallet.credentials.walletId; var walletId = wallet.credentials.walletId;

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesHistory', angular.module('copayApp.controllers').controller('preferencesHistory',
function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, gettextCatalog, storageService, platformInfo, profileService, lodash, $window) { function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, storageService, platformInfo, profileService, lodash, $window) {
$scope.wallet = profileService.getWallet($stateParams.walletId); $scope.wallet = profileService.getWallet($stateParams.walletId);
$scope.csvReady = false; $scope.csvReady = false;
$scope.isCordova = platformInfo.isCordova; $scope.isCordova = platformInfo.isCordova;

View File

@ -5,7 +5,13 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
$scope.availableLanguages = uxLanguage.getLanguages(); $scope.availableLanguages = uxLanguage.getLanguages();
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function() {
var url = 'https://crowdin.com/project/copay';
var optIn = true;
var title = gettextCatalog.getString('Open Translation Community');
var message = gettextCatalog.getString('You can make contributions by signing up on our Crowdin community translation website. Were looking forward to hearing from you!');
var okText = gettextCatalog.getString('Open Crowdin');
var cancelText = gettextCatalog.getString('Go Back');
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url, optIn, title, message, okText, cancelText);
}; };

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('preferencesLogs', angular.module('copayApp.controllers').controller('preferencesLogs',
function($scope, historicLog, gettextCatalog) { function($scope, historicLog) {
$scope.$on("$ionicView.enter", function(event, data) { $scope.$on("$ionicView.enter", function(event, data) {
$scope.logs = historicLog.get(); $scope.logs = historicLog.get();

View File

@ -126,7 +126,13 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}); });
}); });
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function() {
var url = 'https://github.com/bitpay/copay/releases/latest';
var optIn = true;
var title = gettextCatalog.getString('Update Available');
var message = gettextCatalog.getString('An update to this app is available. For your security, please update to the latest version.');
var okText = gettextCatalog.getString('View Update');
var cancelText = gettextCatalog.getString('Go Back');
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url, optIn, title, message, okText, cancelText);
}; };

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, $ionicModal, $log, lodash, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService, bitpayCardService, storageService, glideraService) { angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, $ionicModal, $log, lodash, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService, bitpayCardService, storageService, glideraService, gettextCatalog) {
var updateConfig = function() { var updateConfig = function() {
@ -30,7 +30,13 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp; $scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
}; };
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function() {
var url = 'https://help.bitpay.com/bitpay-app';
var optIn = true;
var title = gettextCatalog.getString('BitPay Help Center');
var message = gettextCatalog.getString('Help and support information is available at the BitPay Help Center website. Would you like to go there now?');
var okText = gettextCatalog.getString('Open Help Center');
var cancelText = gettextCatalog.getString('Go Back');
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url, optIn, title, message, okText, cancelText);
}; };

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tabsController', function($rootScope, $log, $scope, $state, $stateParams, $timeout, incomingData, lodash, popupService) { angular.module('copayApp.controllers').controller('tabsController', function($rootScope, $log, $scope, $state, $stateParams, $timeout, incomingData, lodash, popupService, gettextCatalog) {
$scope.onScan = function(data) { $scope.onScan = function(data) {
if (!incomingData.redir(data)) { if (!incomingData.redir(data)) {

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('termOfUseController', angular.module('copayApp.controllers').controller('termOfUseController',
function($scope, $window, uxLanguage, gettextCatalog, externalLinkService) { function($scope, $window, uxLanguage, externalLinkService) {
$scope.lang = uxLanguage.currentLanguage; $scope.lang = uxLanguage.currentLanguage;
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl; $scope.disclaimerUrl = $window.appConfig.disclaimerUrl;

View File

@ -1,8 +1,14 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('translatorsController', angular.module('copayApp.controllers').controller('translatorsController',
function($scope, externalLinkService) { function($scope, externalLinkService, gettextCatalog) {
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) { $scope.openExternalLink = function() {
var url = 'https://crowdin.com/project/copay';
var optIn = true;
var title = gettextCatalog.getString('Open Translation Community');
var message = gettextCatalog.getString('You can make contributions by signing up on our Crowdin community translation website. Were looking forward to hearing from you!');
var okText = gettextCatalog.getString('Open Crowdin');
var cancelText = gettextCatalog.getString('Go Back');
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url, optIn, title, message, okText, cancelText);
}; };
}); });

View File

@ -121,12 +121,11 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
$scope.viewOnBlockchain = function() { $scope.viewOnBlockchain = function() {
var btx = $scope.btx; var btx = $scope.btx;
var url = 'https://' + ($scope.getShortNetworkName() == 'test' ? 'test-' : '') + 'insight.bitpay.com/tx/' + btx.txid; var url = 'https://' + ($scope.getShortNetworkName() == 'test' ? 'test-' : '') + 'insight.bitpay.com/tx/' + btx.txid;
var title = 'View Transaction on Insight'; var optIn = true;
var message = 'Would you like to view this transaction on the Insight blockchain explorer?'; var title = gettextCatalog.getString('View Transaction on Insight');
$scope.openExternalLink(url, true, title, message, 'Open Insight', 'Go back'); var message = gettextCatalog.getString('Would you like to view this transaction on the Insight blockchain explorer?');
}; var okText = gettextCatalog.getString('Open Insight');
var cancelText = gettextCatalog.getString('Go Back');
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
externalLinkService.open(url, optIn, title, message, okText, cancelText); externalLinkService.open(url, optIn, title, message, okText, cancelText);
}; };

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicHistory, profileService, lodash, configService, gettextCatalog, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicScrollDelegate, $window) { angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicHistory, profileService, lodash, configService, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicScrollDelegate, $window) {
var HISTORY_SHOW_LIMIT = 10; var HISTORY_SHOW_LIMIT = 10;
var currentTxHistoryPage = 0; var currentTxHistoryPage = 0;
@ -322,7 +322,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
}); });
$scope.$on("$ionicView.beforeLeave", function(event, data) { $scope.$on("$ionicView.beforeLeave", function(event, data) {
if($window.StatusBar) { if ($window.StatusBar) {
$window.StatusBar.backgroundColorByHexString('#1e3186'); $window.StatusBar.backgroundColorByHexString('#1e3186');
} }
}); });
@ -336,13 +336,13 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
function setAndroidStatusBarColor() { function setAndroidStatusBarColor() {
var SUBTRACT_AMOUNT = 15; var SUBTRACT_AMOUNT = 15;
if(!$scope.isAndroid) { if (!$scope.isAndroid) {
return; return;
} }
var rgb = hexToRgb($scope.wallet.color); var rgb = hexToRgb($scope.wallet.color);
var keys = Object.keys(rgb); var keys = Object.keys(rgb);
keys.forEach(function(k) { keys.forEach(function(k) {
if(rgb[k] - SUBTRACT_AMOUNT < 0) { if (rgb[k] - SUBTRACT_AMOUNT < 0) {
rgb[k] = 0; rgb[k] = 0;
} else { } else {
rgb[k] -= SUBTRACT_AMOUNT; rgb[k] -= SUBTRACT_AMOUNT;

View File

@ -21,14 +21,10 @@ angular.module('copayApp.services').service('externalLinkService', function(plat
_restoreHandleOpenURL(old); _restoreHandleOpenURL(old);
} else { } else {
if (optIn) { if (optIn) {
var message = gettextCatalog.getString(message), var openBrowser = function(res) {
title = gettextCatalog.getString(title), if (res) window.open(url, '_system');
okText = gettextCatalog.getString(okText), _restoreHandleOpenURL(old);
cancelText = gettextCatalog.getString(cancelText), };
openBrowser = function(res) {
if (res) window.open(url, '_system');
_restoreHandleOpenURL(old);
};
popupService.showConfirm(title, message, okText, cancelText, openBrowser); popupService.showConfirm(title, message, okText, cancelText, openBrowser);
} else { } else {
window.open(url, '_system'); window.open(url, '_system');

View File

@ -12,7 +12,7 @@
</ion-content> </ion-content>
<div id="agree-to-terms"> <div id="agree-to-terms">
<div class="text-center"> <div class="text-center">
<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> <a ng-click="openExternalLink()" ng-show="lang != 'en'" translate>Official English Disclaimer</a>
</div> </div>
<div class="row"> <div class="row">
<div class="col col-20"> <div class="col col-20">

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+'', 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')"> <div class="item item-icon-left" ng-click="openExternalLink()">
<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

@ -23,7 +23,7 @@
</div> </div>
</div> </div>
<div class="padding"> <div class="padding">
<a class="button button-standard button-primary" ng-click="openExternalLink('https://crowdin.com/project/copay', 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</a> <a class="button button-standard button-primary" ng-click="openExternalLink()" translate>Contribute Translations</a>
<div> <div>
</ion-content> </ion-content>
</ion-view> </ion-view>

View File

@ -10,7 +10,7 @@
spinner="ios-small" spinner="ios-small"
on-refresh="onRefresh()"> on-refresh="onRefresh()">
</ion-refresher> </ion-refresher>
<div class="release ng-hide" ng-show="newRelease" ng-click="openExternalLink('https://github.com/bitpay/copay/releases/latest', true, 'Update Available', 'An update to this app is available. For your security, please update to the latest version.', 'View Update', 'Go Back')"> <div class="release ng-hide" ng-show="newRelease" ng-click="openExternalLink()">
<span translate>An update to this app is available</span><span><i class="icon bp-arrow-right"></i></span> <span translate>An update to this app is available</span><span><i class="icon bp-arrow-right"></i></span>
</div> </div>
<div class="ng-hide" ng-show="showRateCard.value" ng-include="'views/feedback/rateCard.html'"></div> <div class="ng-hide" ng-show="showRateCard.value" ng-include="'views/feedback/rateCard.html'"></div>

View File

@ -20,7 +20,7 @@
<span translate>Address Book</span> <span translate>Address Book</span>
<i class="icon bp-arrow-right"></i> <i class="icon bp-arrow-right"></i>
</a> </a>
<a class="item item-icon-left item-icon-right" ng-click="openExternalLink('https://help.bitpay.com/bitpay-app', 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')"> <a class="item item-icon-left item-icon-right" ng-click="openExternalLink()">
<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-standard button-primary" <button class="button button-standard button-primary"
ng-show="lang != 'en'" ng-show="lang != 'en'"
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> ng-click="openExternazlLink()" translate>
Official English Disclaimer Official English Disclaimer
</button> </button>
</ion-content> </ion-content>

View File

@ -30,7 +30,7 @@
</div> </div>
</div> </div>
<div class="padding"> <div class="padding">
<a class="button button-standard button-primary" ng-click="openExternalLink('https://crowdin.com/project/copay', 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</a> <a class="button button-standard button-primary" ng-click="openExternalLink()" translate>Contribute Translations</a>
</div> </div>
</ion-content> </ion-content>
</ion-view> </ion-view>