Merge pull request #5476 from cmgustavo/ref/coinbase-02

Fix first link to your account. Removes unused variables. Fix spinner
This commit is contained in:
Matias Alejo Garcia 2017-01-18 14:27:39 -03:00 committed by GitHub
commit 23b1d77ec1
5 changed files with 33 additions and 33 deletions

View file

@ -16,7 +16,9 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
$scope.loading = false;
if (err || lodash.isEmpty(data)) {
if (err) {
popupService.showAlert('Error', err);
$log.error(err);
err = err.errors ? err.errors[0].message : err;
popupService.showAlert('Error connecting to Coinbase', err);
}
return;
}
@ -79,18 +81,15 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
this.submitOauthCode = function(code) {
var self = this;
ongoingProcess.set('connectingCoinbase', true);
$scope.error = null;
$timeout(function() {
coinbaseService.getToken(code, function(err, accessToken) {
ongoingProcess.set('connectingCoinbase', false);
if (err) {
popupService.showAlert('Error', err);
return;
}
$scope.accessToken = accessToken;
init();
});
}, 100);
coinbaseService.getToken(code, function(err, accessToken) {
ongoingProcess.set('connectingCoinbase', false);
if (err) {
popupService.showAlert('Error connecting to Coinbase', err);
return;
}
$scope.accessToken = accessToken;
init();
});
};
this.openTxModal = function(tx) {
@ -109,7 +108,9 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
$scope.$on("$ionicView.beforeEnter", function(event, data) {
coinbaseService.setCredentials();
if (data.stateParams && data.stateParams.code) {
self.submitOauthCode(data.stateParams.code);
coinbaseService.getStoredToken(function(at) {
if (!at) self.submitOauthCode(data.stateParams.code);
});
} else {
init();
}

View file

@ -700,7 +700,9 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
root.logout = function(cb) {
storageService.removeCoinbaseToken(credentials.NETWORK, function() {
storageService.removeCoinbaseRefreshToken(credentials.NETWORK, function() {
return cb();
storageService.removeCoinbaseTxs(credentials.NETWORK, function() {
return cb();
});
});
});
};

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('incomingData', function($log, $state, $timeout, bitcore, $rootScope, payproService, scannerService, appConfigService) {
angular.module('copayApp.services').factory('incomingData', function($log, $state, $timeout, $ionicHistory, bitcore, $rootScope, payproService, scannerService, appConfigService) {
var root = {};
@ -127,10 +127,16 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
});
} else if (data && data.indexOf(appConfigService.name + '://coinbase') === 0) {
var code = getParameterByName('code', data);
$ionicHistory.nextViewOptions({
disableAnimate: true
});
$state.go('tabs.home', {}, {
'reload': true,
'notify': $state.current.name == 'tabs.home' ? false : true
}).then(function() {
$ionicHistory.nextViewOptions({
disableAnimate: true
});
$state.transitionTo('tabs.buyandsell.coinbase', {
code: code
});

View file

@ -4,6 +4,11 @@
$item-border-color: #EFEFEF;
$item-label-color: #6C6C6E;
@extend .deflash-blue;
.spinner svg {
stroke: #0067c8;
fill: #0067c8;
}
.add-bottom-for-cta {
bottom: 92px;