amake / orgro

An Org Mode file viewer for iOS and Android
https://orgro.org
GNU General Public License v3.0
452 stars 21 forks source link

Orgro appears as handler for non-Org files/links on Android #58

Open YuriySharlai opened 2 years ago

YuriySharlai commented 2 years ago

The program tries to open EPS files. It opens them as text files. For example, Gmail could show these files in emails, but after installations of ORGRO the files are opened by ORGRO as text files. It would be fine if ORGRO could show EPS files, but if it can not, it would be better not to try to.

amake commented 2 years ago

Thanks for the report. Can you tell me what OS you're using? Because there are various limitations and workarounds I've had to put in on both Android and iOS.

TriStaRvOiD commented 2 years ago

For context.. Orgro supports text files only. But it comes as an option in the "Open with" window of the system, no matter what type of file it is.

https://user-images.githubusercontent.com/58824912/160250727-0c8bbdcd-17bc-4335-901b-ee4362363adb.mp4

Edit: I'm on OneUI 4.0, Android 12, Samsung. But I'm very sure that this used to happen on my old xiaomi as well so this issue must not be device dependent.

amake commented 11 months ago

I never heard back from @YuriySharlai, but I will assume this is Android-specific.

The reason Orgro shows up as a handler for lots of things is because it seems that otherwise it will not show up at all when trying to open files from the file browser.

The relevant code was introduced in https://github.com/amake/orgro/commit/24d125c73cb66c29c9996ac93f0988f9c0b78994; it was based on this information.

Reading other, newer answers on that StackOverflow question, it seems that not much has changed in the meantime.

If there is a way to prevent Orgro from showing up when not appropriate, while still showing up when appropriate, then I would love to do that. But at the moment I don't know how.

TriStaRvOiD commented 10 months ago

Hey I managed to get something working. I replaced a line in one of the intent filters in the manifest file. I changed it to this: <data android:mimeType="application/org" />

I tested the modified debug one and the normal f-droid release. The file manager all-file-showing-up problem is gone in the debug one. You may want to test this change.

amake commented 10 months ago

Org files do not have a widely recognized MIME type. The official web site claims text/org, which shared-mime-info agrees with, but that's not officially registered, so it should be text/x-org. It should probably not be application/org.

Regardless, Android (and other OSes, as far as I know) does not automatically understand .org files to be any particular MIME type, and it seems there's no way to teach the OS about it.

I have two <intent-filter> blocks that specify mimeType:

So it sounds like actually all you did was break opening .org files via intent.

amake commented 10 months ago

Here are the intents I tested:

TriStaRvOiD commented 10 months ago

So it sounds like actually all you did was break opening .org files via intent.

You're right, it's broken.