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;

View File

@ -7,13 +7,7 @@
<ion-content>
<div class="box-notification error" ng-show="error">
<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 ng-if="!accessToken" ng-init="showOauthForm = false">
<div class="text-center m20v">
<img src="img/coinbase-logo.png" width="200">
</div>
@ -32,11 +26,6 @@
</div>
</div>
<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>
<div class="list settings-input-group">
<label class="item item-input item-stacked-label">
@ -53,14 +42,14 @@
</div>
</div>
<div ng-if="accessToken && !error">
<div ng-if="accessToken">
<div class="m20t text-center" ng-click="updateTransactions()">
<img src="img/coinbase-logo.png" width="200">
</div>
<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">
{{buyPrice.amount}} {{buyPrice.currency}}
|
@ -123,9 +112,6 @@
</p>
</a>
</div>
<div class="m10t text-center" ng-if="loading">
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
</div>
</div>
</ion-content>