Fix coinbase oauth for desktop. Fix NWjs window

This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-03 15:33:35 -03:00
commit 163f1bf913
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 11 additions and 13 deletions

View file

@ -33,9 +33,6 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
this.openAuthenticateWindow = function() { this.openAuthenticateWindow = function() {
var oauthUrl = this.getAuthenticateUrl(); var oauthUrl = this.getAuthenticateUrl();
externalLinkService.open(oauthUrl);
/*
* Not working (NW bug)
if (!isNW) { if (!isNW) {
externalLinkService.open(oauthUrl); externalLinkService.open(oauthUrl);
} else { } else {
@ -44,18 +41,19 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
gui.Window.open(oauthUrl, { gui.Window.open(oauthUrl, {
focus: true, focus: true,
position: 'center' position: 'center'
}, function(win) { }, function(new_win) {
win.on('loaded', function() { new_win.on('loaded', function() {
var title = win.title; var title = new_win.window.document.title;
if (title.indexOf('Coinbase') == -1) { $timeout(function() {
$scope.code = title; if (title.indexOf('Coinbase') == -1) {
self.submitOauthCode(title); $scope.code = title;
win.close(); self.submitOauthCode($scope.code);
} new_win.close();
}
}, 100);
}); });
}); });
} }
*/
} }
this.getAuthenticateUrl = function() { this.getAuthenticateUrl = function() {

View file

@ -61,7 +61,7 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
+ 'wallet:payment-methods:read'; + 'wallet:payment-methods:read';
// NW has a bug with Window Object // NW has a bug with Window Object
if (isCordova || isNW) { if (isCordova) {
credentials.REDIRECT_URI = coinbase.redirect_uri.mobile; credentials.REDIRECT_URI = coinbase.redirect_uri.mobile;
} else { } else {
credentials.REDIRECT_URI = coinbase.redirect_uri.desktop; credentials.REDIRECT_URI = coinbase.redirect_uri.desktop;