diff --git a/src/js/controllers/coinbase.js b/src/js/controllers/coinbase.js index 8b23d9b28..3005e07bb 100644 --- a/src/js/controllers/coinbase.js +++ b/src/js/controllers/coinbase.js @@ -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(); } diff --git a/src/js/services/coinbaseService.js b/src/js/services/coinbaseService.js index 307638c40..d9ba38963 100644 --- a/src/js/services/coinbaseService.js +++ b/src/js/services/coinbaseService.js @@ -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(); + }); }); }); }; diff --git a/src/js/services/incomingData.js b/src/js/services/incomingData.js index 78e856af1..c9543536e 100644 --- a/src/js/services/incomingData.js +++ b/src/js/services/incomingData.js @@ -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 }); diff --git a/src/sass/views/integrations/coinbase.scss b/src/sass/views/integrations/coinbase.scss index 2221463f3..08521b72b 100644 --- a/src/sass/views/integrations/coinbase.scss +++ b/src/sass/views/integrations/coinbase.scss @@ -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; diff --git a/www/views/coinbase.html b/www/views/coinbase.html index cd953d9bc..dc85681f9 100644 --- a/www/views/coinbase.html +++ b/www/views/coinbase.html @@ -7,13 +7,7 @@ -
- -
- -
+
@@ -32,11 +26,6 @@
-
-
    -
  • -
-
-
+
- ... + {{buyPrice.amount}} {{buyPrice.currency}} | @@ -123,9 +112,6 @@

-
- -