Wallet/src/js/controllers/preferencesGlidera.js

36 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-08-28 18:23:24 -03:00
'use strict';
angular.module('copayApp.controllers').controller('preferencesGlideraController',
2017-02-14 12:36:28 -03:00
function($scope, $timeout, $state, $ionicHistory, glideraService, popupService) {
2016-08-24 11:33:43 -03:00
$scope.revokeToken = function() {
2016-09-12 13:58:36 -03:00
popupService.showConfirm('Glidera', 'Are you sure you would like to log out of your Glidera account?', null, null, function(res) {
if (res) {
2017-02-14 12:36:28 -03:00
glideraService.remove(function() {
2016-11-22 12:35:51 -03:00
$ionicHistory.clearHistory();
$timeout(function() {
2016-11-22 12:35:51 -03:00
$state.go('tabs.home');
}, 100);
});
}
2015-09-10 14:58:06 -03:00
});
2015-08-28 18:23:24 -03:00
};
2017-02-14 12:36:28 -03:00
$scope.$on("$ionicView.afterEnter", function(event, data){
glideraService.updateStatus($scope.account);
});
2017-02-14 12:36:28 -03:00
$scope.$on("$ionicView.beforeEnter", function(event, data){
$scope.account = {};
glideraService.init(function(err, glidera) {
if (err || !glidera) {
2017-02-14 12:36:28 -03:00
if (err) popupService.showAlert('Error connecting Glidera', err);
return;
}
2017-02-14 12:36:28 -03:00
$scope.account['token'] = glidera.token;
$scope.account['permissions'] = glidera.permissions;
$scope.account['status'] = glidera.status;
});
});
2015-08-28 18:23:24 -03:00
});