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

Initial support for member suggestions #1631

Merged
merged 14 commits into from
Oct 27, 2023

Conversation

jmartinesp
Copy link
Contributor

@jmartinesp jmartinesp commented Oct 24, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Added code to:

  • Listen to RTE updates for mention suggestions.
  • Use these updates to filter room members.
  • Display the resulting list of possible mentions in a new UI above the RTE.

Also, BottomSheetScaffold has a couple of bugs that make it work poorly with nested scrolling components, so I had to fork it and fix it while they are fixed in the upstream component.

Please note the design isn't final, so it might change in the future. That's also why some strings were hardcoded for now, until they're verified and we add them to localazy.

Motivation and context

Closes #1452.

Screenshots / GIFs

Included in the PR.

Tests

  • Go to a room (a small one is better).
  • Type @ in the composer.
  • The possible mentions will appear, type more characters to make the filtering more precise.
  • Remove the mention text or select another part of the message to make the mention suggestion UI disappear.

Note that this only adds the searching for room members and related UI, but it doesn't actually add the selected mention to the RTE.

Tested devices

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

Checklist

@jmartinesp jmartinesp requested a review from a team as a code owner October 24, 2023 09:03
@jmartinesp jmartinesp requested review from ganfra and removed request for a team October 24, 2023 09:03
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You should probably ignore this file in the review, it's just taken from M3, with the bugs mentioned in the description fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here, you can also ignore this file for the review.

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Attention: 49 lines in your changes are missing coverage. Please review.

Comparison is base (bf905dd) 63.04% compared to head (d94abef) 59.31%.
Report is 1 commits behind head on develop.

❗ Current head d94abef differs from pull request most recent head d5d685f. Consider uploading reports for the commit d5d685f to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1631      +/-   ##
===========================================
- Coverage    63.04%   59.31%   -3.73%     
===========================================
  Files         1223     1249      +26     
  Lines        31465    32452     +987     
  Branches      6480     6659     +179     
===========================================
- Hits         19837    19250     -587     
- Misses        8639    10319    +1680     
+ Partials      2989     2883     -106     
Files Coverage Δ
...id/features/location/impl/send/SendLocationView.kt 56.73% <ø> (ø)
...res/messages/impl/ExpandableBottomSheetScaffold.kt 71.42% <100.00%> (-5.72%) ⬇️
...ages/impl/messagecomposer/MessageComposerEvents.kt 100.00% <100.00%> (ø)
...sages/impl/messagecomposer/MessageComposerState.kt 100.00% <100.00%> (ø)
...pl/messagecomposer/MessageComposerStateProvider.kt 95.65% <100.00%> (+0.41%) ⬆️
...ssages/impl/messagecomposer/MessageComposerView.kt 69.35% <100.00%> (+0.69%) ⬆️
...signsystem/theme/components/BottomSheetScaffold.kt 61.29% <0.00%> (+9.67%) ⬆️
...ibraries/matrix/api/user/CurrentSessionIdHolder.kt 66.66% <66.66%> (ø)
...s/impl/messagecomposer/MessageComposerPresenter.kt 93.69% <94.59%> (+0.68%) ⬆️
...ent/android/features/messages/impl/MessagesView.kt 58.00% <82.60%> (-5.35%) ⬇️
... and 3 more

... and 244 files with indirect coverage changes

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2023

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

modifier = Modifier
.fillMaxWidth(),
)
Column(modifier = Modifier.fillMaxWidth()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe extract in a fun? it's starting to be big

@@ -354,4 +381,57 @@ class MessageComposerPresenter @Inject constructor(
snackbarDispatcher.post(snackbarMessage)
}
}

@OptIn(FlowPreview::class)
private fun CoroutineScope.processComposerSuggestions() = launch {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe extract this logic in his own file too?
Also makes sure it's done on a background dispatcher?

Copy link
Contributor

@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.

Small remarks otherwise LGTM

@jmartinesp
Copy link
Contributor Author

Since this probably won't make it as a whole feature for the next release, I'll add it behind a feature flag, and do the suggestions while I'm on it.

@jmartinesp jmartinesp force-pushed the feature/jme/1452-rte-suggestions branch from d94abef to 4445172 Compare October 27, 2023 09:41
@sonarcloud
Copy link

sonarcloud bot commented Oct 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jmartinesp jmartinesp enabled auto-merge (squash) October 27, 2023 10:20
@jmartinesp jmartinesp merged commit 44de6ad into develop Oct 27, 2023
13 checks passed
@jmartinesp jmartinesp deleted the feature/jme/1452-rte-suggestions branch October 27, 2023 10: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
Development

Successfully merging this pull request may close these issues.

Mentions: User suggestion view in RTE
3 participants