feat(android): add gallery app integration (#1695) - #1696
Draft
tobikrs wants to merge 10 commits into
Draft
Conversation
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.
Fixes #1695
Memories did not appear in the Android system gallery chooser when tapping a camera
thumbnail, using "Open with" from a file manager, or selecting media in app pickers.
Approach
A new
ViewerActivityis registered as the entry point for all incoming media intents.On launch it resolves the incoming
content://URI against MediaStore and the localRoom DB, then routes to one of three modes:
MainActivitywith a#v/{dayId}/{localId}hash, opening the photo directly in the Memories WebView viewer.ViewerActivityfinishes immediately and is never visible.navigation, pinch-zoom images (PhotoView), video playback (ExoPlayer), share, and delete.
An "Open in Memories" FAB triggers the Mode A redirect when the user later logs in.
"Use this" action instead of share/delete, and returns the URI to the calling app via
setResult.Intent filters added to
ViewerActivitycom.android.camera.action.REVIEWandroid.provider.action.REVIEWACTION_VIEW image/*+video/*ACTION_PICKACTION_GET_CONTENTMainActivityis changed tosingleTaskso that a Mode A redirect brings the existinginstance to the foreground rather than creating a second one.
Other changes
MediaResolverService: resolves acontent://URI to structured media metadata(MediaStore
_ID,auid,dayId, MIME type) by querying MediaStore then Room DB.PlayerController: ExoPlayer logic extracted fromMainActivityinto a reusableclass (local URIs, remote HTTP/HLS, error fall-through). Both
MainActivityandViewerActivityuse it.MainActivity: gains apendingPhotoHashfield consumed inonNewIntent(),loadDefaultUrl(), andonPageFinished()to handle the Mode A deep-link reliablyregardless of whether the WebView has already finished loading.
com.github.chrisbanes:PhotoView:2.3.0) added as dependency for pinch-zoom.Reviewer notes
a specific photo in the Memories frontend (Vue Router watches
#v/{dayId}/{fileid}).the pager at the current photo. When the file is not in the DB, a single-item pager is
shown with swiping disabled.
MediaStore.createTrashRequest()on API 30+ and direct deletion on olderversions. On success the item is removed from the pager; if no items remain, the activity
finishes.