Skip to content

Conversation

@d4rken
Copy link
Member

@d4rken d4rken commented Oct 7, 2025

Created ViewIntentTool to centralize file viewing intent creation. Previously, opening files (especially PDFs) would fail with ActivityNotFoundException because:

  • Missing MIME type specification
  • Using raw file:// URIs instead of FileProvider content:// URIs
  • Missing FLAG_GRANT_READ_URI_PERMISSION

The new tool properly:

  • Creates FileProvider URIs with correct authority
  • Determines and sets MIME types using MimeTypeTool
  • Adds necessary permission flags for external apps
  • Creates chooser intent for better UX
  • Returns null for unsupported path types

Also refactored ContentViewModel to use the same logic, eliminating code duplication.

Closes #1974

Created ViewIntentTool to centralize file viewing intent creation.
Previously, opening files (especially PDFs) would fail with
ActivityNotFoundException because:
- Missing MIME type specification
- Using raw file:// URIs instead of FileProvider content:// URIs
- Missing FLAG_GRANT_READ_URI_PERMISSION

The new tool properly:
- Creates FileProvider URIs with correct authority
- Determines and sets MIME types using MimeTypeTool
- Adds necessary permission flags for external apps
- Creates chooser intent for better UX
- Returns null for unsupported path types

Also refactored ContentViewModel to use the same logic, eliminating
code duplication.

Closes #1974
@d4rken d4rken added bug Something isn't working as expected c: Deduplicator labels Oct 7, 2025
@d4rken d4rken merged commit 049d07e into main Oct 7, 2025
13 checks passed
@d4rken d4rken deleted the pdf-preview-1974 branch October 7, 2025 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected c: Deduplicator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

option to handle pdf or other documents file

3 participants