deltachat / deltachat-android

Email-based instant messaging for Android.
GNU General Public License v3.0
1.08k stars 144 forks source link

register as handler for `.xdc` file type #2532

Closed Simon-Laux closed 10 months ago

Simon-Laux commented 1 year ago

register for .xdc file extension then ask to which chat to attach as draft. Like that the file manager asks to open the file with deltachat and deltachat then asks the user where to send it to.

I recently showed someone deltachat and webxdc on android and I though this was already implemented, but seems like it is not.

desktop: https://github.com/deltachat/deltachat-desktop/issues/2886 iOS: https://github.com/deltachat/deltachat-ios/issues/1733

r10s commented 1 year ago

what works already today is to use "Share" the file in the file manager "to Delta Chat".

sure, a simple tap is a nice enhancement. might be easy to add as the functionality seems already there, cmp. https://stackoverflow.com/questions/4799576/register-a-new-file-type-in-android/55976817#55976817

monperrus commented 1 year ago

I confirm that one can open xdc files with 'share with' - 'saved messages'. register an handler would be great though!

adbenitez commented 10 months ago

opening files by extension doesn't work that fine in Android, I tried this already in DeltaLab, in the end a lot of apps get recommended anyway because they also just register to handle everything, and sometimes the filename/extension is not available in the URI for reasons, so I ended up registering for opening everything in DeltaLab so the sharing works for .xdc files but also for any other file that gets "opened with deltalab" which is a bit wierd

I don't think it makes much sense on mobile to have this feature, in desktop I see the point, but it is not like users will be playing around organizing in folders a collection of webxdc apps, that is not how most users work on android, and we have the in-app store for that apps management and sharing already, so I recommend closing this issue, we can reopen if it is considered otherwise at a later point

Simon-Laux commented 10 months ago

The point is you dl sth. in browser then you can just click on it to share it in deltachat. not to keep an collection as files.

have you tried this code?:

 <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="file" />
    <data android:host="*" />
    <data android:pathPattern=".*\\.xdc" />
  </intent-filter>

https://stackoverflow.com/questions/3760276/android-intent-filter-associate-app-with-file-extension

sometimes the filename/extension is not available in the URI for reasons

what is the exact problem and what code did you try?

I still think this is an important feature that make the experience rounder if we can get it to work. For windows, macOS and iOS this can also add special file icons for webxdc files (btw: on those 3 platforms it could even display the icon of the app if we have time for that experiment). Like you download a file press on it and it suggests deltachat, instead of thinking then might not coming up with the idea to share it in DC an giving up. not primary part sure, that will more likely be the store, but as it is a way that some users will try, we should aim to make it work and not just closing the issue on a whim without providing the details.

adbenitez commented 10 months ago

The point is you dl sth. in browser then you can just click on it to share it in deltachat. not to keep an collection as files.

that is exactly the sort of thing that will not work if you simply register for opening files with extension .xdc, that was what I used to try while implementing it in deltalab, I go to webxdc.org, click on the download of some of the games, then it is downloaded, I click the open button in the notification and you get an intent that does not have the file extension anywhere:

image

adbenitez commented 10 months ago

have you tried this code?:

yes

adbenitez commented 10 months ago

have you tried this code?:

 <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="file" />
    <data android:host="*" />
    <data android:pathPattern=".*\\.xdc" />
  </intent-filter>

as you can see in the screenshot, the scheme is not even file, it is content

adbenitez commented 10 months ago

@Simon-Laux why did you reopen? see my comment above

Simon-Laux commented 10 months ago

Ok now I get it's the notification intent that does not work, does it work in the file browser at least?

adbenitez commented 10 months ago

Ok now I get it's the notification intent that does not work, does it work in the file browser at least?

it varies from file manager to file manager... and then you enter the "organizing xdc files in folders" point from above to which you said "it is about open downloaded files directly not to keep a collection of files"

if you are not going to work in this issue, please close

Simon-Laux commented 10 months ago

Thanks for the elaboration, seems android really has no decent support for registering for custom file types. Especially after the move to not pass around real paths anymore. I searched around a bit and tried a few things with ZHV, because it was faster to iterate/build for me.

So unfortunately not really possible on android. Closing this issue again