2014-03-26 09:18:42 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2014-06-03 17:42:36 -03:00
|
|
|
angular.module('copayApp.controllers').controller('BackupController',
|
2014-06-17 16:25:38 -03:00
|
|
|
function($scope, $rootScope, $location, $window, $timeout, $modal, backupService, walletFactory, controllerUtils) {
|
2014-03-26 09:18:42 -03:00
|
|
|
$scope.title = 'Backup';
|
2014-04-17 18:02:20 -03:00
|
|
|
|
2014-05-09 09:52:02 -03:00
|
|
|
$scope.download = function() {
|
2014-06-16 16:46:17 -03:00
|
|
|
backupService.download($rootScope.wallet);
|
2014-04-17 18:02:20 -03:00
|
|
|
};
|
|
|
|
|
|
2014-06-16 15:51:19 -03:00
|
|
|
$scope.openModal = function() {
|
|
|
|
|
var modalInstance = $modal.open({
|
|
|
|
|
templateUrl: 'backupModal.html',
|
|
|
|
|
controller: ModalInstanceCtrl,
|
|
|
|
|
});
|
2014-06-03 16:13:56 -03:00
|
|
|
|
2014-06-16 16:46:17 -03:00
|
|
|
modalInstance.result.then(function(email) {
|
|
|
|
|
backupService.sendEmail(email, $rootScope.wallet);
|
|
|
|
|
});
|
2014-06-16 15:51:19 -03:00
|
|
|
};
|
2014-06-03 16:13:56 -03:00
|
|
|
|
2014-06-16 15:51:19 -03:00
|
|
|
$scope.deleteWallet = function() {
|
2014-06-16 17:37:33 -03:00
|
|
|
var w = $rootScope.wallet;
|
2014-06-16 15:51:19 -03:00
|
|
|
w.disconnect();
|
2014-06-16 17:37:33 -03:00
|
|
|
walletFactory.delete(w.id, function() {
|
2014-06-16 15:51:19 -03:00
|
|
|
controllerUtils.logout();
|
|
|
|
|
});
|
|
|
|
|
};
|
2014-06-03 16:13:56 -03:00
|
|
|
|
2014-06-16 15:51:19 -03:00
|
|
|
});
|
2014-06-03 16:13:56 -03:00
|
|
|
|
2014-06-16 15:51:19 -03:00
|
|
|
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
2014-06-03 16:13:56 -03:00
|
|
|
|
2014-06-16 15:51:19 -03:00
|
|
|
$scope.submit = function(form) {
|
2014-06-03 16:13:56 -03:00
|
|
|
$modalInstance.close($scope.email);
|
|
|
|
|
};
|
2014-06-03 12:55:40 -04:00
|
|
|
|
2014-06-16 15:51:19 -03:00
|
|
|
$scope.cancel = function() {
|
2014-06-03 16:13:56 -03:00
|
|
|
$modalInstance.dismiss('cancel');
|
|
|
|
|
};
|
|
|
|
|
};
|