Glidera working again. Rm ignoreMobilePause!
This commit is contained in:
parent
2a97446ef9
commit
ecf16d61ea
8 changed files with 128 additions and 92 deletions
|
|
@ -1,40 +1,43 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('glideraUriController',
|
||||
function($scope, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
|
||||
function($scope, $log, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
|
||||
|
||||
this.submitOauthCode = function(code) {
|
||||
console.log('[glideraUri.js.5:code:]'+code); //TODO
|
||||
var self = this;
|
||||
var glideraTestnet = configService.getSync().glidera.testnet;
|
||||
var network = glideraTestnet ? 'testnet' : 'livenet';
|
||||
this.loading = true;
|
||||
this.error = null;
|
||||
$timeout(function() {
|
||||
glideraService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
this.submitOauthCode = function(code) {
|
||||
$log.debug('Glidera Oauth Code:' + code);
|
||||
var self = this;
|
||||
var glideraTestnet = configService.getSync().glidera.testnet;
|
||||
var network = glideraTestnet ? 'testnet' : 'livenet';
|
||||
this.loading = true;
|
||||
this.error = null;
|
||||
$timeout(function() {
|
||||
glideraService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
} else if (data && data.access_token) {
|
||||
storageService.setGlideraToken(network, data.access_token, function() {
|
||||
$scope.$emit('Local/GlideraUpdated', data.access_token);
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
else if (data && data.access_token) {
|
||||
storageService.setGlideraToken(network, data.access_token, function() {
|
||||
$scope.$emit('Local/GlideraUpdated', data.access_token);
|
||||
$timeout(function() {
|
||||
go.path('glidera');
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
go.path('glidera');
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
this.checkCode = function() {
|
||||
console.log('[glideraUri.js.35:$stateParams:]' + JSON.stringify($stateParams)); //TODO
|
||||
this.code = $stateParams.code;
|
||||
this.submitOauthCode(this.code);
|
||||
};
|
||||
|
||||
});
|
||||
this.checkCode = function() {
|
||||
if ($stateParams.url) {
|
||||
var match = $stateParams.url.match(/code=(.+)/);
|
||||
if (match && match[1]) {
|
||||
this.code = match[1];
|
||||
return this.submitOauthCode(this.code);
|
||||
}
|
||||
}
|
||||
$log.error('Bad state: ' + JSON.stringify($stateParams));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1500,11 +1500,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
|
||||
if (!self.lastUpdate || (now - self.lastUpdate) > oneHr) {
|
||||
self.updateAll({
|
||||
quiet: true
|
||||
triggerTxUpdate: true,
|
||||
quiet: true,
|
||||
triggerTxUpdate: true
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$rootScope.$on('Local/Resume', function(event) {
|
||||
$log.debug('### Resume event');
|
||||
|
|
|
|||
12
src/js/controllers/uri.js
Normal file
12
src/js/controllers/uri.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('uriController',
|
||||
function($rootScope, $stateParams, $log, openURLService) {
|
||||
|
||||
|
||||
/* This is only for BROWSER links, it is not excecuted on mobile devices */
|
||||
|
||||
$log.info('DEEP LINK from Browser:' + $stateParams.url);
|
||||
openURLService.handleURL({
|
||||
url: $stateParams.url
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue