Skip to content

fix(android): open attachments directly with default viewer app#33

Open
arnauda-gh wants to merge 1 commit into
bulwarkmail:mainfrom
arnauda-gh:fix/attachment-direct-view
Open

fix(android): open attachments directly with default viewer app#33
arnauda-gh wants to merge 1 commit into
bulwarkmail:mainfrom
arnauda-gh:fix/attachment-direct-view

Conversation

@arnauda-gh

@arnauda-gh arnauda-gh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #32

Summary

Fixes an issue where tapping an email attachment (or file in Files view) on Android opened the system Share sheet ("Partager avec...") instead of opening the file directly in a default viewer application (such as PDF Viewer, Gallery, Video Player, or Document Viewer).

Solution

  • Updated shareAttachment in src/lib/email-export.ts to convert the downloaded file's URI to a content:// URI using FileSystemLegacy.getContentUriAsync on Android.
  • Launches android.intent.action.VIEW via expo-intent-launcher with FLAG_GRANT_READ_URI_PERMISSION.
  • Includes fallback to Sharing.shareAsync if no application is installed on the device for the given file format.

!! AI WARNING !! : This PR was generated and created by AI. It has been tested on my own use case and seems to work. However have a deep look about the generated code.

Fixes bulwarkmail#32.

On Android, Sharing.shareAsync triggers Intent.ACTION_SEND (Share sheet). Updated shareAttachment to convert the file URI to a content URI and launch android.intent.action.VIEW via expo-intent-launcher, with fallback to shareAsync if no viewer application is installed for the MIME type.
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.

fix(android): open attachments directly with default viewer app instead of share sheet

1 participant