Skip to content

Commit

Permalink
Refactor the phonegap logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSwitch committed Feb 2, 2016
1 parent 09e0226 commit 30e1d62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Expand Up @@ -43,6 +43,7 @@ module.exports = function(grunt) {
'src/hello.polyfill.js',
'src/hello.js',
'src/hello.chromeapp.js',
'src/hello.phonegap.js',
'src/modules/dropbox.js',
'src/modules/facebook.js',
'src/modules/flickr.js',
Expand Down
16 changes: 5 additions & 11 deletions src/hello.phonegap.js
Expand Up @@ -18,7 +18,7 @@
// Replace popup
hello.utils.popup = function(url, redirectUri, options) {

// utilPopup
// Run the standard
var popup = utilPopup.call(this, url, redirectUri, options);

// Create a function for reopening the popup, and assigning events to the new popup object
Expand Down Expand Up @@ -61,7 +61,7 @@

// Unfourtunatly an app is may not change the location of a InAppBrowser window.
// So to shim this, just open a new one.
popup.executeScript({code: 'window.location.href = "'+location+';"'});
popup.executeScript({code: 'window.location.href = "' + location + ';"'});
},

search: a.search,
Expand All @@ -71,6 +71,9 @@
close: function() {
if (popup.close) {
popup.close();
try {
popup.closed = true;
} catch (_e) {}
}
}
};
Expand All @@ -82,20 +85,11 @@

hello.utils.responseHandler(_popup, window);

// Always close the popup regardless of whether the hello.utils.responseHandler detects a state parameter or not in the querystring.
// Such situations might arise such as those in #63

_popup.close();

});
}
}
catch (e) {}

if (popup && popup.focus) {
popup.focus();
}

return popup;
};

Expand Down

0 comments on commit 30e1d62

Please sign in to comment.