Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

Fix issues loading Gmaps API in a cordova app when the app has no initial network connection #1567

Closed
wants to merge 4 commits into from

Conversation

jabas06
Copy link
Contributor

@jabas06 jabas06 commented Oct 16, 2015

  • The safety check for window.navigator.connection and window.Connection in cordova apps should wait until device is ready. See issue online listener is not added on Cordova app #1520
  • There is an issue in cordova apps on android where network events (online/offline) are fired multiple times in a row. This PR includes a workaround to deal with this.
  • Fixes an error raised when a script tag for Gmaps API is already in the document (see issue #<HTMLScriptElement> has no method 'remove' #1521). In my case this problem arose because the previous issue (network events fired multiple times ).

@nmccready
Copy link
Contributor

I need to find an evening to dig into this. Your other PR will probably get merged soon.

@@ -34,6 +38,25 @@ angular.module('uiGmapgoogle-maps.providers')
isGoogleMapsLoaded = ->
angular.isDefined(window.google) and angular.isDefined(window.google.maps)

onWindowLoad = (options)->
# if its a WebView
if !(!window.cordova && !window.PhoneGap && !window.phonegap && !window.forge)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So overall this looks good. But the main problem I have with it is all this extra logic to keep supporting different environments all thrown into one factory.

It would be nice if the onWindowLoad code actually comes from another provider, factory, or service where it can be overridden easily. I fear this will just keep growing.

@jabas06 I'll take care of this part. If u can confirm or add in the above functions for clarity that would be helpful.

@nmccready
Copy link
Contributor

@jabas06 ping?

@jabas06
Copy link
Contributor Author

jabas06 commented Oct 26, 2015

sorry @nmccready, I've been to busy. I'will try to push some changes with your suggestions this weekend.

@nmccready
Copy link
Contributor

@jabas06 no worries just trying to double check if we can proceed with this. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants