Add backup to list of wallets in "manage wallets". Support for safari.
This commit is contained in:
parent
4b8e18735d
commit
c5f810c069
6 changed files with 74 additions and 80 deletions
|
|
@ -1,19 +1,20 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, controllerUtils, backupService) {
|
||||
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, controllerUtils, backupService) {
|
||||
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
||||
|
||||
$rootScope.title = 'Profile';
|
||||
|
||||
$scope.downloadBackup = function() {
|
||||
$scope.downloadProfileBackup = function() {
|
||||
backupService.profileDownload($rootScope.iden);
|
||||
};
|
||||
|
||||
$scope.viewBackup = function() {
|
||||
$scope.backupPlainText = backupService.profileEncrypted($rootScope.iden);
|
||||
$scope.hideViewBackup = true;
|
||||
$scope.viewProfileBackup = function() {
|
||||
$scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden);
|
||||
$scope.hideViewProfileBackup = true;
|
||||
};
|
||||
|
||||
$scope.getWallets = function() {
|
||||
if (!$rootScope.iden) return;
|
||||
$scope.wallets = [];
|
||||
var wids = _.pluck($rootScope.iden.listWallets(), 'id');
|
||||
_.each(wids, function(wid) {
|
||||
|
|
@ -29,8 +30,37 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
if (!w) return;
|
||||
$scope.loading = w.id;
|
||||
controllerUtils.deleteWallet($scope, w, function() {
|
||||
if ($rootScope.wallet.id === w.id) {
|
||||
$rootScope.wallet = null;
|
||||
var lastFocused = $rootScope.iden.getLastFocusedWallet();
|
||||
controllerUtils.bindProfile($scope, $rootScope.iden, lastFocused);
|
||||
}
|
||||
$scope.loading = false;
|
||||
$scope.getWallets();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.downloadWalletBackup = function(w) {
|
||||
if (!w) return;
|
||||
backupService.walletDownload(w);
|
||||
}
|
||||
|
||||
$scope.viewWalletBackup = function(w) {
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||
|
||||
if (!w) return;
|
||||
$scope.backupWalletPlainText = backupService.walletEncrypted(w);
|
||||
$scope.hideViewWalletBackup = true;
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
};
|
||||
|
||||
$modal.open({
|
||||
templateUrl: 'views/modals/backup-text.html',
|
||||
windowClass: 'tiny',
|
||||
controller: ModalInstanceCtrl
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue