Move wallet-info to settings. Fix removing last wallet

This commit is contained in:
Gustavo Maximiliano Cortez 2015-01-14 14:53:20 -03:00
commit 5b1463af60
8 changed files with 171 additions and 204 deletions

View file

@ -1,9 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('CopayersController',
function($scope, $rootScope, $timeout, go) {
function($scope, $rootScope, $timeout, go, identityService, notification) {
var w = $rootScope.wallet;
$scope.init = function() {
var w = $rootScope.wallet;
$rootScope.title = 'Share this secret with your copayers';
$scope.loading = false;
$scope.secret = $rootScope.wallet.getSecret();
@ -27,4 +27,25 @@ angular.module('copayApp.controllers').controller('CopayersController',
$rootScope.$digest();
}, 1);
};
$scope.deleteWallet = function() {
$scope.loading = true;
identityService.deleteWallet(w, function(err) {
if (err) {
$scope.loading = null;
$scope.error = err.message || err;
copay.logger.warn(err);
$timeout(function () { $scope.$digest(); });
} else {
$scope.loading = false;
if ($rootScope.wallet) {
go.walletHome();
}
$timeout(function() {
notification.success('Success', 'The wallet "' + (w.name || w.id) + '" was deleted');
});
}
});
};
});