2014-10-11 13:26:10 -07:00
|
|
|
'use strict';
|
2014-11-30 18:08:16 -08:00
|
|
|
angular.module('copayApp.controllers').controller('ProfileController', function($scope, $rootScope, $location, $modal, backupService, identityService) {
|
2014-11-12 19:07:33 -08:00
|
|
|
$scope.username = $rootScope.iden.getName();
|
2014-10-21 11:11:04 -07:00
|
|
|
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
2014-10-16 06:18:37 -07:00
|
|
|
|
2014-11-11 11:01:33 -08:00
|
|
|
$rootScope.title = 'Profile';
|
2014-10-27 12:13:06 -07:00
|
|
|
|
2014-11-11 11:53:57 -08:00
|
|
|
$scope.downloadProfileBackup = function() {
|
2014-10-16 06:18:37 -07:00
|
|
|
backupService.profileDownload($rootScope.iden);
|
|
|
|
};
|
2014-10-21 11:11:04 -07:00
|
|
|
|
2014-11-11 11:53:57 -08:00
|
|
|
$scope.viewProfileBackup = function() {
|
|
|
|
$scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden);
|
|
|
|
$scope.hideViewProfileBackup = true;
|
2014-10-21 11:11:04 -07:00
|
|
|
};
|
2014-11-10 11:41:07 -08:00
|
|
|
|
|
|
|
$scope.deleteWallet = function(w) {
|
|
|
|
if (!w) return;
|
2014-11-30 18:08:16 -08:00
|
|
|
identityService.deleteWallet(w, function(err) {
|
2014-11-10 11:41:07 -08:00
|
|
|
$scope.loading = false;
|
2014-11-30 18:08:16 -08:00
|
|
|
if (err) {
|
|
|
|
log.warn(err);
|
|
|
|
}
|
2014-11-10 11:41:07 -08:00
|
|
|
});
|
|
|
|
};
|
2014-11-11 11:53:57 -08:00
|
|
|
|
2014-11-29 23:03:23 -08:00
|
|
|
$scope.setWallets = function() {
|
|
|
|
if (!$rootScope.iden) return;
|
|
|
|
$scope.wallets=$rootScope.iden.listWallets();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-11-11 11:53:57 -08:00
|
|
|
$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
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-10-11 13:26:10 -07:00
|
|
|
});
|