Merge branch 'master' of https://github.com/bitpay/copay into feat/balance-modal
This commit is contained in:
commit
58478b8113
60 changed files with 4475 additions and 2636 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'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;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
|
||||
$scope.network = amazonService.getEnvironment();
|
||||
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
$scope.openExternalLink = function(url) {
|
||||
externalLinkService.open(url);
|
||||
};
|
||||
|
||||
var initAmazon = function() {
|
||||
|
|
@ -20,7 +20,9 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
$scope.$digest();
|
||||
});
|
||||
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)) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Card not found'));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -36,12 +36,14 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
throw ('bad params');
|
||||
}
|
||||
|
||||
glideraService.getLimits($scope.glideraAccessToken, function(err, limits) {
|
||||
$scope.limits = limits;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
if ($scope.isGlidera) {
|
||||
glideraService.getLimits($scope.glideraAccessToken, function(err, limits) {
|
||||
$scope.limits = limits;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var reNr = /^[1234567890\.]$/;
|
||||
var reOp = /^[\*\+\-\/]$/;
|
||||
|
|
@ -229,6 +231,20 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
return result.replace('x', '*');
|
||||
};
|
||||
|
||||
$scope.getRates = function() {
|
||||
bitpayCardService.getRates($scope.alternativeIsoCode, function(err, res) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
return;
|
||||
}
|
||||
if ($scope.unitName == 'bits') {
|
||||
$scope.exchangeRate = '1,000,000 bits ~ ' + res.rate + ' ' + $scope.alternativeIsoCode;
|
||||
} else {
|
||||
$scope.exchangeRate = '1 BTC ~ ' + res.rate + ' ' + $scope.alternativeIsoCode;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.finish = function() {
|
||||
var _amount = evaluate(format($scope.amount));
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
|
||||
var showBackupResult = function() {
|
||||
if ($scope.backupError) {
|
||||
var title = 'Uh oh...';
|
||||
var title = gettextCatalog.getString('Uh oh...');
|
||||
var message = gettextCatalog.getString("It's important that you write your backup phrase down correctly. If something happens to your wallet, you'll need this backup to recover your money. Please review your backup and try again.");
|
||||
popupService.showAlert(title, message, function() {
|
||||
$scope.setFlow(2);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, gettext, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, amazonService, glideraService, bwcError) {
|
||||
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, amazonService, glideraService, bwcError, bitpayCardService) {
|
||||
var cachedTxp = {};
|
||||
var toAmount;
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
|
|
@ -45,7 +45,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
};
|
||||
|
||||
var config = configService.getSync().wallet;
|
||||
$scope.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
|
||||
var feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
|
||||
$scope.feeLevel = feeService.feeOpts[feeLevel];
|
||||
if ($scope.isGlidera) $scope.network = glideraService.getEnvironment();
|
||||
else $scope.network = (new bitcore.Address($scope.toAddress)).network.name;
|
||||
resetValues();
|
||||
|
|
@ -55,8 +56,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
function setwallets() {
|
||||
$scope.wallets = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
network: $scope.network,
|
||||
n: $scope.isGiftCard ? true : false
|
||||
network: $scope.network
|
||||
});
|
||||
|
||||
if (!$scope.wallets || !$scope.wallets.length) {
|
||||
|
|
@ -70,6 +70,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
return;
|
||||
}
|
||||
|
||||
if ($scope.isGlidera == 'buy') {
|
||||
initConfirm();
|
||||
return;
|
||||
}
|
||||
|
||||
var filteredWallets = [];
|
||||
var index = 0;
|
||||
var enoughFunds = false;
|
||||
|
|
@ -346,7 +351,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
popupService.showAlert(gettextCatalog.getString('Error at confirm'), msg);
|
||||
popupService.showAlert(gettextCatalog.getString('Error at confirm'), bwcError.msg(msg));
|
||||
};
|
||||
|
||||
function apply(txp) {
|
||||
|
|
@ -368,13 +373,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
// ToDo: use a credential's (or fc's) function for this
|
||||
if (description && !wallet.credentials.sharedEncryptingKey) {
|
||||
var msg = 'Could not add message to imported wallet without shared encrypting key';
|
||||
var msg = gettextCatalog.getString('Could not add message to imported wallet without shared encrypting key');
|
||||
$log.warn(msg);
|
||||
return setSendError(msg);
|
||||
}
|
||||
|
||||
if (toAmount > Number.MAX_SAFE_INTEGER) {
|
||||
var msg = 'Amount too big';
|
||||
var msg = gettextCatalog.getString('Amount too big');
|
||||
$log.warn(msg);
|
||||
return setSendError(msg);
|
||||
}
|
||||
|
|
@ -824,4 +829,21 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getRates = function() {
|
||||
var config = configService.getSync().wallet.settings;
|
||||
var unitName = config.unitName;
|
||||
var alternativeIsoCode = config.alternativeIsoCode;
|
||||
bitpayCardService.getRates(alternativeIsoCode, function(err, res) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
return;
|
||||
}
|
||||
if (unitName == 'bits') {
|
||||
$scope.exchangeRate = '1,000,000 bits ~ ' + res.rate + ' ' + alternativeIsoCode;
|
||||
} else {
|
||||
$scope.exchangeRate = '1 BTC ~ ' + res.rate + ' ' + alternativeIsoCode;
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('createController',
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettext, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) {
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
|
@ -67,10 +67,10 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
function updateSeedSourceSelect(n) {
|
||||
var seedOptions = [{
|
||||
id: 'new',
|
||||
label: gettext('Random'),
|
||||
label: gettextCatalog.getString('Random'),
|
||||
}, {
|
||||
id: 'set',
|
||||
label: gettext('Specify Recovery Phrase...'),
|
||||
label: gettextCatalog.getString('Specify Recovery Phrase...'),
|
||||
}];
|
||||
|
||||
$scope.seedSource = seedOptions[0];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'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);
|
||||
var isAndroid = platformInfo.isAndroid;
|
||||
var isIOS = platformInfo.isIOS;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('joinController',
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) {
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -50,10 +50,10 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
var updateSeedSourceSelect = function() {
|
||||
self.seedOptions = [{
|
||||
id: 'new',
|
||||
label: gettext('Random'),
|
||||
label: gettextCatalog.getString('Random'),
|
||||
}, {
|
||||
id: 'set',
|
||||
label: gettext('Specify Recovery Phrase...'),
|
||||
label: gettextCatalog.getString('Specify Recovery Phrase...'),
|
||||
}];
|
||||
$scope.seedSource = self.seedOptions[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +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);
|
||||
$scope.openExternalLink = function(url) {
|
||||
externalLinkService.open(url);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
}
|
||||
}
|
||||
|
||||
var setError = function (err, prefix) {
|
||||
var setError = function(err, prefix) {
|
||||
$scope.sendStatus = '';
|
||||
$scope.loading = false;
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix));
|
||||
|
|
@ -164,9 +164,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
$scope.loading = true;
|
||||
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('broadcastTx', true);
|
||||
ongoingProcess.set('broadcastingTx', true);
|
||||
walletService.broadcastTx($scope.wallet, $scope.tx, function(err, txpb) {
|
||||
ongoingProcess.set('broadcastTx', false);
|
||||
ongoingProcess.set('broadcastingTx', false);
|
||||
|
||||
if (err) {
|
||||
return setError(err, gettextCatalog.getString('Could not broadcast payment'));
|
||||
|
|
@ -185,7 +185,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
$scope.wallet.getTx($scope.tx.id, function(err, tx) {
|
||||
if (err) {
|
||||
if (err.message && err.message == 'Transaction proposal not found' &&
|
||||
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
|
||||
(eventName == 'transactionProposalRemoved' || eventName == 'TxProposalRemoved')) {
|
||||
$scope.tx.removed = true;
|
||||
$scope.tx.canBeRemoved = false;
|
||||
$scope.tx.pendingForUs = false;
|
||||
|
|
@ -209,7 +209,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
});
|
||||
};
|
||||
|
||||
var bwsEvent = $rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||
var bwsEvent = $rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||
lodash.each([
|
||||
'TxProposalRejectedBy',
|
||||
'TxProposalAcceptedBy',
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'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.disclaimerUrl = $window.appConfig.disclaimerUrl;
|
||||
|
||||
$scope.confirm = function() {
|
||||
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);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 walletId = wallet.credentials.walletId;
|
||||
$scope.wallet = wallet;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,14 @@ angular.module('copayApp.controllers').controller('preferencesAbout',
|
|||
$scope.title = gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase;
|
||||
$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);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 walletId = wallet.credentials.walletId;
|
||||
var config = configService.getSync();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 completeAlternativeList;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'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);
|
||||
$scope.wallet = wallet;
|
||||
var walletId = wallet.credentials.walletId;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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.csvReady = false;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesLanguageController',
|
||||
function($scope, $log, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService, externalLinkService) {
|
||||
function($scope, $log, $ionicHistory, configService, profileService, uxLanguage, walletService, externalLinkService) {
|
||||
|
||||
$scope.availableLanguages = uxLanguage.getLanguages();
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$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. We’re 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);
|
||||
};
|
||||
|
||||
$scope.save = function(newLang) {
|
||||
|
|
@ -18,19 +24,18 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
|
|||
}
|
||||
};
|
||||
|
||||
uxLanguage._set(newLang);
|
||||
configService.set(opts, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
|
||||
$ionicHistory.goBack();
|
||||
uxLanguage.init(function() {
|
||||
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
|
||||
$log.debug('Remote preferences saved');
|
||||
});
|
||||
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
|
||||
$log.debug('Remote preferences saved');
|
||||
});
|
||||
});
|
||||
|
||||
$ionicHistory.goBack();
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesLogs',
|
||||
function($scope, historicLog, gettextCatalog) {
|
||||
function($scope, historicLog) {
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$scope.logs = historicLog.get();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, $rootScope) {
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $rootScope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) {
|
||||
|
||||
var originalList;
|
||||
var CONTACTS_SHOW_LIMIT;
|
||||
|
|
@ -128,6 +128,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
});
|
||||
}
|
||||
|
||||
$scope.checkingBalance = true;
|
||||
var index = 0;
|
||||
lodash.each(wallets, function(w) {
|
||||
walletService.getStatus(w, {}, function(err, status) {
|
||||
|
|
@ -143,6 +144,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
}
|
||||
|
||||
if (index == wallets.length) {
|
||||
$scope.checkingBalance = false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
'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 config = configService.getSync();
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isWP = platformInfo.isWP;
|
||||
var isWindowsPhoneApp = platformInfo.isWP && isCordova;
|
||||
|
|
@ -13,41 +11,53 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
$scope.isCordova = isCordova;
|
||||
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
|
||||
$scope.unitName = config.wallet.settings.unitName;
|
||||
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
|
||||
$scope.selectedAlternative = {
|
||||
name: config.wallet.settings.alternativeName,
|
||||
isoCode: config.wallet.settings.alternativeIsoCode
|
||||
};
|
||||
$scope.feeOpts = feeService.feeOpts;
|
||||
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
|
||||
|
||||
|
||||
$scope.wallets = profileService.getWallets();
|
||||
|
||||
configService.whenAvailable(function(config) {
|
||||
$scope.unitName = config.wallet.settings.unitName;
|
||||
$scope.selectedAlternative = {
|
||||
name: config.wallet.settings.alternativeName,
|
||||
isoCode: config.wallet.settings.alternativeIsoCode
|
||||
};
|
||||
|
||||
$scope.bitpayCardEnabled = config.bitpayCard.enabled;
|
||||
$scope.bitpayCardEnabled = config.bitpayCard.enabled;
|
||||
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
|
||||
|
||||
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
|
||||
if ($scope.bitpayCardEnabled) {
|
||||
bitpayCardService.getBitpayDebitCards(function(err, data) {
|
||||
if (err) $log.error(err);
|
||||
if (!lodash.isEmpty(data)) {
|
||||
$scope.bitpayCards = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($scope.glideraEnabled) {
|
||||
storageService.getGlideraToken(glideraService.getEnvironment(), function(err, token) {
|
||||
if (err) $log.error(err);
|
||||
$scope.glideraToken = token;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$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);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
updateConfig();
|
||||
|
||||
bitpayCardService.getBitpayDebitCards(function(err, data) {
|
||||
if (err) $log.error(err);
|
||||
if (!lodash.isEmpty(data)) {
|
||||
$scope.bitpayCards = true;
|
||||
}
|
||||
});
|
||||
|
||||
storageService.getGlideraToken(glideraService.getEnvironment(), function(err, token) {
|
||||
if (err) $log.error(err);
|
||||
$scope.glideraToken = token;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'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) {
|
||||
if (!incomingData.redir(data)) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('termOfUseController',
|
||||
function($scope, $window, uxLanguage, gettextCatalog, externalLinkService) {
|
||||
function($scope, $window, uxLanguage, externalLinkService) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('translatorsController',
|
||||
function($scope, externalLinkService) {
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
function($scope, externalLinkService, gettextCatalog) {
|
||||
$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. We’re 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);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -121,12 +121,11 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
$scope.viewOnBlockchain = function() {
|
||||
var btx = $scope.btx;
|
||||
var url = 'https://' + ($scope.getShortNetworkName() == 'test' ? 'test-' : '') + 'insight.bitpay.com/tx/' + btx.txid;
|
||||
var title = 'View Transaction on Insight';
|
||||
var message = 'Would you like to view this transaction on the Insight blockchain explorer?';
|
||||
$scope.openExternalLink(url, true, title, message, 'Open Insight', 'Go back');
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
var optIn = true;
|
||||
var title = gettextCatalog.getString('View Transaction on Insight');
|
||||
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');
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'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 currentTxHistoryPage = 0;
|
||||
|
|
@ -316,7 +316,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
var scrollWatcherInitialized;
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
setAndroidStatusBarColor();
|
||||
if ($scope.isCordova && $scope.isAndroid) setAndroidStatusBarColor();
|
||||
if (scrollWatcherInitialized || !$scope.amountIsCollapsible) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeLeave", function(event, data) {
|
||||
if($window.StatusBar) {
|
||||
if ($window.StatusBar) {
|
||||
$window.StatusBar.backgroundColorByHexString('#1e3186');
|
||||
}
|
||||
});
|
||||
|
|
@ -362,20 +362,18 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
|
||||
function setAndroidStatusBarColor() {
|
||||
var SUBTRACT_AMOUNT = 15;
|
||||
if(!$scope.isAndroid) {
|
||||
return;
|
||||
}
|
||||
var rgb = hexToRgb($scope.wallet.color);
|
||||
var keys = Object.keys(rgb);
|
||||
keys.forEach(function(k) {
|
||||
if(rgb[k] - SUBTRACT_AMOUNT < 0) {
|
||||
if (rgb[k] - SUBTRACT_AMOUNT < 0) {
|
||||
rgb[k] = 0;
|
||||
} else {
|
||||
rgb[k] -= SUBTRACT_AMOUNT;
|
||||
}
|
||||
});
|
||||
var statusBarColorHexString = rgbToHex(rgb.r, rgb.g, rgb.b);
|
||||
$window.StatusBar.backgroundColorByHexString(statusBarColorHexString);
|
||||
if ($window.StatusBar)
|
||||
$window.StatusBar.backgroundColorByHexString(statusBarColorHexString);
|
||||
}
|
||||
|
||||
function hexToRgb(hex) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue