Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support VIEW intents on Android. #1799

Merged
merged 4 commits into from
Jun 16, 2024

Conversation

MAJigsaw77
Copy link
Contributor

This pr adds Drop file event support by including the intent-filter reference onAndroidManifest.xml.

@MAJigsaw77
Copy link
Contributor Author

This pr is splitted from #1795.

@player-03
Copy link
Contributor

Now that I've reviewed the documentation, I'm pretty sure this means whenever you choose to view any file, the system will display a list of every single Lime application on the device. Including apps that weren't designed to receive files, whose developers didn't realize this was in the manifest.

So again, I really think this should be handled on a per-app basis by using templates. If Lime was going to include it, it would need to be disabled by default and configurable from project.xml.

@MAJigsaw77
Copy link
Contributor Author

Now that I've reviewed the documentation, I'm pretty sure this means whenever you choose to view any file, the system will display a list of every single Lime application on the device. Including apps that weren't designed to receive files, whose developers didn't realize this was in the manifest.

So again, I really think this should be handled on a per-app basis by using templates. If Lime was going to include it, it would need to be disabled by default and configurable from project.xml.

In the code <data android:mimeType="*/*" /> this line can indeed be modified to use tamplates.

@MAJigsaw77
Copy link
Contributor Author

@player-03 is the code fine now?

@player-03
Copy link
Contributor

I'm a little worried <config:android mimeType="application/json" /> could give the wrong impression that you're somehow setting the type of the app itself. Here are some other ideas.

<config:android accepted-mime-type="application/json" />
<config:android drop-file-type="application/json" />
<config:android view-intent-filter="application/json" />
<config:android allow-drop-file="application/json" />
<config:android view-file="application/json" />
<config:android accept-intent="application/json" />
<config:android accept-file-intent="application/json" />

I think I like accept-file-intent as a compromise between length and descriptiveness.

  • "Accept" makes it clear the app is receiving events from elsewhere, rather than creating them (another common way to open files). Plus, terms like "accept" and "allow" imply that there can be more than one of this config entry. Something like view-intent-filter could imply there's only one filter, and if you set it a second time you'll overwrite the first or narrow down the filter or something.
  • "File" helps distinguish this from any other intents we might decide to support later.
  • "Intent" is important in case someone wants to look up more information. Searching for "accept file android" primarily returns results about transferring files to your phone, whereas "accept file intent android" finds <intent-filter />.

@MAJigsaw77
Copy link
Contributor Author

I'm a little worried <config:android mimeType="application/json" /> could give the wrong impression that you're somehow setting the type of the app itself. Here are some other ideas.

<config:android accepted-mime-type="application/json" />
<config:android drop-file-type="application/json" />
<config:android view-intent-filter="application/json" />
<config:android allow-drop-file="application/json" />
<config:android view-file="application/json" />
<config:android accept-intent="application/json" />
<config:android accept-file-intent="application/json" />

I think I like accept-file-intent as a compromise between length and descriptiveness.

  • "Accept" makes it clear the app is receiving events from elsewhere, rather than creating them (another common way to open files). Plus, terms like "accept" and "allow" imply that there can be more than one of this config entry. Something like view-intent-filter could imply there's only one filter, and if you set it a second time you'll overwrite the first or narrow down the filter or something.
  • "File" helps distinguish this from any other intents we might decide to support later.
  • "Intent" is important in case someone wants to look up more information. Searching for "accept file android" primarily returns results about transferring files to your phone, whereas "accept file intent android" finds <intent-filter />.

I'll change it to accept-file-intent then.

@MAJigsaw77
Copy link
Contributor Author

@player-03 Is it fine now?

@player-03 player-03 changed the title Add Drop File event support for android. Support VIEW intents on Android. Jun 16, 2024
@player-03 player-03 merged commit 0e0dd0b into openfl:8.2.0-Dev Jun 16, 2024
26 checks passed
@MAJigsaw77 MAJigsaw77 deleted the add-drop-event-android branch June 17, 2024 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants