Skip to content
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

Room / User suggestions #2674

Merged
merged 6 commits into from
Apr 8, 2024
Merged

Room / User suggestions #2674

merged 6 commits into from
Apr 8, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Apr 8, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Add DM suggestions to open an existing DM when user want to start a chat (Closes #2634), and add user suggestions to invite people when creating a room (Closes #2633)

Motivation and context

Closes #2633
Closes #2634

Screenshots / GIFs

See recorded once

Tests

  • After installing the app, visit a few rooms and DM to feel to Rust database
  • Click on the create room button
  • Observe that suggestions are displayed, and a click on it open the room
  • Go back to the room list
  • Click on the create room button
  • Click on "New room"
  • Observe that suggestions are displayed, and clicking on any add the user to the invitees list.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from a team as a code owner April 8, 2024 12:46
@bmarty bmarty requested review from jmartinesp and removed request for a team April 8, 2024 12:46
// by CreateRoomActionButtonsList
state = state.userListState.copy(
recentDirectRooms = persistentListOf(),
),
Copy link
Member Author

Choose a reason for hiding this comment

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

I do not really like to touch the state in the View, but adding another boolean like renderSuggestions to UserListView was more intrusive... Let me know what you reviewer(s) think, there are maybe other more elegant option.

Copy link
Member

Choose a reason for hiding this comment

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

Using a boolean parameter seems more correct, to be honest. Or maybe we could make it part of the UserListPresenterArgs, so it won't return any recentDirectRooms if it's false?

Copy link
Member Author

Choose a reason for hiding this comment

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

I also though about the option to enhance UserListPresenterArgs, but it does not work, the presenter is the same for both cases: suggestion for rooms and suggestion for users.

I will keep the current code, we may revisit later.

Copy link
Member

Choose a reason for hiding this comment

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

Is it the same presenter? I see one being instantiated in CreateRoomRootPresenter and another one in AddPeoplePresenter.

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, you're right.
Here the suggestions have to be in the state (so the presenter has to provide them, that's why I wanted to say by "the presenter is the same"), but are rendered in CreateRoomActionButtonsList and not in UserListView, from the same method (CreateRoomRootView).

Copy link
Contributor

github-actions bot commented Apr 8, 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/mD2HCc

Copy link

codecov bot commented Apr 8, 2024

Codecov Report

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

Project coverage is 73.56%. Comparing base (b6ceb8c) to head (16d289e).
Report is 3 commits behind head on develop.

Files Patch % Lines
...braries/matrix/api/room/recent/RecentDirectRoom.kt 47.61% 10 Missing and 1 partial ⚠️
...eatures/createroom/impl/components/UserListView.kt 60.00% 6 Missing and 2 partials ⚠️
...eatures/createroom/impl/root/CreateRoomRootView.kt 72.00% 3 Missing and 4 partials ⚠️
...eatures/createroom/impl/addpeople/AddPeopleView.kt 33.33% 3 Missing and 1 partial ⚠️
...nt/android/libraries/matrix/api/room/MatrixRoom.kt 0.00% 1 Missing ⚠️
...droid/libraries/matrix/test/room/FakeMatrixRoom.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2674      +/-   ##
===========================================
+ Coverage    73.55%   73.56%   +0.01%     
===========================================
  Files         1457     1458       +1     
  Lines        35221    35209      -12     
  Branches      6757     6761       +4     
===========================================
- Hits         25907    25903       -4     
+ Misses        5790     5787       -3     
+ Partials      3524     3519       -5     

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

Copy link

sonarqubecloud bot commented Apr 8, 2024

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

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

I have a couple of suggestions, otherwise LGTM!

@@ -74,6 +84,43 @@ fun UserListView(
},
)
}
if (!state.isSearchActive && state.recentDirectRooms.isNotEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this could be moved to its own component?

Copy link
Member Author

Choose a reason for hiding this comment

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

I though about it, and I originally did it like this, but the list items are not the same, so it's complicating thing with small added value.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm ok, I was talking about something like this:

Screenshot image

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah OK, extracting a function, sorry I misunderstood :)

// by CreateRoomActionButtonsList
state = state.userListState.copy(
recentDirectRooms = persistentListOf(),
),
Copy link
Member

Choose a reason for hiding this comment

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

Using a boolean parameter seems more correct, to be honest. Or maybe we could make it part of the UserListPresenterArgs, so it won't return any recentDirectRooms if it's false?

@bmarty bmarty merged commit 014061f into develop Apr 8, 2024
16 checks passed
@bmarty bmarty deleted the feature/bma/roomSuggestion branch April 8, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants