Wallet/src/js/controllers/preferencesGlidera.js

67 lines
1.9 KiB
JavaScript
Raw Normal View History

2015-08-28 18:23:24 -03:00
'use strict';
angular.module('copayApp.controllers').controller('preferencesGlideraController',
2015-10-01 02:13:33 -03:00
function($scope, $modal, $timeout, profileService, applicationService, glideraService, storageService, isChromeApp, animationService) {
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getEmail = function(token) {
2015-08-28 18:23:24 -03:00
var self = this;
2015-09-07 11:14:09 -03:00
glideraService.getEmail(token, function(error, data) {
self.email = data;
2015-08-28 18:23:24 -03:00
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getPersonalInfo = function(token) {
var self = this;
2015-08-28 18:23:24 -03:00
glideraService.getPersonalInfo(token, function(error, info) {
self.personalInfo = info;
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getStatus = function(token) {
var self = this;
glideraService.getStatus(token, function(error, data) {
self.status = data;
2015-08-28 18:23:24 -03:00
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getLimits = function(token) {
var self = this;
2015-08-28 18:23:24 -03:00
glideraService.getLimits(token, function(error, limits) {
self.limits = limits;
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
2015-09-11 15:39:06 -03:00
this.revokeToken = function(testnet) {
var network = testnet ? 'testnet' : 'livenet';
2015-09-07 11:14:09 -03:00
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.ok = function() {
$modalInstance.close(true);
};
$scope.cancel = function() {
$modalInstance.dismiss();
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/glidera-confirmation.html',
2015-10-01 02:13:33 -03:00
windowClass: animationService.modalAnimated.slideRight,
2015-09-07 11:14:09 -03:00
controller: ModalInstanceCtrl
});
2015-09-10 14:58:06 -03:00
2015-09-07 11:14:09 -03:00
modalInstance.result.then(function(ok) {
if (ok) {
2015-09-11 15:39:06 -03:00
storageService.removeGlideraToken(network, function() {
2015-09-07 11:14:09 -03:00
$timeout(function() {
applicationService.restart();
}, 100);
});
}
2015-08-28 18:23:24 -03:00
});
2015-09-10 14:58:06 -03:00
modalInstance.result.finally(function() {
var m = angular.element(document.getElementsByClassName('reveal-modal'));
2015-10-01 02:13:33 -03:00
m.addClass(animationService.modalAnimated.slideOutRight);
2015-09-10 14:58:06 -03:00
});
2015-08-28 18:23:24 -03:00
};
});