Fix resume event on mobile for Glidera/Coinbase integration (#4083)

This commit is contained in:
Gustavo Maximiliano Cortez 2016-04-15 15:29:20 -03:00 committed by Matias Alejo Garcia
commit 4a8e5397ce
4 changed files with 13 additions and 7 deletions

View file

@ -3,6 +3,8 @@
angular.module('copayApp.controllers').controller('coinbaseController', angular.module('copayApp.controllers').controller('coinbaseController',
function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, coinbaseService, isChromeApp, animationService, lodash, nodeWebkit) { function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, coinbaseService, isChromeApp, animationService, lodash, nodeWebkit) {
window.ignoreMobilePause = true;
this.openAuthenticateWindow = function() { this.openAuthenticateWindow = function() {
var oauthUrl = this.getAuthenticateUrl(); var oauthUrl = this.getAuthenticateUrl();
if (!nodeWebkit.isDefined()) { if (!nodeWebkit.isDefined()) {

View file

@ -17,13 +17,15 @@ angular.module('copayApp.controllers').controller('coinbaseUriController',
$scope.$apply(); $scope.$apply();
}, 100); }, 100);
} }
else if (data && data.access_token) { else if (data && data.access_token && data.refresh_token) {
storageService.setCoinbaseToken(network, data.access_token, function() { storageService.setCoinbaseToken(network, data.access_token, function() {
$scope.$emit('Local/CoinbaseUpdated', data.access_token); storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() {
$timeout(function() { $scope.$emit('Local/CoinbaseUpdated', data.access_token);
go.path('coinbase'); $timeout(function() {
$scope.$apply(); go.path('coinbase');
}, 100); $scope.$apply();
}, 100);
});
}); });
} }
}); });

View file

@ -3,6 +3,7 @@
angular.module('copayApp.controllers').controller('glideraController', angular.module('copayApp.controllers').controller('glideraController',
function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, glideraService, isChromeApp, animationService, lodash) { function($rootScope, $scope, $timeout, $modal, profileService, configService, storageService, glideraService, isChromeApp, animationService, lodash) {
window.ignoreMobilePause = true;
this.getAuthenticateUrl = function() { this.getAuthenticateUrl = function() {
return glideraService.getOauthCodeUrl(); return glideraService.getOauthCodeUrl();

View file

@ -356,7 +356,8 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
root.getPendingTransactions = function(cb) { root.getPendingTransactions = function(cb) {
var network = configService.getSync().coinbase.testnet ? 'testnet' : 'livenet'; var network = configService.getSync().coinbase.testnet ? 'testnet' : 'livenet';
storageService.getCoinbaseTxs(network, function(err, txs) { storageService.getCoinbaseTxs(network, function(err, txs) {
return cb(err, JSON.parse(txs)); var _txs = txs ? JSON.parse(txs) : {};
return cb(err, _txs);
}); });
}; };