Repository navigation
fix(mobile): pick the album through the gallery contract, not a raw intent - #838
Merged
Merged
Conversation
…ntent
The system-gallery album route launched ACTION_PICK through
expo-intent-launcher and read `result.data` as a file URI. expo-intent-launcher
resolves that field to the result Intent's string — `"Intent { act=… dat=… }"` —
so the chosen photo could never open: the pick would fail to decode instead.
The route only appeared to work because the reporting phone has no gallery and
falls to the in-app grid.
Use expo-image-picker's legacy contract for that route: it is ACTION_GET_CONTENT
for images, and it returns the chosen URIs (single or multi) properly. Each pick
is copied into the cache before the shared attachment pipeline sees it, exactly
like an album-grid pick, because a gallery grants read access to the photos, not
a durable file.
The router keeps the same guarantees, adjusted for what a contract can do: the
contract cannot target one component, so the gallery route is only taken when a
recognized gallery answers the intent the app actually launches (image
ACTION_GET_CONTENT). A gallery that only advertises ACTION_PICK on MediaStore's
image collection falls through to the photo-picker contract or the in-app grid
rather than risking a file browser under the album label. Nothing else changes:
photo pickers still win, and a device with no picker at all still gets the grid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Found while investigating the album's system routes for a device report: the system-gallery route could never return a usable photo. It launched
ACTION_PICKthroughexpo-intent-launcherand readresult.dataas a file URI — but that field is the result Intent's string ("Intent { act=… dat=content://… }"; seeIntentLauncherModule.OnActivityResult, which storespayload.data.toString()). The pick therefore decoded nothing. It went unnoticed because the reporting phone has no gallery app and takes the in-app grid instead (added in #836); every other device on that route would have failed.Now:
ACTION_GET_CONTENTfor images — which returns the chosen URIs correctly, single or multi. Each pick is copied into the cache before the shared attachment pipeline sees it, exactly like an album-grid pick, because a gallery grants read access to the photos rather than a durable file.ACTION_GET_CONTENT). A gallery that only advertisesACTION_PICKon MediaStore's image collection falls through to the photo-picker contract or the in-app grid, rather than risking a file browser under the album label.expo-intent-launcheris no longer used for picking.Validation
tsc --noEmit,eslintclean, mobile 128 suites / 2035 tests pass. The album tests now assert the gallery contract (legacy: true, multi-select, selection limit) and the classification/degradation cases; theexpo-intent-launchermock is gone fromfiles.test.ts.docs/internals/mobile/README.md,README.zh-CN.md,harmonyos-compatibility.zh-CN.md(including why a raw intent pick must not be reintroduced).