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

IITCm runs plugin scripts before main script #1172

Closed nhamer closed 7 years ago

nhamer commented 7 years ago

loadScripts (ingress-intel-total-conversion/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java) builds this list of javascript to add for plugins, but appends the main IITC script at the end.

I'm not sure this needs to be fixed, but it's an unnecessary divergence from the desktop load order.

McBen commented 7 years ago

Load order is only important for the 'canvas-plugin' (must be loaded BEFORE the main script - initialize issues).

On Desktop the order is defined by installation order / users choice. You're free to move the main script to the end to be similar.

dingram commented 7 years ago

As we do have control over load order in IITCm, it makes sense to me to ensure that IITC itself is loaded first.

Also we should perhaps look at fixing the Canvas plugin so that it doesn't care about load order.

nhamer commented 7 years ago

The canvas plugin may well be the reason for the ordering - there's not really any other way to enable it besides running it before IITC (or special-casing it as a setting rather than a script)

The commit which introduced this ordering #41e60d5 wasn't tied to a specific bug

McBen commented 7 years ago

there is no reason why the load order should be sorted in any way (except canvas-plugin). Also there is no way to force users to sort their plugins in any way. So why bother?

nhamer commented 7 years ago

"because I know any number of scripts which assume this ordering, and it's confusing why they don't work on mobile", is really the main answer - and I recognize that's actually an argument for grandfathering ordering dependencies in practice.

"because I'd really like to override certain parts of IITC (and/or Leaftlet) before IITC actually boots" is sort of a minor reason.

Possible "fix" would be to change the plugin boilerplate so it (generally) runs plugin.load() followed by plugin.boot() or something.

But I agree, fix not necessary.

McBen commented 7 years ago

Loading & initiation is always a critical part in any application. As said: iitc don't have any control about the load order. That is done by TamperMonkey or Greasemonky or... except in iitcm where it is fixed.

You still can do any monkey-patching in your 'setup' function.