Skip to content

Adapt to new DM definition changes in the SDK#6748

Open
jmartinesp wants to merge 7 commits intodevelopfrom
misc/adapt-to-is-dm-changes
Open

Adapt to new DM definition changes in the SDK#6748
jmartinesp wants to merge 7 commits intodevelopfrom
misc/adapt-to-is-dm-changes

Conversation

@jmartinesp
Copy link
Copy Markdown
Member

@jmartinesp jmartinesp commented May 7, 2026

Content

These changes try to centralise every check about whether a room is a DM or not using the new SDK APIs.

  • Use ClientBuilder.dmRoomDefinition(DmRoomDefinition.TwoPeople), which makes the SDK consider a DM a room with 1 direct target and at most two non-service members in it.
  • Add RoomMember.isServiceMember to tell apart normal room member and service/functional ones.
  • Use Room.isDm as a shortcut to Room.roomInfoFlow.value.isDm, remove all other isDm implementations so only the SDK one is valid.
  • Replace isDirect checks with isDm where possible for Room, SpaceRoom, RoomInfo, etc.

Motivation and context

Centralises how the DM checks are done.

Fixes #6717.
Also fixes #4034, since the previous issue is a task that implements the needed changes.

Screenshots / GIFs

No screenshot changes, since just the internal checks changed.

Tests

  • Check a direct room with > 2 users is not a DM.
  • Check a direct room with <= 2 non service users and the rest of them being service users is a DM.
  • Check DMs don't display the avatar or display name of the service members (they're not part of the heroes).
  • Notifications and incoming calls also tell apart DMs from non-DMs correctly based on the same logic.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 15

Checklist

  • 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/1esTrU

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 87.23404% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.22%. Comparing base (245c30c) to head (269b4f3).

Files with missing lines Patch % Lines
...ns/edit/EditDefaultNotificationSettingPresenter.kt 83.33% 0 Missing and 1 partial ⚠️
...roid/libraries/matrix/api/analytics/ViewRoomExt.kt 0.00% 1 Missing ⚠️
...roid/libraries/matrix/api/room/RoomMembersState.kt 0.00% 0 Missing and 1 partial ⚠️
...ies/matrix/impl/notification/NotificationMapper.kt 50.00% 0 Missing and 1 partial ⚠️
...droid/libraries/matrix/impl/room/JoinedRustRoom.kt 0.00% 1 Missing ⚠️
...android/libraries/matrix/impl/room/RustBaseRoom.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #6748   +/-   ##
========================================
  Coverage    81.22%   81.22%           
========================================
  Files         2634     2633    -1     
  Lines        73469    73488   +19     
  Branches      9496     9495    -1     
========================================
+ Hits         59676    59694   +18     
  Misses       10301    10301           
- Partials      3492     3493    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@frebib
Copy link
Copy Markdown
Contributor

frebib commented May 7, 2026

I swapped out my patches for this and it seems to work perfectly.
This PR fixes #4034

@jmartinesp jmartinesp added the PR-Change For updates to an existing feature label May 7, 2026
jmartinesp added 7 commits May 7, 2026 18:06
This applies the 'direct and with at most 2 non-service members' rule to what the SDK should consider a DM.
…ant.

Move `Room.isDm` helper function to `BaseRoom`.
…t normal members of a room from service members (i.e. `RoomMembersState.getDirectRoomMember`)
@jmartinesp jmartinesp force-pushed the misc/adapt-to-is-dm-changes branch from 17d5590 to 269b4f3 Compare May 7, 2026 16:18
@jmartinesp jmartinesp changed the title WIP: Adapt to new DM changes Adapt to new DM definition changes in the SDK May 7, 2026
@jmartinesp jmartinesp marked this pull request as ready for review May 7, 2026 16:18
@jmartinesp jmartinesp requested a review from a team as a code owner May 7, 2026 16:18
@jmartinesp jmartinesp requested review from bmarty and removed request for a team May 7, 2026 16:18
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@jmartinesp jmartinesp added Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. and removed Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. labels May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Change For updates to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Use DmRoomDefinition and RoomInfo.isDm Treat DM rooms with bridge bots as People using MSC4171 service member functionality

2 participants