use scope only - preferences (advanced)

This commit is contained in:
Javier 2016-06-13 16:13:35 -03:00
commit 9163127dca
22 changed files with 238 additions and 305 deletions

View file

@ -3,28 +3,27 @@
angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $timeout, $log, configService, profileService, fingerprintService, walletService) {
var self = this;
var fc;
var config = configService.getSync();
var disableFocusListener = $rootScope.$on('Local/NewFocusedWalletReady', function() {
self.init();
$scope.init();
});
$scope.$on('$destroy', function() {
disableFocusListener();
});
this.init = function() {
$scope.init = function() {
fc = profileService.focusedClient;
if (fc) {
$scope.encryptEnabled = walletService.isEncrypted(fc);
this.externalSource = fc.getPrivKeyExternalSourceName() == 'ledger' ? "Ledger" : null;
$scope.externalSource = fc.getPrivKeyExternalSourceName() == 'ledger' ? "Ledger" : null;
// TODO externalAccount
//this.externalIndex = fc.getExternalIndex();
}
this.touchidAvailable = fingerprintService.isAvailable();
$scope.touchidAvailable = fingerprintService.isAvailable();
$scope.touchidEnabled = config.touchIdFor ? config.touchIdFor[fc.credentials.walletId] : null;
$scope.deleted = false;
@ -41,7 +40,6 @@ angular.module('copayApp.controllers').controller('preferencesController',
};
$scope.encryptChange = function() {
var self = this;
if (!fc) return;
var val = $scope.encryptEnabled;