iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
991 stars 552 forks source link

Mobile app doesn't re-inject javascript on a new page load #842

Closed jonatkins closed 10 years ago

jonatkins commented 10 years ago

When re-loading the intel page from within javascript, by window.location.reload(), (e.g. the "out of date" error dialog), the web page does reload, but the IITC javascript is not re-injected.

Additionally, it would be useful, in this specific case, to be able to clear the WebView cache (or specifically, if possible, the cached gen_dashboard.js) as well.

so

  1. the mobile app should ensure javascript is re-injected after navigation to a new page (but only on the www.ingress.com/intel base URL - not navigation to other pages like authentication)
  2. a function to clear the webview cache (or a specific file). If it makes more sense, a single method to clear the cache then reload the page is an alternative.
fkloft commented 10 years ago

IIRC, this is due to another bug in WebView. (Did I already mention how much I love that thing?)

There is a callback that gets fired when a page has finished loading, but it gets fired way too often. Therefor, we only inject once and set a flag. The flag is reset a) when a Google login request is detected (even though we cannot answer that request) or b) when reload is selected from the menu.

I think the best solution would be to provide a new method (android.reload(clearCacue) or similar) and use that instead of location.reload(). This method can reset the flag.

jonatkins commented 10 years ago

I did wonder if there was another reason. Yes, a method as you suggest sounds fine.

fkloft commented 10 years ago

Fixed.