commit
a8ed208ba7
76 changed files with 564 additions and 484 deletions
|
|
@ -3,12 +3,12 @@
|
|||
angular.module('copayApp.controllers').controller('activityController',
|
||||
function($timeout, $scope, $log, $ionicModal, lodash, txpModalService, profileService, walletService, ongoingProcess, popupService, gettextCatalog) {
|
||||
$scope.openTxpModal = txpModalService.open;
|
||||
$scope.fetchingNotifications = true;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.fetchingNotifications = true;
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
profileService.getNotifications(50, function(err, n) {
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
$log.error(err);
|
||||
return;
|
||||
}
|
||||
$scope.fetchingNotifications = false;
|
||||
|
|
@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('activityController',
|
|||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
$scope.openNotificationModal = function(n) {
|
||||
if (n.txid) {
|
||||
|
|
@ -33,8 +33,16 @@ angular.module('copayApp.controllers').controller('activityController',
|
|||
});
|
||||
if (txp) txpModalService.open(txp);
|
||||
else {
|
||||
$log.warn('No txp found');
|
||||
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
|
||||
ongoingProcess.set('loadingTxInfo', true);
|
||||
walletService.getTxp(n.wallet, n.txpId, function(err, txp) {
|
||||
var _txp = txp;
|
||||
ongoingProcess.set('loadingTxInfo', false);
|
||||
if (err) {
|
||||
$log.warn('No txp found');
|
||||
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
|
||||
}
|
||||
txpModalService.open(_txp);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -56,18 +64,18 @@ angular.module('copayApp.controllers').controller('activityController',
|
|||
return popupService.showAlert(null, gettextCatalog.getString('Transaction not found'));
|
||||
}
|
||||
|
||||
walletService.getTxNote(wallet, n.txid, function(err, note) {
|
||||
if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
|
||||
$scope.wallet = wallet;
|
||||
$scope.btx = lodash.cloneDeep(tx);
|
||||
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
|
||||
scope: $scope
|
||||
}).then(function(modal) {
|
||||
$scope.txDetailsModal = modal;
|
||||
$scope.txDetailsModal.show();
|
||||
});
|
||||
|
||||
$scope.wallet = wallet;
|
||||
$scope.btx = lodash.cloneDeep(tx);
|
||||
walletService.getTxNote(wallet, n.txid, function(err, note) {
|
||||
if (err) $log.debug('Could not fetch transaction note');
|
||||
$scope.btx.note = note;
|
||||
$ionicModal.fromTemplateUrl('views/modals/tx-details.html', {
|
||||
scope: $scope
|
||||
}).then(function(modal) {
|
||||
$scope.txDetailsModal = modal;
|
||||
$scope.txDetailsModal.show();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
|
|||
|
||||
var contacts;
|
||||
|
||||
$scope.initAddressbook = function() {
|
||||
var initAddressbook = function() {
|
||||
addressbookService.list(function(err, ab) {
|
||||
if (err) $log.error(err);
|
||||
|
||||
|
|
@ -47,10 +47,14 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
|
|||
popupService.showAlert(err);
|
||||
return;
|
||||
}
|
||||
$scope.initAddressbook();
|
||||
initAddressbook();
|
||||
$scope.$digest();
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
initAddressbook();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
this.init = function() {
|
||||
var self = this;
|
||||
var initAmazon = function() {
|
||||
$scope.network = amazonService.getEnvironment();
|
||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||
if (err) {
|
||||
|
|
@ -20,11 +19,10 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
$scope.$digest();
|
||||
});
|
||||
});
|
||||
this.updatePendingGiftCards();
|
||||
}
|
||||
$scope.updatePendingGiftCards();
|
||||
};
|
||||
|
||||
this.updatePendingGiftCards = lodash.debounce(function() {
|
||||
var self = this;
|
||||
$scope.updatePendingGiftCards = lodash.debounce(function() {
|
||||
|
||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||
lodash.forEach(gcds, function(dataFromStorage) {
|
||||
|
|
@ -69,8 +67,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
|
||||
}, 1000);
|
||||
|
||||
this.openCardModal = function(card) {
|
||||
var self = this;
|
||||
$scope.openCardModal = function(card) {
|
||||
$scope.card = card;
|
||||
|
||||
$ionicModal.fromTemplateUrl('views/modals/amazon-card-details.html', {
|
||||
|
|
@ -81,7 +78,11 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
});
|
||||
|
||||
$scope.$on('UpdateAmazonList', function(event) {
|
||||
self.init();
|
||||
initAmazon();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
initAmazon();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amountController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, $ionicNavBarDelegate, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Enter Amount'));
|
||||
angular.module('copayApp.controllers').controller('amountController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService) {
|
||||
|
||||
var unitToSatoshi;
|
||||
var satToUnit;
|
||||
|
|
@ -11,7 +10,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
var SMALL_FONT_SIZE_LIMIT = 13;
|
||||
var LENGTH_EXPRESSION_LIMIT = 19;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
|
||||
if (!$stateParams.toAddress) {
|
||||
$log.error('Bad params at amount')
|
||||
|
|
@ -73,7 +72,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$timeout(function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
}, 100);
|
||||
};
|
||||
});
|
||||
|
||||
$scope.toggleAlternative = function() {
|
||||
$scope.showAlternativeAmount = !$scope.showAlternativeAmount;
|
||||
|
|
|
|||
|
|
@ -16,25 +16,6 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
return false;
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.deleted = isDeletedSeed();
|
||||
if ($scope.deleted) {
|
||||
$log.debug('no mnemonics');
|
||||
return;
|
||||
}
|
||||
|
||||
walletService.getKeys(wallet, function(err, k) {
|
||||
if (err || !k) {
|
||||
$log.error('Could not get keys: ', err);
|
||||
$state.go('wallet.preferences');
|
||||
return;
|
||||
}
|
||||
$scope.credentialsEncrypted = false;
|
||||
keys = k;
|
||||
$scope.initFlow();
|
||||
});
|
||||
};
|
||||
|
||||
var shuffledWords = function(words) {
|
||||
var sort = lodash.sortBy(words);
|
||||
|
||||
|
|
@ -222,4 +203,23 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.deleted = isDeletedSeed();
|
||||
if ($scope.deleted) {
|
||||
$log.debug('no mnemonics');
|
||||
return;
|
||||
}
|
||||
|
||||
walletService.getKeys(wallet, function(err, k) {
|
||||
if (err || !k) {
|
||||
$log.error('Could not get keys: ', err);
|
||||
$state.go('wallet.preferences');
|
||||
return;
|
||||
}
|
||||
$scope.credentialsEncrypted = false;
|
||||
keys = k;
|
||||
$scope.initFlow();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,14 +19,6 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
this.init = function() {
|
||||
var network = amazonService.getEnvironment();
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: network,
|
||||
onlyComplete: true
|
||||
});
|
||||
};
|
||||
|
||||
this.confirm = function() {
|
||||
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {amount: $scope.fiat});
|
||||
var ok = gettextCatalog.getString('Buy');
|
||||
|
|
@ -216,4 +208,12 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
var network = amazonService.getEnvironment();
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: network,
|
||||
onlyComplete: true
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,36 +17,6 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
$log.debug('Wallet changed: ' + w.name);
|
||||
});
|
||||
|
||||
$scope.init = function(accessToken) {
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = accessToken;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
$scope.txs = null;
|
||||
$scope.status = null;
|
||||
$scope.limits = null;
|
||||
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.init($scope.token, function(err, glidera) {
|
||||
ongoingProcess.set('connectingGlidera');
|
||||
if (err || !glidera) {
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({fullUpdate: true});
|
||||
});
|
||||
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: $scope.network,
|
||||
n: 1,
|
||||
onlyComplete: true
|
||||
});
|
||||
};
|
||||
|
||||
$scope.update = function(opts) {
|
||||
if (!$scope.token || !$scope.permissions) return;
|
||||
$log.debug('Updating Glidera Account...');
|
||||
|
|
@ -145,4 +115,34 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
}, 100);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = accessToken;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
$scope.txs = null;
|
||||
$scope.status = null;
|
||||
$scope.limits = null;
|
||||
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.init($scope.token, function(err, glidera) {
|
||||
ongoingProcess.set('connectingGlidera');
|
||||
if (err || !glidera) {
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({fullUpdate: true});
|
||||
});
|
||||
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: $scope.network,
|
||||
n: 1,
|
||||
onlyComplete: true
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
var cachedTxp = {};
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
|
||||
$scope.init = function() {
|
||||
var initConfirm = function() {
|
||||
if ($stateParams.paypro) {
|
||||
return setFromPayPro($stateParams.paypro, function(err) {
|
||||
if (err && !isChromeApp) {
|
||||
|
|
@ -145,7 +145,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$stateParams.paypro = null;
|
||||
|
||||
$scope._paypro = paypro;
|
||||
return $scope.init();
|
||||
return initConfirm();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -307,4 +307,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$scope.cancel = function() {
|
||||
$state.go('tabs.send');
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
initConfirm();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
function($scope, $timeout, $log, $ionicHistory, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
|
||||
$scope.init = function() {
|
||||
var init = function() {
|
||||
$scope.formData = {};
|
||||
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
|
|
@ -158,4 +158,8 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
init();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.init = function(accessToken) {
|
||||
var initGlidera = function(accessToken) {
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = null;
|
||||
|
|
@ -78,7 +78,7 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
} else if (data && data.access_token) {
|
||||
storageService.setGlideraToken($scope.network, data.access_token, function() {
|
||||
$scope.init(data.access_token);
|
||||
initGlidera(data.access_token);
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
|
|
@ -113,4 +113,8 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
initGlidera();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ angular.module('copayApp.controllers').controller('glideraUriController',
|
|||
}, 100);
|
||||
};
|
||||
|
||||
$scope.checkCode = function() {
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
if ($stateParams.url) {
|
||||
var match = $stateParams.url.match(/code=(.+)/);
|
||||
if (match && match[1]) {
|
||||
|
|
@ -32,5 +32,5 @@ angular.module('copayApp.controllers').controller('glideraUriController',
|
|||
}
|
||||
}
|
||||
$log.error('Bad state: ' + JSON.stringify($stateParams));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,24 +1,5 @@
|
|||
angular.module('copayApp.controllers').controller('paperWalletController',
|
||||
function($scope, $timeout, $log, $ionicModal, $ionicHistory, popupService, gettextCatalog, platformInfo, configService, profileService, $state, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var rawTx;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.wallet = wallet;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.needsBackup = wallet.needsBackup;
|
||||
$scope.walletAlias = wallet.name;
|
||||
$scope.walletName = wallet.credentials.walletName;
|
||||
$scope.formData = {};
|
||||
$scope.formData.inputData = null;
|
||||
$scope.scannedKey = null;
|
||||
$scope.balance = null;
|
||||
$scope.balanceSat = null;
|
||||
$scope.scanned = false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 10);
|
||||
};
|
||||
|
||||
$scope.onQrCodeScanned = function(data) {
|
||||
$scope.formData.inputData = data;
|
||||
|
|
@ -138,4 +119,22 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
|||
$scope.txStatusModal.show();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.wallet = wallet;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.needsBackup = wallet.needsBackup;
|
||||
$scope.walletAlias = wallet.name;
|
||||
$scope.walletName = wallet.credentials.walletName;
|
||||
$scope.formData = {};
|
||||
$scope.formData.inputData = null;
|
||||
$scope.scannedKey = null;
|
||||
$scope.balance = null;
|
||||
$scope.balanceSat = null;
|
||||
$scope.scanned = false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,33 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesController',
|
||||
function($scope, $rootScope, $timeout, $log, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService, fingerprintService, walletService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Preferences'));
|
||||
function($scope, $rootScope, $timeout, $log, $stateParams, $ionicHistory, gettextCatalog, configService, profileService, fingerprintService, walletService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.credentials.walletId;
|
||||
$scope.wallet = wallet;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.externalSource = null;
|
||||
|
||||
if (!wallet)
|
||||
return $ionicHistory.goBack();
|
||||
|
||||
var config = configService.getSync();
|
||||
|
||||
$scope.encryptEnabled = walletService.isEncrypted(wallet);
|
||||
if (wallet.isPrivKeyExternal)
|
||||
$scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
|
||||
|
||||
$scope.touchIdAvailable = fingerprintService.isAvailable();
|
||||
$scope.touchIdEnabled = config.touchIdFor ? config.touchIdFor[walletId] : null;
|
||||
|
||||
$scope.deleted = false;
|
||||
if (wallet.credentials && !wallet.credentials.mnemonicEncrypted && !wallet.credentials.mnemonic) {
|
||||
$scope.deleted = true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.encryptChange = function() {
|
||||
if (!wallet) return;
|
||||
var val = $scope.encryptEnabled;
|
||||
|
|
@ -77,4 +55,25 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
$log.debug('Touch Id status changed: ' + newStatus);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$scope.externalSource = null;
|
||||
|
||||
if (!wallet)
|
||||
return $ionicHistory.goBack();
|
||||
|
||||
var config = configService.getSync();
|
||||
|
||||
$scope.encryptEnabled = walletService.isEncrypted(wallet);
|
||||
if (wallet.isPrivKeyExternal)
|
||||
$scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor';
|
||||
|
||||
$scope.touchIdAvailable = fingerprintService.isAvailable();
|
||||
$scope.touchIdEnabled = config.touchIdFor ? config.touchIdFor[walletId] : null;
|
||||
|
||||
$scope.deleted = false;
|
||||
if (wallet.credentials && !wallet.credentials.mnemonicEncrypted && !wallet.credentials.mnemonic) {
|
||||
$scope.deleted = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('preferencesAbout',
|
||||
function($scope, $window, $ionicNavBarDelegate, gettextCatalog, externalLinkService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase);
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase);
|
||||
});
|
||||
|
||||
$scope.version = $window.version;
|
||||
$scope.commitHash = $window.commitHash;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesAliasController',
|
||||
function($scope, $timeout, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService, walletService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Alias'));
|
||||
function($scope, $timeout, $stateParams, $ionicHistory, gettextCatalog, configService, profileService, walletService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.wallet = wallet;
|
||||
var walletId = wallet.credentials.walletId;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
|
||||
function($scope, $log, $timeout, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, rateService, lodash, profileService, walletService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Alternative Currency'));
|
||||
function($scope, $log, $timeout, $ionicHistory, gettextCatalog, configService, rateService, lodash, profileService, walletService) {
|
||||
|
||||
var next = 10;
|
||||
var completeAlternativeList;
|
||||
|
||||
$scope.init = function() {
|
||||
var config = configService.getSync();
|
||||
$scope.currentCurrency = config.wallet.settings.alternativeIsoCode;
|
||||
$scope.listComplete = false;
|
||||
|
||||
var config = configService.getSync();
|
||||
$scope.currentCurrency = config.wallet.settings.alternativeIsoCode;
|
||||
$scope.listComplete = false;
|
||||
|
||||
rateService.whenAvailable(function() {
|
||||
completeAlternativeList = rateService.listAlternatives();
|
||||
lodash.remove(completeAlternativeList, function(c) {
|
||||
return c.isoCode == 'BTC';
|
||||
});
|
||||
$scope.altCurrencyList = completeAlternativeList.slice(0, next);
|
||||
rateService.whenAvailable(function() {
|
||||
completeAlternativeList = rateService.listAlternatives();
|
||||
lodash.remove(completeAlternativeList, function(c) {
|
||||
return c.isoCode == 'BTC';
|
||||
});
|
||||
};
|
||||
$scope.altCurrencyList = completeAlternativeList.slice(0, next);
|
||||
});
|
||||
|
||||
$scope.loadMore = function() {
|
||||
$timeout(function() {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
|
||||
function($scope, $log, $stateParams, $ionicNavBarDelegate, configService, applicationService, profileService, storageService) {
|
||||
$ionicNavBarDelegate.title('Wallet Service URL');
|
||||
function($scope, $log, $stateParams, configService, applicationService, profileService, storageService) {
|
||||
$scope.success = null;
|
||||
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Color'));
|
||||
angular.module('copayApp.controllers').controller('preferencesColorController', function($scope, $log, $stateParams, $ionicHistory, gettextCatalog, configService, profileService) {
|
||||
$scope.colorList = [
|
||||
'#DD4B39',
|
||||
'#F38F12',
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
|
||||
function($scope, $stateParams, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete'));
|
||||
function($scope, $stateParams, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
|
||||
$scope.walletName = '[' + wallet.credentials.walletName + ']';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, confirmDialog, lodash, profileService, gettext) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete recovery phrase'));
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $ionicHistory, $stateParams, gettextCatalog, confirmDialog, lodash, profileService, gettext) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var msg = gettext('Are you sure you want to delete the recovery phrase?');
|
||||
var successMsg = gettext('Recovery phrase deleted');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, profileService, walletService, configService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Email Notifications'));
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, gettextCatalog, profileService, walletService, configService) {
|
||||
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.credentials.walletId;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, feeService, ongoingProcess) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Bitcoin Network Fee Policy'));
|
||||
angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, $ionicHistory, gettextCatalog, configService, feeService, ongoingProcess) {
|
||||
|
||||
$scope.init = function() {
|
||||
ongoingProcess.set('gettingFeeLevels', true);
|
||||
feeService.getFeeLevels(function(levels) {
|
||||
ongoingProcess.set('gettingFeeLevels', false);
|
||||
$scope.feeOpts = feeService.feeOpts;
|
||||
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
|
||||
$scope.feeLevels = levels;
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
ongoingProcess.set('gettingFeeLevels', true);
|
||||
feeService.getFeeLevels(function(levels) {
|
||||
ongoingProcess.set('gettingFeeLevels', false);
|
||||
$scope.feeLevels = levels;
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
$scope.save = function(newFee) {
|
||||
var opts = {
|
||||
|
|
@ -32,4 +27,9 @@ angular.module('copayApp.controllers').controller('preferencesFeeController', fu
|
|||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.feeOpts = feeService.feeOpts;
|
||||
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,32 +3,6 @@
|
|||
angular.module('copayApp.controllers').controller('preferencesGlideraController',
|
||||
function($scope, $log, $timeout, $state, ongoingProcess, glideraService, popupService, gettextCatalog) {
|
||||
|
||||
$scope.init = function(accessToken) {
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = accessToken;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
$scope.txs = null;
|
||||
$scope.status = null;
|
||||
$scope.limits = null;
|
||||
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.init($scope.token, function(err, glidera) {
|
||||
ongoingProcess.set('connectingGlidera');
|
||||
if (err || !glidera) {
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({
|
||||
fullUpdate: true
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.update = function(opts) {
|
||||
if (!$scope.token || !$scope.permissions) return;
|
||||
$log.debug('Updating Glidera Account...');
|
||||
|
|
@ -75,4 +49,30 @@ angular.module('copayApp.controllers').controller('preferencesGlideraController'
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = accessToken;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
$scope.txs = null;
|
||||
$scope.status = null;
|
||||
$scope.limits = null;
|
||||
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.init($scope.token, function(err, glidera) {
|
||||
ongoingProcess.set('connectingGlidera');
|
||||
if (err || !glidera) {
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({
|
||||
fullUpdate: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesHistory',
|
||||
function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, storageService, platformInfo, profileService, lodash) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Transaction History'));
|
||||
function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, gettextCatalog, storageService, platformInfo, profileService, lodash) {
|
||||
$scope.wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.csvReady = false;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
|
|
@ -131,4 +130,8 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
|
|||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.csvHistory();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesInformation',
|
||||
function($scope, $log, $timeout, $ionicNavBarDelegate, $ionicHistory, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Information'));
|
||||
function($scope, $log, $timeout, $ionicHistory, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) {
|
||||
var base = 'xpub';
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.id;
|
||||
|
|
@ -12,45 +11,6 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
|
|||
$scope.isCordova = platformInfo.isCordova;
|
||||
config.colorFor = config.colorFor || {};
|
||||
|
||||
$scope.init = function() {
|
||||
var c = wallet.credentials;
|
||||
var basePath = c.getBaseAddressDerivationPath();
|
||||
|
||||
$scope.wallet = wallet;
|
||||
$scope.walletName = c.walletName;
|
||||
$scope.walletId = c.walletId;
|
||||
$scope.network = c.network;
|
||||
$scope.addressType = c.addressType || 'P2SH';
|
||||
$scope.derivationStrategy = c.derivationStrategy || 'BIP45';
|
||||
$scope.basePath = basePath;
|
||||
$scope.M = c.m;
|
||||
$scope.N = c.n;
|
||||
$scope.pubKeys = lodash.pluck(c.publicKeyRing, 'xPubKey');
|
||||
$scope.addrs = null;
|
||||
|
||||
wallet.getMainAddresses({
|
||||
doNotVerify: true
|
||||
}, function(err, addrs) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
return;
|
||||
};
|
||||
var last10 = [],
|
||||
i = 0,
|
||||
e = addrs.pop();
|
||||
while (i++ < 10 && e) {
|
||||
e.path = base + e.path.substring(1);
|
||||
last10.push(e);
|
||||
e = addrs.pop();
|
||||
}
|
||||
$scope.addrs = last10;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$scope.sendAddrs = function() {
|
||||
function formatDate(ts) {
|
||||
var dateObj = new Date(ts * 1000);
|
||||
|
|
@ -121,6 +81,43 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
|
|||
$state.go('tabs.home');
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
var c = wallet.credentials;
|
||||
var basePath = c.getBaseAddressDerivationPath();
|
||||
|
||||
$scope.wallet = wallet;
|
||||
$scope.walletName = c.walletName;
|
||||
$scope.walletId = c.walletId;
|
||||
$scope.network = c.network;
|
||||
$scope.addressType = c.addressType || 'P2SH';
|
||||
$scope.derivationStrategy = c.derivationStrategy || 'BIP45';
|
||||
$scope.basePath = basePath;
|
||||
$scope.M = c.m;
|
||||
$scope.N = c.n;
|
||||
$scope.pubKeys = lodash.pluck(c.publicKeyRing, 'xPubKey');
|
||||
$scope.addrs = null;
|
||||
|
||||
wallet.getMainAddresses({
|
||||
doNotVerify: true
|
||||
}, function(err, addrs) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
return;
|
||||
};
|
||||
var last10 = [],
|
||||
i = 0,
|
||||
e = addrs.pop();
|
||||
while (i++ < 10 && e) {
|
||||
e.path = base + e.path.substring(1);
|
||||
last10.push(e);
|
||||
e = addrs.pop();
|
||||
}
|
||||
$scope.addrs = last10;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesLanguageController',
|
||||
function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService, externalLinkService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Language'));
|
||||
function($scope, $log, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService, externalLinkService) {
|
||||
|
||||
$scope.availableLanguages = uxLanguage.getLanguages();
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.availableLanguages = uxLanguage.getLanguages();
|
||||
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
|
||||
}
|
||||
|
||||
$scope.save = function(newLang) {
|
||||
var opts = {
|
||||
wallet: {
|
||||
|
|
@ -33,4 +29,8 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesLogs',
|
||||
function($scope, historicLog, $ionicNavBarDelegate, gettextCatalog) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Session Log'));
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.logs = historicLog.get();
|
||||
}
|
||||
function($scope, historicLog, gettextCatalog) {
|
||||
|
||||
$scope.prepare = function() {
|
||||
var log = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n';
|
||||
|
|
@ -32,4 +27,8 @@ angular.module('copayApp.controllers').controller('preferencesLogs',
|
|||
function() {}
|
||||
);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.logs = historicLog.get();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesUnitController', function($scope, $log, configService, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, walletService, profileService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Unit'));
|
||||
|
||||
$scope.init = function() {
|
||||
var config = configService.getSync();
|
||||
$scope.currentUnit = config.wallet.settings.unitCode;
|
||||
}
|
||||
angular.module('copayApp.controllers').controller('preferencesUnitController', function($scope, $log, configService, $ionicHistory, gettextCatalog, walletService, profileService) {
|
||||
|
||||
var config = configService.getSync();
|
||||
$scope.unitList = [{
|
||||
name: 'bits (1,000,000 bits = 1BTC)',
|
||||
shortName: 'bits',
|
||||
|
|
@ -43,4 +38,8 @@ angular.module('copayApp.controllers').controller('preferencesUnitController', f
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.currentUnit = config.wallet.settings.unitCode;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('proposalsController',
|
||||
function($timeout, $scope, profileService, $log, txpModalService) {
|
||||
var self = this;
|
||||
|
||||
$scope.fetchingProposals = true;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
profileService.getTxps(50, function(err, txps) {
|
||||
$scope.fetchingProposals = false;
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
$log.error(err);
|
||||
return;
|
||||
}
|
||||
$scope.txps = txps;
|
||||
|
|
@ -17,7 +18,7 @@ angular.module('copayApp.controllers').controller('proposalsController',
|
|||
$scope.$apply();
|
||||
}, 1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$scope.openTxpModal = txpModalService.open;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,36 +18,6 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
$log.debug('Wallet changed: ' + w.name);
|
||||
});
|
||||
|
||||
$scope.init = function(accessToken) {
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = accessToken;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
$scope.txs = null;
|
||||
$scope.status = null;
|
||||
$scope.limits = null;
|
||||
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.init($scope.token, function(err, glidera) {
|
||||
ongoingProcess.set('connectingGlidera');
|
||||
if (err || !glidera) {
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({fullUpdate: true});
|
||||
});
|
||||
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: $scope.network,
|
||||
n: 1,
|
||||
onlyComplete: true
|
||||
});
|
||||
};
|
||||
|
||||
$scope.update = function(opts) {
|
||||
if (!$scope.token || !$scope.permissions) return;
|
||||
$log.debug('Updating Glidera Account...');
|
||||
|
|
@ -217,4 +187,34 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = accessToken;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
$scope.txs = null;
|
||||
$scope.status = null;
|
||||
$scope.limits = null;
|
||||
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
glideraService.init($scope.token, function(err, glidera) {
|
||||
ongoingProcess.set('connectingGlidera');
|
||||
if (err || !glidera) {
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({fullUpdate: true});
|
||||
});
|
||||
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: $scope.network,
|
||||
n: 1,
|
||||
onlyComplete: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,14 +8,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
$scope.openTxpModal = txpModalService.open;
|
||||
$scope.version = $window.version;
|
||||
$scope.name = $window.appConfig.nameCase;
|
||||
|
||||
$scope.homeTip = $stateParams.fromOnboarding;
|
||||
configService.whenAvailable(function() {
|
||||
var config = configService.getSync();
|
||||
var isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
|
||||
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
|
||||
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
|
||||
});
|
||||
|
||||
$scope.openNotificationModal = function(n) {
|
||||
wallet = profileService.getWallet(n.walletId);
|
||||
|
|
@ -115,7 +108,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
lodash.each($scope.wallets, function(wallet) {
|
||||
walletService.getStatus(wallet, {}, function(err, status) {
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
$log.error(err);
|
||||
} else {
|
||||
wallet.status = status;
|
||||
}
|
||||
|
|
@ -172,7 +165,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
$scope.hideHomeTip = function() {
|
||||
$scope.homeTip = null;
|
||||
$state.transitionTo($state.current, null, {
|
||||
reload: false,
|
||||
reload: true,
|
||||
inherit: false,
|
||||
notify: false
|
||||
});
|
||||
|
|
@ -204,4 +197,15 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
x();
|
||||
});
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
configService.whenAvailable(function() {
|
||||
var config = configService.getSync();
|
||||
var isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
|
||||
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
|
||||
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
|
||||
});
|
||||
$scope.nextStep();
|
||||
$scope.updateAllWallets();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,15 +3,11 @@
|
|||
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, $ionicModal, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService) {
|
||||
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.wallets = profileService.getWallets({
|
||||
onlyComplete: true
|
||||
});
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
if (!$scope.isCordova) $scope.checkTips();
|
||||
}
|
||||
$scope.wallets = profileService.getWallets({
|
||||
onlyComplete: true
|
||||
});
|
||||
|
||||
$scope.checkTips = function(force) {
|
||||
storageService.getReceiveTipsAccepted(function(err, accepted) {
|
||||
|
|
@ -36,7 +32,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
}
|
||||
$scope.wallet = wallet;
|
||||
$log.debug('Wallet changed: ' + wallet.name);
|
||||
$scope.setAddress(wallet);
|
||||
$scope.setAddress();
|
||||
});
|
||||
|
||||
$scope.shareAddress = function(addr) {
|
||||
|
|
@ -46,25 +42,24 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
}
|
||||
};
|
||||
|
||||
$scope.setAddress = function(wallet, forceNew) {
|
||||
$scope.setAddress = function(forceNew) {
|
||||
if ($scope.generatingAddress) return;
|
||||
|
||||
var wallet = wallet || $scope.wallet;
|
||||
$scope.addr = null;
|
||||
$scope.generatingAddress = true;
|
||||
|
||||
$timeout(function() {
|
||||
walletService.getAddress(wallet, forceNew, function(err, addr) {
|
||||
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
|
||||
$scope.generatingAddress = false;
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
} else {
|
||||
if (addr)
|
||||
$scope.addr = addr;
|
||||
if (err || lodash.isEmpty(addr)) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err || gettextCatalog.getString('Address is empty'));
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.addr = addr;
|
||||
$scope.$apply();
|
||||
});
|
||||
}, 1);
|
||||
};
|
||||
|
||||
if (!$scope.isCordova) $scope.checkTips();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
|
||||
var originalList;
|
||||
|
||||
$scope.init = function() {
|
||||
var updateList = function() {
|
||||
originalList = [];
|
||||
|
||||
var wallets = profileService.getWallets({
|
||||
|
|
@ -83,8 +83,8 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on('modal.hidden', function() {
|
||||
$scope.init();
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
updateList();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
|
||||
|
||||
$scope.init = function() {
|
||||
var updateConfig = function() {
|
||||
|
||||
var config = configService.getSync();
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
|
@ -28,10 +28,10 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
$scope.$digest();
|
||||
});
|
||||
}
|
||||
$scope.spendUnconfirmed = config.wallet.spendUnconfirmed;
|
||||
$scope.glideraEnabled = config.glidera.enabled;
|
||||
$scope.spendUnconfirmed = {value : config.wallet.spendUnconfirmed};
|
||||
$scope.glideraEnabled = {value: config.glidera.enabled};
|
||||
$scope.coinbaseEnabled = config.coinbase.enabled;
|
||||
$scope.pushNotifications = config.pushNotifications.enabled;
|
||||
$scope.pushNotifications = {value: config.pushNotifications.enabled};
|
||||
$scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) {
|
||||
return w.id != self.walletId;
|
||||
});
|
||||
|
|
@ -44,12 +44,12 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
}, function(err) {
|
||||
$log.debug(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.spendUnconfirmedChange = function() {
|
||||
var opts = {
|
||||
wallet: {
|
||||
spendUnconfirmed: $scope.spendUnconfirmed
|
||||
spendUnconfirmed: $scope.spendUnconfirmed.value
|
||||
}
|
||||
};
|
||||
configService.set(opts, function(err) {
|
||||
|
|
@ -60,7 +60,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
$scope.pushNotificationsChange = function() {
|
||||
var opts = {
|
||||
pushNotifications: {
|
||||
enabled: $scope.pushNotifications
|
||||
enabled: $scope.pushNotifications.value
|
||||
}
|
||||
};
|
||||
configService.set(opts, function(err) {
|
||||
|
|
@ -75,7 +75,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
$scope.glideraChange = function() {
|
||||
var opts = {
|
||||
glidera: {
|
||||
enabled: $scope.glideraEnabled
|
||||
enabled: $scope.glideraEnabled.value
|
||||
}
|
||||
};
|
||||
configService.set(opts, function(err) {
|
||||
|
|
@ -94,4 +94,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
updateConfig();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('termOfUseController',
|
||||
function($scope, $window, uxLanguage, $ionicNavBarDelegate, gettextCatalog, externalLinkService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Terms Of Use'));
|
||||
function($scope, $window, uxLanguage, gettextCatalog, externalLinkService) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,49 +15,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
externalLinkService.open(url, target);
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
currentTxHistoryPage = 0;
|
||||
$scope.completeTxHistory = [];
|
||||
|
||||
wallet = profileService.getWallet($stateParams.walletId);
|
||||
|
||||
/* Set color for header bar */
|
||||
$rootScope.walletDetailsColor = wallet.color;
|
||||
$rootScope.walletDetailsName = wallet.name;
|
||||
$scope.wallet = wallet;
|
||||
|
||||
$scope.requiresMultipleSignatures = wallet.credentials.m > 1;
|
||||
$scope.newTx = false;
|
||||
|
||||
$ionicNavBarDelegate.title(wallet.name);
|
||||
|
||||
$scope.updateAll(function() {
|
||||
if ($stateParams.txid) {
|
||||
var tx = lodash.find($scope.completeTxHistory, {
|
||||
txid: $stateParams.txid
|
||||
});
|
||||
if (tx) {
|
||||
$scope.openTxModal(tx);
|
||||
} else {
|
||||
$ionicPopup.alert({
|
||||
title: gettext('TX not available'),
|
||||
});
|
||||
}
|
||||
} else if ($stateParams.txpId) {
|
||||
var txp = lodash.find($scope.txps, {
|
||||
id: $stateParams.txpId
|
||||
});
|
||||
if (txp) {
|
||||
$scope.openTxpModal(txp);
|
||||
} else {
|
||||
$ionicPopup.alert({
|
||||
title: gettext('Proposal not longer available'),
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var setPendingTxps = function(txps) {
|
||||
|
||||
/* Uncomment to test multiple outputs */
|
||||
|
|
@ -232,11 +189,54 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
$scope.updateAll = function(cb) {
|
||||
$scope.updateStatus(false);
|
||||
$scope.updateTxHistory(cb);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.hideToggle = function() {
|
||||
profileService.toggleHideBalanceFlag(wallet.credentials.walletId, function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
currentTxHistoryPage = 0;
|
||||
$scope.completeTxHistory = [];
|
||||
|
||||
wallet = profileService.getWallet($stateParams.walletId);
|
||||
|
||||
/* Set color for header bar */
|
||||
$rootScope.walletDetailsColor = wallet.color;
|
||||
$rootScope.walletDetailsName = wallet.name;
|
||||
$scope.wallet = wallet;
|
||||
|
||||
$scope.requiresMultipleSignatures = wallet.credentials.m > 1;
|
||||
$scope.newTx = false;
|
||||
|
||||
$ionicNavBarDelegate.title(wallet.name);
|
||||
|
||||
$scope.updateAll(function() {
|
||||
if ($stateParams.txid) {
|
||||
var tx = lodash.find($scope.completeTxHistory, {
|
||||
txid: $stateParams.txid
|
||||
});
|
||||
if (tx) {
|
||||
$scope.openTxModal(tx);
|
||||
} else {
|
||||
$ionicPopup.alert({
|
||||
title: gettext('TX not available'),
|
||||
});
|
||||
}
|
||||
} else if ($stateParams.txpId) {
|
||||
var txp = lodash.find($scope.txps, {
|
||||
id: $stateParams.txpId
|
||||
});
|
||||
if (txp) {
|
||||
$scope.openTxpModal(txp);
|
||||
} else {
|
||||
$ionicPopup.alert({
|
||||
title: gettext('Proposal not longer available'),
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue