Skip to content

Improve room setting edition #2849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 16, 2024
Merged

Improve room setting edition #2849

merged 17 commits into from
May 16, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented May 15, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

May be reviewed commit per commit, first commits are cleanup.

Ensure that when editing room setting, the actual m.room.name value is used to fill the form, and not the computed name. Closes #2844, but there is an issue SDK side, rawName contains the displayName. It's discussed internally:

image

Also make the room details (topic/name/avatar) live in this screen, in case it's changes by someone else, or by another session.

Motivation and context

Screenshots / GIFs

Tests

  • Open room setting with a no-name room and observe that the room name field is empty. (Note: see the SDK limitation above)
  • Make some change and ensure that the 'Save' action works as expected and is enabled when expected.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from a team as a code owner May 15, 2024 12:24
@bmarty bmarty requested review from ganfra and removed request for a team May 15, 2024 12:24
Copy link
Contributor

github-actions bot commented May 15, 2024

📱 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/Wapwrp

Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 89.92248% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 74.06%. Comparing base (4f74dd4) to head (5ab96c3).
Report is 6 commits behind head on develop.

Files Patch % Lines
...ndroid/libraries/matrix/ui/room/MatrixRoomState.kt 33.33% 3 Missing and 3 partials ⚠️
...es/matrix/ui/components/AvatarActionBottomSheet.kt 63.63% 3 Missing and 1 partial ⚠️
...createroom/impl/configureroom/ConfigureRoomView.kt 75.00% 1 Missing ⚠️
...ences/impl/user/editprofile/EditUserProfileView.kt 90.00% 1 Missing ⚠️
.../roomdetails/impl/edit/RoomDetailsEditPresenter.kt 97.22% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2849      +/-   ##
===========================================
+ Coverage    73.99%   74.06%   +0.07%     
===========================================
  Files         1531     1530       -1     
  Lines        36526    36539      +13     
  Branches      7065     7054      -11     
===========================================
+ Hits         27028    27064      +36     
+ Misses        5796     5788       -8     
+ Partials      3702     3687      -15     

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

bmarty added 2 commits May 15, 2024 15:19
Also correctly handle the back press when this bottom sheet is opened, previously it was leaving the room edition screen.
ModalBottomSheetLayout can now be deleted.
Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some remarks, otherwise LGTM

val roomAvatarUri = room.avatarUrl()?.toUri()
var roomAvatarUriEdited by rememberSaveable { mutableStateOf<Uri?>(null) }
LaunchedEffect(roomAvatarUri) {
// Every time the roomAvatar change (from sync), we can set the new avatar.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to have live values here? I'd expect to be static

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it's fine, having the value change during edition should not happen a lot, just during our cheeky tests :)

roomSyncUpdateFlow.value,
roomName,
roomTopic,
roomRawNameTrimmed,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit weird to use remember with keys used in derivatedStateOf

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tried to remove the keys, but this does not work as expected, for instance roomRawNameTrimmed is always empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because roomRawNameTrimmed is not backed by a compose state field.
But then I think the derivedStateOf doesn't make sense

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so I have a mix in c3caff0. I think it's still relevant to use de derivedStateOf in this case.

@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label May 15, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label May 15, 2024
@Composable
fun AvatarActionBottomSheet(
actions: ImmutableList<AvatarAction>,
modalBottomSheetState: ModalBottomSheetState,
isVisible: MutableState<Boolean>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch ElementBot! Please use a plain Boolean and a lambda parameter to update it outside. The isVisible should probably be hold in the relevant Presenter states

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label May 15, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label May 15, 2024
@bmarty bmarty enabled auto-merge May 15, 2024 19:16
@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label May 15, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label May 15, 2024
@bmarty bmarty merged commit 9d4cfd8 into develop May 16, 2024
22 of 23 checks passed
@bmarty bmarty deleted the feature/bma/roomNameEdition branch May 16, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use RoomInfo.rawName to populate the room name in room setting edition
2 participants