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

View file

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