commit
0bac775982
21 changed files with 166 additions and 49 deletions
|
|
@ -62,7 +62,8 @@ angular.module('copayApp.controllers').controller('CreateController',
|
|||
$scope.error = 'Could not create wallet: ' + err;
|
||||
}
|
||||
}
|
||||
$rootScope.$digest()
|
||||
|
||||
$rootScope.$digest();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('CreateWalletController', function($scope, $rootScope) {
|
||||
|
||||
$rootScope.title = 'Create Wallet';
|
||||
});
|
||||
|
|
@ -25,7 +25,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
$scope.$on("$destroy", function(){
|
||||
var iden = $rootScope.iden;
|
||||
if (iden) {
|
||||
iden.removeListener('newWallets', $scope.done );
|
||||
iden.removeListener('newWallet', $scope.done );
|
||||
iden.removeListener('noWallets', $scope.done );
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('HomeWalletController',
|
||||
function($scope, $rootScope) {
|
||||
angular.module('copayApp.controllers').controller('HomeWalletController', function($scope, $rootScope) {
|
||||
$scope.init = function() {
|
||||
|
||||
$rootScope.title = 'Home';
|
||||
$scope.addr = _.last($rootScope.wallet.getReceiveAddresses());
|
||||
|
||||
// This is necesarry, since wallet can change in homeWallet, without running init() again.
|
||||
$rootScope.$watch('wallet', function() {
|
||||
$scope.addr = _.last($rootScope.wallet.getReceiveAddresses());
|
||||
if ($rootScope.wallet && $rootScope.wallet.isComplete()) {
|
||||
$scope.addr = _.last($rootScope.wallet.getReceiveAddresses());
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
if (err) {
|
||||
$scope.loading = false;
|
||||
$scope.error = 'Could not read wallet. Please check your password';
|
||||
$rootScope.$digest();
|
||||
return;
|
||||
}
|
||||
copay.Compatibility.deleteOldWallet(backupOldWallet);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('JoinController',
|
||||
function($scope, $rootScope, $timeout, isMobile, notification) {
|
||||
function($scope, $rootScope, $timeout, isMobile, notification, identityService) {
|
||||
$rootScope.fromSetup = false;
|
||||
$scope.loading = false;
|
||||
$scope.isMobile = isMobile.any();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, backupService, identityService) {
|
||||
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, $filter, $timeout, backupService, identityService) {
|
||||
$scope.username = $rootScope.iden.getName();
|
||||
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
||||
|
||||
|
|
@ -26,11 +26,13 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.init = function() {
|
||||
if ($rootScope.quotaPerItem) {
|
||||
$scope.perItem = $filter('noFractionNumber')($rootScope.quotaPerItem / 1000, 1);
|
||||
$scope.nrWallets = parseInt($rootScope.quotaItems) - 1;
|
||||
}
|
||||
// no need to add event handlers here. Wallet deletion is handle by callback.
|
||||
};
|
||||
|
||||
$scope.setWallets = function() {
|
||||
|
|
@ -46,8 +48,10 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
w.usage = $filter('noFractionNumber')(bits / max * 100, 0);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.wallets = wallets;
|
||||
$timeout(function(){
|
||||
$scope.$digest();
|
||||
})
|
||||
};
|
||||
|
||||
$scope.downloadWalletBackup = function(w) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,19 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
|
|||
$scope.walletSelection = false;
|
||||
$scope.setWallets();
|
||||
});
|
||||
iden.on('deleteWallet', function() {
|
||||
iden.on('walletDeleted', function(wid) {
|
||||
if (wid == $rootScope.wallet.id) {
|
||||
copay.logger.debug('Deleted focused wallet:', wid);
|
||||
|
||||
// new focus
|
||||
var newWid = $rootScope.iden.getLastFocusedWalletId();
|
||||
if (newWid && $rootScope.iden.getWalletById(newWid)) {
|
||||
identityService.setFocusedWallet(newWid);
|
||||
} else {
|
||||
copay.logger.debug('No wallets');
|
||||
identityService.noFocusedWallet(newWid);
|
||||
}
|
||||
}
|
||||
$scope.walletSelection = false;
|
||||
$scope.setWallets();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue