koreader / android-luajit-launcher

Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
MIT License
131 stars 85 forks source link

file intents lack pure epub (without "+zip") #440

Closed Codereamp closed 11 months ago

Codereamp commented 1 year ago

My experience on Nook Glowlight 4e with Android 8 was that when a plenty of readers were installed, opening a pure epub file from RelaunchX never listed KoReader (while listing all others). Today I indexed the sources and noticed that the AndroidManifest.xml (platform\android\luajit-launcher\app\src\main\AndroidManifest.xml ) has an entry for epub+zip file

<data android:mimeType="application/epub+zip" />

but no entry for epub.

For reference both original CoolReader and the manifest probably kept from it in the sources (base\thirdparty\kpvcrlib\crengine\android\AndroidManifest.xml) has this entry

<data android:mimeType="application/epub"/>

pazos commented 1 year ago

Hi, if the issue goes away adding that line to the manifest please send a patch.

Anyhow, the mimetype we're using is the correct one and the problem lies in the program sending the intent.

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types

pazos commented 1 year ago

Indeed, you might want to submit a patch to RelaunchX too, so they send a valid intent: https://github.com/Leszek111/ReLaunchX/blob/bc1d07a11dc6893a1fbdd7fdd45f2cbbf1e6c282/app/src/main/java/com/gacode/relaunchx/ReLaunch.java#L98

pazos commented 1 year ago

Over a collection of epub files you might want to see which ones have invalid mimetypes buried in: https://www.mobileread.com/forums/showthread.php?t=299415

None of them should use an invalid mimetype.

Regarding android development: no program that uses MimeTypeMap or harcodes valid mimes should have a problem.

The issue is with programs that do nasty stuff, and there're many on android :/

Codereamp commented 1 year ago

pazos, thank you it was too quick on my side to assume the problem was on KoReader side. Filed a report at RelaunchX

pazos commented 1 year ago

@Codereamp: I submitted a patch in https://github.com/Leszek111/ReLaunchX/pull/27

It looks like @Leszek111 isn't active on github anymore.

Codereamp commented 1 year ago

@pazos : yes, it looks like s/he isn't. Thanks for the patch, I will have this as a an option to compile the patched APK. As for KoReader, you can probably close this issue as not planned. Only my final argument for making an exception by adding non-official type. A reply at mobileread mentioned

RelaunchX just shows 6 apps for epub, while other programs (Relaunch-1.4.4, Total Commander) show 12 apps.

This means that 6 out of 12 apps at the moment had this exception. Just a statistical argument that this might not be a big deal from the point of stability and purity :)

pazos commented 11 months ago

@Codereamp: it looks I was wrong. RelaunchX was updated a few weeks ago. The new version was released on Fdroid. It should work fine with KOReader as is :smile:

Codereamp commented 11 months ago

Confirmed, the association now works, thanks!