From dcf2807e75bcdb10266dbdd5f89cef2024656675 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 30 Jul 2026 16:07:52 +0000 Subject: [PATCH] fix: address audit findings on the media share targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Correct the KDoc on the Shorts and Longs composers. They claimed everything posted from them lands in that feed; VideoPostKind only governs videos, and the gallery picker takes images with no mime filter, so a picked JPEG still posts as a kind-20 picture that neither feed reads. Say so instead of asserting a false invariant. - Forward the shared text as the composer's caption. The media targets dropped EXTRA_TEXT entirely, so sharing a photo with a caption lost it — while the DM target kept it. The routes now carry the message and NewMediaModel.load() seeds the caption field from it. - Accept SEND_MULTIPLE on the three media targets. Sharing several files at once previously did not offer Amethyst at all, even though the picture composer publishes N images as one kind-20 event. Routes carry a URI list; other targets take the first. - Replace, rather than stack, a feed entry when a second share arrives while the first is still open. Only entries that carry attachments are replaced, so a feed reached from the bottom bar keeps its tab-root marker underneath. - Rename NewImageButton to NewVideoFeedButton: it is the Video feed's composer and handles pictures and video alike. Adds ShareTargetManifestTest, which pins the activity-alias names in AndroidManifest.xml to the constants ShareIntentRouting matches them by — in both directions, plus the SEND_MULTIPLE filters. That link is invisible to the compiler and fails silently at runtime by routing a share to the wrong composer. Verified the guard bites by renaming an alias in the manifest alone: three of its four tests go red. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01R4WsYWaNMPD34SBc6Ej6hx --- amethyst/src/main/AndroidManifest.xml | 18 +++ .../amethyst/ui/actions/NewMediaModel.kt | 3 +- .../amethyst/ui/actions/NewMediaView.kt | 5 +- .../ui/actions/uploads/SharedMediaResolver.kt | 20 +++ .../amethyst/ui/navigation/AppNavigation.kt | 86 +++++++---- .../amethyst/ui/navigation/routes/Routes.kt | 44 ++++-- .../loggedIn/longs/NewLongVideoButton.kt | 6 +- .../loggedIn/pictures/NewPictureButton.kt | 19 ++- .../loggedIn/pictures/PicturesScreen.kt | 11 +- .../loggedIn/shorts/NewShortVideoButton.kt | 19 ++- .../ui/screen/loggedIn/shorts/ShortsScreen.kt | 11 +- ...ewImageButton.kt => NewVideoFeedButton.kt} | 22 +-- .../ui/screen/loggedIn/video/VideoScreen.kt | 11 +- .../navigation/ShareTargetManifestTest.kt | 135 ++++++++++++++++++ 14 files changed, 330 insertions(+), 80 deletions(-) rename amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/{NewImageButton.kt => NewVideoFeedButton.kt} (90%) create mode 100644 amethyst/src/test/java/com/vitorpamplona/amethyst/navigation/ShareTargetManifestTest.kt diff --git a/amethyst/src/main/AndroidManifest.xml b/amethyst/src/main/AndroidManifest.xml index 4ab04778a6..0a15d222cd 100644 --- a/amethyst/src/main/AndroidManifest.xml +++ b/amethyst/src/main/AndroidManifest.xml @@ -310,6 +310,12 @@ + + + + + +