bwc
This commit is contained in:
parent
04fb7ba032
commit
320de62f13
348 changed files with 7745 additions and 30874 deletions
102
src/js/controllers/copayers.js
Normal file
102
src/js/controllers/copayers.js
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('copayersController',
|
||||
function($scope, $rootScope, $timeout, $log, $modal, profileService, go, notification, isCordova) {
|
||||
var self = this;
|
||||
|
||||
|
||||
self.init = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
if (fc.isComplete()) {
|
||||
$log.debug('Wallet Complete...redirecting')
|
||||
go.walletHome();
|
||||
return;
|
||||
}
|
||||
self.loading = false;
|
||||
self.isCordova = isCordova;
|
||||
};
|
||||
|
||||
var _modalDeleteWallet = function() {
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||
$scope.title = 'Are you sure you want to delete this wallet?';
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.ok = function() {
|
||||
$scope.loading = true;
|
||||
$modalInstance.close('ok');
|
||||
|
||||
};
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
};
|
||||
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'views/modals/confirmation.html',
|
||||
windowClass: 'full',
|
||||
controller: ModalInstanceCtrl
|
||||
});
|
||||
modalInstance.result.then(function(ok) {
|
||||
if (ok) {
|
||||
_deleteWallet();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var _deleteWallet = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
$timeout(function() {
|
||||
var fc = profileService.focusedClient;
|
||||
var walletName = fc.credentials.walletName;
|
||||
|
||||
profileService.deleteWalletFC({}, function(err) {
|
||||
if (err) {
|
||||
this.error = err.message || err;
|
||||
console.log(err);
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
});
|
||||
} else {
|
||||
go.walletHome();
|
||||
$timeout(function() {
|
||||
notification.success('Success', 'The wallet "' + walletName + '" was deleted');
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
self.deleteWallet = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
if (isCordova) {
|
||||
navigator.notification.confirm(
|
||||
'Are you sure you want to delete this wallet?',
|
||||
function(buttonIndex) {
|
||||
if (buttonIndex == 2) {
|
||||
_deleteWallet();
|
||||
}
|
||||
},
|
||||
'Confirm', ['Cancel', 'OK']
|
||||
);
|
||||
} else {
|
||||
_modalDeleteWallet();
|
||||
}
|
||||
};
|
||||
|
||||
self.copySecret = function(secret) {
|
||||
if (isCordova) {
|
||||
window.cordova.plugins.clipboard.copy(secret);
|
||||
window.plugins.toast.showShortCenter('Copied to clipboard');
|
||||
}
|
||||
};
|
||||
|
||||
self.shareSecret = function(secret) {
|
||||
if (isCordova) {
|
||||
if (isMobile.Android() || isMobile.Windows()) {
|
||||
window.ignoreMobilePause = true;
|
||||
}
|
||||
window.plugins.socialsharing.share(secret, null, null, null);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue