Glidera working again. Rm ignoreMobilePause!

This commit is contained in:
Matias Alejo Garcia 2016-06-11 18:28:31 -03:00
commit ecf16d61ea
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
8 changed files with 128 additions and 92 deletions

View file

@ -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));
}
});

View file

@ -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
View 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
});
});