Skip to content

Send to the conversation picked in the share sheet - #7672

Open
Xant3s wants to merge 1 commit into
element-hq:developfrom
Xant3s:feature/direct-share-routing
Open

Send to the conversation picked in the share sheet#7672
Xant3s wants to merge 1 commit into
element-hq:developfrom
Xant3s:feature/direct-share-routing

Conversation

@Xant3s

@Xant3s Xant3s commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Content

The Direct Share row of the system share sheet already offered conversations, but picking one did nothing with that choice: the app still showed the account picker (when there is more than one account), then the room picker. The system names the chosen shortcut in Intent.EXTRA_SHORTCUT_ID, which nothing read. The share now carries that id, and the session it belongs to resolves the room it was built for.

Follows #7574, which declared the <share-target> that makes the row appear.

Motivation and context

Part of #3835

Tests

Unit tests cover the id format (ConversationShortcutIdTest), the id reaching ShareIntentData for both plain text and uris (DefaultShareIntentHandlerTest), and the presenter sending without a selection — including the case where the shortcut belongs to a different account than the one handling the share (SharePresenterTest).

Manually:

  • Send a message in a room, so its conversation shortcut is published.
  • Share text from another app and pick that conversation in the Direct Share row.
    The message is sent to that room, with no account or room picker.
  • Same with an image.

Tested devices

  • Physical
  • Emulator
  • OS version(s): API 34 (Android 14)

Checklist

  • I am aware of the etiquette.
  • This PR was made with the help of AI:
    • Yes. In this case, please request a review by Copilot.
    • No.
  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly defines what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

Picking a conversation in the Direct Share row did nothing with that choice:
the app still opened the account picker, then the room picker, so the shortcut
saved no steps over sharing to Element X itself.

The system names the chosen shortcut in Intent.EXTRA_SHORTCUT_ID, which nothing
read. The share now carries that id, and the session it belongs to resolves the
room it was built for, so the share goes straight there. The id format moves to
the push api module, since building and matching it is no longer something only
the notification code does.

The extra is absent when the app is opened from a launcher shortcut rather than
the Direct Share row, and an id that matches no logged in session resolves to
nothing, so both fall back to the pickers as before.

Part of element-hq#3835

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Xant3s
Xant3s requested a review from a team as a code owner September 9, 2026 11:28
@Xant3s
Xant3s requested review from bmarty and removed request for a team September 9, 2026 11:28
@github-actions github-actions Bot added the Z-Community-PR Issue is solved by a community member's PR label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:

  • If your pull request adds a feature or modifies the UI, this should have an equivalent pull request in the Element X iOS repo unless it only affects an Android-only behaviour or is behind a disabled feature flag, since we need parity in both clients to consider a feature done. It will also need to be approved by our product and design teams before being merged, so it's usually a good idea to discuss the changes in a Github issue first and then start working on them once the approach has been validated.
  • Your branch should be based on origin/develop, at least when it was created.
  • The title of the PR will be used for release notes, so it needs to describe the change visible to the user.
  • The test pass locally running ./gradlew test.
  • The code quality check suite pass locally running ./gradlew runQualityChecks.
  • If you modified anything related to the UI, including previews, you'll have to run the Record screenshots GH action in your forked repo: that will generate compatible new screenshots. However, given Github Actions limitations, it will prevent the CI from running temporarily, until you upload a new commit after that one. To do so, just pull the latest changes and push an empty commit.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

PR Checks

  • ❌ Please add a single PR- label to categorise the changelog entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant