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

View file

@ -700,7 +700,9 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
root.logout = function(cb) { root.logout = function(cb) {
storageService.removeCoinbaseToken(credentials.NETWORK, function() { storageService.removeCoinbaseToken(credentials.NETWORK, function() {
storageService.removeCoinbaseRefreshToken(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'; '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 = {}; var root = {};
@ -127,10 +127,16 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
}); });
} else if (data && data.indexOf(appConfigService.name + '://coinbase') === 0) { } else if (data && data.indexOf(appConfigService.name + '://coinbase') === 0) {
var code = getParameterByName('code', data); var code = getParameterByName('code', data);
$ionicHistory.nextViewOptions({
disableAnimate: true
});
$state.go('tabs.home', {}, { $state.go('tabs.home', {}, {
'reload': true, 'reload': true,
'notify': $state.current.name == 'tabs.home' ? false : true 'notify': $state.current.name == 'tabs.home' ? false : true
}).then(function() { }).then(function() {
$ionicHistory.nextViewOptions({
disableAnimate: true
});
$state.transitionTo('tabs.buyandsell.coinbase', { $state.transitionTo('tabs.buyandsell.coinbase', {
code: code code: code
}); });

View file

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

View file

@ -7,13 +7,7 @@
<ion-content> <ion-content>
<div class="box-notification error" ng-show="error"> <div ng-if="!accessToken" ng-init="showOauthForm = false">
<ul class="no-bullet m0 size-12">
<li ng-repeat="err in error.errors" ng-bind-html="err.message"></li>
</ul>
</div>
<div ng-if="!accessToken && !error" ng-init="showOauthForm = false">
<div class="text-center m20v"> <div class="text-center m20v">
<img src="img/coinbase-logo.png" width="200"> <img src="img/coinbase-logo.png" width="200">
</div> </div>
@ -32,11 +26,6 @@
</div> </div>
</div> </div>
<div ng-show="showOauthForm"> <div ng-show="showOauthForm">
<div class="text-left box-notification" ng-show="coinbase.error">
<ul class="no-bullet m0 text-warning size-12">
<li ng-repeat="err in coinbase.error.errors" ng-bind-html="err.message"></li>
</ul>
</div>
<form name="oauthCodeForm" ng-submit="coinbase.submitOauthCode(code)" novalidate> <form name="oauthCodeForm" ng-submit="coinbase.submitOauthCode(code)" novalidate>
<div class="list settings-input-group"> <div class="list settings-input-group">
<label class="item item-input item-stacked-label"> <label class="item item-input item-stacked-label">
@ -53,14 +42,14 @@
</div> </div>
</div> </div>
<div ng-if="accessToken && !error"> <div ng-if="accessToken">
<div class="m20t text-center" ng-click="updateTransactions()"> <div class="m20t text-center" ng-click="updateTransactions()">
<img src="img/coinbase-logo.png" width="200"> <img src="img/coinbase-logo.png" width="200">
</div> </div>
<div class="m10t size-12 text-center text-gray"> <div class="m10t size-12 text-center text-gray">
<span ng-show="!buyPrice || !sellPrice">...</span> <ion-spinner class="spinner-dark recent" icon="crescent" ng-show="!buyPrice || !sellPrice"></ion-spinner>
<span ng-show="buyPrice && sellPrice"> <span ng-show="buyPrice && sellPrice">
{{buyPrice.amount}} {{buyPrice.currency}} {{buyPrice.amount}} {{buyPrice.currency}}
| |
@ -123,9 +112,6 @@
</p> </p>
</a> </a>
</div> </div>
<div class="m10t text-center" ng-if="loading">
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
</div>
</div> </div>
</ion-content> </ion-content>