Fix Glidera connect if wallet testnet is active

This commit is contained in:
Gustavo Maximiliano Cortez 2015-11-05 18:57:59 -03:00
parent 0b3a524b60
commit caeea865a4
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
4 changed files with 15 additions and 11 deletions

View File

@ -8,8 +8,9 @@ angular.module('copayApp.controllers').controller('glideraController',
};
this.submitOauthCode = function(code) {
var fc = profileService.focusedClient;
var self = this;
var glideraTestnet = configService.getSync().glidera.testnet;
var network = glideraTestnet ? 'testnet' : 'livenet';
this.loading = true;
this.error = null;
$timeout(function() {
@ -22,7 +23,7 @@ angular.module('copayApp.controllers').controller('glideraController',
}, 100);
}
else if (data && data.access_token) {
storageService.setGlideraToken(fc.credentials.network, data.access_token, function() {
storageService.setGlideraToken(network, data.access_token, function() {
$scope.$emit('Local/GlideraUpdated', data.access_token);
$timeout(function() {
$scope.$apply();

View File

@ -1,10 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraUriController',
function($scope, $stateParams, $timeout, profileService, glideraService, storageService, go) {
function($scope, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
this.submitOauthCode = function(code) {
var fc = profileService.focusedClient;
var self = this;
var glideraTestnet = configService.getSync().glidera.testnet;
var network = glideraTestnet ? 'testnet' : 'livenet';
this.loading = true;
this.error = null;
$timeout(function() {
@ -17,7 +18,7 @@ angular.module('copayApp.controllers').controller('glideraUriController',
}, 100);
}
else if (data && data.access_token) {
storageService.setGlideraToken(fc.credentials.network, data.access_token, function() {
storageService.setGlideraToken(network, data.access_token, function() {
$scope.$emit('Local/GlideraUpdated', data.access_token);
$timeout(function() {
go.path('glidera');

View File

@ -925,11 +925,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.initGlidera = function(accessToken) {
self.glideraEnabled = configService.getSync().glidera.enabled;
// self.glideraTestnet = configService.getSync().glidera.testnet;
// var network = self.glideraTestnet ? 'testnet' : 'livenet';
// Disabled for testnet
self.glideraTestnet = false;
var network = 'livenet';
self.glideraTestnet = configService.getSync().glidera.testnet;
var network = self.glideraTestnet ? 'testnet' : 'livenet';
self.glideraToken = null;
self.glideraError = null;

View File

@ -70,12 +70,17 @@ angular.module('copayApp.services').factory('configService', function(storageSer
configCache.wallet.settings.unitCode = defaultConfig.wallet.settings.unitCode;
}
if (!configCache.glidera) {
configCache.glidera = defaultConfig.glidera;
configCache.glidera = defaultConfig.glidera;
}
} else {
configCache = lodash.clone(defaultConfig);
};
// Glidera
// Disabled for testnet
configCache.glidera.testnet = false;
$log.debug('Preferences read:', configCache)
return cb(err, configCache);
});