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

Enable iitc mobile to load *additional* plugins without full dev mode #327

Closed llnik closed 11 years ago

llnik commented 11 years ago

Hi there,

it would be great to be able to load additional plugins (to the ones compiled into the apk) without the need to use the full developer mode (i.e. copy all sources to sd etc). Maybe a toggle in the developer settings would suffice (full dev mode - like it is now vs. only load additional plugins from IITC-Mobile/plugins)

jonatkins commented 11 years ago

That's exactly what it already does - IITC_Mobile/plugins on the storage.

llnik commented 11 years ago

I tried it right now - it doesn't work without developer mode. But when I enable developer mode, it wants to load all scripts (iitc + plugins) from storage.

The initial commit which brought the sideloading of plugins has an if block which checks for an enabled developer mode.

See https://github.com/jonatkins/ingress-intel-total-conversion/commit/710f4bf04eaddb18b1f45b72a1dde75f840a31aa

/Edit: I used "test"-branch to test this ;-)

jonatkins commented 11 years ago

although, in the current dev build, this seems to be broken.

@leCradle - I'm not seeing my custom map layer plugins (e.g. CloudMade) in the latest mobile dev build.

leCradle commented 11 years ago

@jonatkins well it works for me... Does your custom plugin has the correct layout (same as every other iitc plugin)? Since the wrapper and the injection code is removed by the app it has to be like on all other plugins. Check this first...if it is equal to any other plugin...can you provide a logcat output? "adb logcat | grep iitcm" for example.

leCradle commented 11 years ago

@llnik Additional plugins do not depend on an enabled dev-mode. Which if-block do you mean? if (dev_enabled) { ... } ? Inside this if-statement only plugins from <sdcard>/IITC_Mobile/dev/plugins/ are loaded. Additional plugins (dev-mode independent) should be in <sdcard>/IITC_Mobile/plugins/

llnik commented 11 years ago

Ok, case can be closed. Actually the comment in https://github.com/jonatkins/ingress-intel-total-conversion/blob/master/mobile/src/com/cradle/iitc_mobile/IITC_WebViewClient.java#L169 is misleading - it said the directory was IITC-Mobile, not IITC_Mobile (underscore).

My plugin is loaded and works, the only thing which would be nice to have is that my custom plugin is not listed under Settings > Plugins - it is always active. Any chance to get custom plugins into this dialogue?

leCradle commented 11 years ago

@llnik Yes the comment is not correct. Thx for the hint.

Regarding your question. Of course it is possible (and I already coded it)...but you will get the following problem: Assume that you have 4 additional plugins...all enabled via the dialog. Then you remove 2 of them from your sdcard. The problem is, that you still have a preference database entry for these 2 files...and on any reload IITCM will try to load these 2 missing plugins. You won't even notice this, because iitcm checks that this file does not exists and quits parsing it, but it will slow down things a little bit. This will last until you wipe your data or add the plugin again, disable it in the settings, and remove it again.

As said, I already implemented it and it is not a big problem...but yeah... @jonatkins should I commit this feature? I think we can add this, because if you can disable the script via dialog there is no need in removing additional plugins from sdcard (who cares about these few bytes), so this should be no problem.

jonatkins commented 11 years ago

My commit 2d247322f9a828b9fa4771ccd82bc774a6683890 fixes the issue I was having with plugins - was due to Windows style CR-LF line endings

jonatkins commented 11 years ago

As for listing them amongst the built-in plugins - no strong views here. Some kind of identification of the different type should be included in the plugin list though (could be a simple prefix/marker on the name - e.g. a "*", "[user]") just to clarify which are user supplied.

I'll leave it up to you, @leCradle