Adds cache for preferences, walletDetails

This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-22 11:55:23 -03:00
commit ca292813eb
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
44 changed files with 271 additions and 241 deletions

View file

@ -5,7 +5,7 @@
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="paperWalletController" ng-init="init()">
<ion-content>
<div class="row" ng-show="needsBackup">
<div class="columns">
<h4></h4>

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Wallet Preferences'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesController" ng-init="init()">
<ion-content>
<div class="list">
<div class="item item-divider"></div>
<a class="item item-icon-right" ui-sref="tabs.preferences.preferencesAlias">

View file

@ -3,7 +3,7 @@
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesAbout">
<ion-content>
<div class="list">
<div class="item item-divider" translate>
Release information

View file

@ -4,7 +4,7 @@
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesAdvancedController">
<ion-content>
<div class="list">
<div class="item item-divider">
</div>

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Alias'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesAliasController" >
<ion-content>
<form name="aliasForm" ng-submit="save(aliasForm)" novalidate>
<div class="card list">
<label class="item item-input item-stacked-label">

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Alternative Currency'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesAltCurrencyController" ng-init="init()" >
<ion-content>
<ion-radio ng-repeat="altCurrency in altCurrencyList" ng-value="altCurrency.isoCode" ng-model="currentCurrency"
ng-click="save(altCurrency)">{{altCurrency.name}}
</ion-radio>

View file

@ -1,9 +1,10 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>Wallet Service URL</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesBwsUrlController">
<ion-content>
<div class="card list">
<label class="item item-input item-stacked-label no-border">

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Alias'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesColorController" >
<ion-content>
<ion-radio ng-repeat="c in colorList" ng-value="c" ng-model="currentColor" ng-click="save(c)">
<span ng-style="{'color': c}">&block;</span>
</ion-radio>

View file

@ -1,9 +1,10 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Delete Wallet' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesDeleteWalletController" >
<ion-content>
<div class="card">
<h1 class="text-center" translate>Warning!</h2>
<div class="assertive padding" translate>Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED</div>

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Delete recovery phrase'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesDeleteWordsController" >
<ion-content>
<div ng-show="!deleted">
<div ng-show="error">
{{error|translate}}

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Email Notifications'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesEmailController" >
<ion-content>
<form name="emailForm" ng-submit="save(emailForm)" novalidate>
<div class="card list">
<label class="item item-input item-stacked-label">

View file

@ -1,10 +1,13 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Bitcoin Network Fee Policy'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesFeeController" ng-init="init()">
<ion-content>
<ion-radio ng-repeat="fee in feeLevels.livenet" ng-value="fee.level" ng-model="currentFeeLevel" ng-click="save(fee)">
{{feeOpts[fee.level]|translate}}
</ion-radio>

View file

@ -5,7 +5,7 @@
<ion-nav-title>Preferences</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="preferencesGlideraController" ng-init="init()">
<ion-content>
<ul class="list">
<div ng-if="token">

View file

@ -1,9 +1,10 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Transaction History' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesHistory" ng-init="csvHistory()">
<ion-content>
<div class="item item-divider"></div>
<div class="item" ng-show="csvReady && !isCordova" ng-csv="csvContent" csv-header="csvHeader" filename="Copay-{{wallet.name}}.csv">
<span translate>Export to file</span>

View file

@ -1,9 +1,10 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Wallet Information' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesInformation" ng-init="init()">
<ion-content>
<div class="list">
<div class="item item-divider"></div>
<div class="item" ng-click="saveBlack()">

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Language'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesLanguageController" ng-init="init()" >
<ion-content>
<ion-radio ng-repeat="lang in availableLanguages" ng-value="lang.isoCode" ng-model="currentLanguage"
ng-click="save(lang.isoCode)">{{lang.name}}
</ion-radio>

View file

@ -1,9 +1,18 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Session Log' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesLogs" ng-init="init()">
<ion-content>
<button class="button button-block button-positive" copy-to-clipboard="prepare()">
<i class="icon ion-clipboard"></i>
<span translate>Copy to clipboard</span>
</button>
<button class="button button-block button-positive" ng-show="isCordova" ng-click="sendLogs()">
<i class="icon ion-ios-email-outline"></i>
<span translate>Send by email</span>
</button>
<div class="card">
<div class="item item-text-wrap">
<ul>
@ -15,13 +24,5 @@
</ul>
</div>
</div>
<button class="button button-block button-positive" copy-to-clipboard="prepare()">
<i class="icon ion-clipboard"></i>
<span translate>Copy to clipboard</span>
</button>
<button class="button button-block button-positive" ng-show="isCordova" ng-click="sendLogs()">
<i class="icon ion-ios-email-outline"></i>
<span translate>Send by email</span>
</button>
</ion-content>
</ion-view>

View file

@ -1,9 +1,12 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
{{'Unit'|translate}}
</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="preferencesUnitController" ng-init="init()" >
<ion-content>
<ion-radio ng-repeat="unit in unitList" ng-value="unit.code" ng-model="currentUnit"
ng-click="save(unit)">{{unit.shortName}}
</ion-radio>

View file

@ -53,7 +53,7 @@
<div ng-show="usePushNotifications && PNEnabledByUser">
<div class="item item-divider" translate>Notifications</div>
<ion-toggle ng-model="pushNotifications" toggle-class="toggle-balanced" ng-change="pushNotificationsChange()">
<ion-toggle ng-model="pushNotifications.value" toggle-class="toggle-balanced" ng-change="pushNotificationsChange()">
<span class="toggle-label" translate>Enable push notifications</span>
</ion-toggle>
@ -67,7 +67,7 @@
<div class="item item-divider" translate>Exchanges</div>
<ion-toggle ng-show="!isWP" ng-model="glideraEnabled" toggle-class="toggle-balanced" ng-change="glideraChange()">
<ion-toggle ng-show="!isWP" ng-model="glideraEnabled.value" toggle-class="toggle-balanced" ng-change="glideraChange()">
<span class="toggle-label" translate>Enable Glidera Service</span>
</ion-toggle>
@ -80,13 +80,13 @@
<div class="item item-divider" translate>Others</div>
<ion-toggle ng-model="spendUnconfirmed" toggle-class="toggle-balanced" ng-change="spendUnconfirmedChange()">
<ion-toggle ng-model="spendUnconfirmed.value" toggle-class="toggle-balanced" ng-change="spendUnconfirmedChange()">
<span class="toggle-label" translate>Use Unconfirmed Funds</span>
</ion-toggle>
<div class="item item-divider" translate>Wallets Preferences</div>
<a class="item item-icon-left item-icon-right" href
ui-sref="tabs.preferences.main({'walletId': item.id})"
ui-sref="tabs.preferences({'walletId': item.id})"
ng-repeat="item in wallets track by $index">
<i class="icon ion-briefcase size-21" ng-style="{'color':item.color}"></i>
{{item.name || item.id}}

View file

@ -1,10 +1,11 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-title>{{'Terms Of Use' | translate}}</ion-nav-title>
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content class="padding" ng-controller="termOfUseController">
<ion-content class="padding">
<div class="card">
<div class="item item-text-wrap" ng-include="'views/includes/terms.html'"></div>
</div>

View file

@ -4,7 +4,7 @@
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-controller="translatorsController">
<ion-content>
<div class="list">
<div class="item item-divider" translate>
Translation Credits

View file

@ -53,7 +53,7 @@ angular.module('copayApp.controllers').controller('addressbookListController', f
}, 100);
};
$scope.$on("$ionicView.enter", function(event, data){
$scope.$on("$ionicView.beforeEnter", function(event, data){
initAddressbook();
});

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 + ']';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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);
@ -206,6 +199,12 @@ angular.module('copayApp.controllers').controller('tabHomeController',
});
$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();
});

View file

@ -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;
});
@ -49,7 +49,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$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) {

View file

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

View file

@ -197,7 +197,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
});
};
$scope.$on("$ionicView.enter", function(event, data){
$scope.$on("$ionicView.beforeEnter", function(event, data){
currentTxHistoryPage = 0;
$scope.completeTxHistory = [];

View file

@ -321,6 +321,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/language',
views: {
'tab-settings@tabs': {
controller: 'preferencesLanguageController',
templateUrl: 'views/preferencesLanguage.html'
}
}
@ -329,6 +330,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/unit',
views: {
'tab-settings@tabs': {
controller: 'preferencesUnitController',
templateUrl: 'views/preferencesUnit.html'
}
}
@ -337,6 +339,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/fee',
views: {
'tab-settings@tabs': {
controller: 'preferencesFeeController',
templateUrl: 'views/preferencesFee.html'
}
}
@ -345,6 +348,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/altCurrency',
views: {
'tab-settings@tabs': {
controller: 'preferencesAltCurrencyController',
templateUrl: 'views/preferencesAltCurrency.html'
}
}
@ -353,6 +357,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/about',
views: {
'tab-settings@tabs': {
controller: 'preferencesAbout',
templateUrl: 'views/preferencesAbout.html'
}
}
@ -361,6 +366,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/logs',
views: {
'tab-settings@tabs': {
controller: 'preferencesLogs',
templateUrl: 'views/preferencesLogs.html'
}
}
@ -369,6 +375,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/termsOfUse',
views: {
'tab-settings@tabs': {
controller: 'termOfUseController',
templateUrl: 'views/termsOfUse.html',
}
}
@ -377,6 +384,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/translators',
views: {
'tab-settings@tabs': {
controller: 'translatorsController',
templateUrl: 'views/translators.html'
}
}
@ -388,19 +396,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*
*/
.state('tabs.preferences', {
.state('tabs.preferences', {
url: '/preferences/:walletId',
abstract: true,
views: {
'tab-settings@tabs': {
template: '<ion-nav-view name="preferences"></ion-nav-view>'
},
}
})
.state('tabs.preferences.main', {
url: '/main',
views: {
'preferences': {
controller: 'preferencesController',
templateUrl: 'views/preferences.html'
}
}
@ -408,7 +408,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.preferencesAlias', {
url: '/preferencesAlias',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesAliasController',
templateUrl: 'views/preferencesAlias.html'
}
}
@ -416,7 +417,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.preferencesColor', {
url: '/preferencesColor',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesColorController',
templateUrl: 'views/preferencesColor.html'
}
}
@ -424,7 +426,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.preferencesEmail', {
url: '/preferencesEmail',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesEmailController',
templateUrl: 'views/preferencesEmail.html'
}
}
@ -432,7 +435,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.backup', {
url: '/backup',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'backupController',
templateUrl: 'views/backup.html'
}
@ -441,7 +444,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.preferencesAdvanced', {
url: '/preferencesAdvanced',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesAdvancedController',
templateUrl: 'views/preferencesAdvanced.html'
}
}
@ -449,7 +453,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.information', {
url: '/information',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesInformation',
templateUrl: 'views/preferencesInformation.html'
}
}
@ -457,7 +462,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.export', {
url: '/export',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'exportController',
templateUrl: 'views/export.html'
}
@ -466,7 +471,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.preferencesBwsUrl', {
url: '/preferencesBwsUrl',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesBwsUrlController',
templateUrl: 'views/preferencesBwsUrl.html'
}
}
@ -474,7 +480,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.preferencesHistory', {
url: '/preferencesHistory',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesHistory',
templateUrl: 'views/preferencesHistory.html'
}
}
@ -482,7 +489,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.deleteWords', {
url: '/deleteWords',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesDeleteWordsController',
templateUrl: 'views/preferencesDeleteWords.html'
}
}
@ -490,7 +498,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.delete', {
url: '/delete',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'preferencesDeleteWalletController',
templateUrl: 'views/preferencesDeleteWallet.html'
}
}
@ -498,7 +507,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('tabs.preferences.paperWallet', {
url: '/paperWallet',
views: {
'preferences': {
'tab-settings@tabs': {
controller: 'paperWalletController',
templateUrl: 'views/paperWallet.html'
}
}
@ -707,6 +717,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/preferences',
views: {
'tab-home@tabs': {
controller: 'preferencesGlideraController',
templateUrl: 'views/preferencesGlidera.html'
}
}