-
Notifications
You must be signed in to change notification settings - Fork 155
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
Improve typing notification animations #2386
Improve typing notification animations #2386
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The screenshot is not very representative 😅 . There should be an empty space at the bottom, I'll try to make it visible against the theme background.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #2386 +/- ##
===========================================
+ Coverage 72.09% 72.11% +0.01%
===========================================
Files 1358 1359 +1
Lines 32084 32124 +40
Branches 6272 6276 +4
===========================================
+ Hits 23131 23166 +35
- Misses 5699 5701 +2
- Partials 3254 3257 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, please see my remarks, and let me know if you have any question
), | ||
aMessagesState( | ||
typingNotificationState = aTypingNotificationState(reserveSpace = true), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would create a new provider, like MessagesStateForTypingProvider
, and add those 2 new states here. Then use this provider in MessagesViewWithTypingPreview
(I suspect that you did not see that Preview). The current state for MessagesViewWithTypingPreview
will be the first state of this new provider. The idea is to split to previews into several files so that Android Studio can render them all, and faster. MessagesViewWithTypingPreview
is also closer to the reality, since if does not render the Jump to bottom FAB.
Maybe the first added state here has no added value, I let you decide if you want to remove it.
var reserveSpace by remember { mutableStateOf(false) } | ||
LaunchedEffect(renderTypingNotifications, typingMembersState.value) { | ||
if (renderTypingNotifications && typingMembersState.value.isNotEmpty()) { | ||
reserveSpace = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think reserveSpace
should be set back to false
as soon as a new Event is received in the timeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing with @stefanceriu (who discussed with @amshakal) this is maybe not necesssary, but having an empty space at the bottom of the timeline is not great to me. Not a blocker then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just spoke with @stefanceriu and he confirmed we've implemented the same behaviour in both platforms: the extra space should stay until you exit the room.
val typingNotificationText = computeTypingNotificationText(state.typingMembers) | ||
Box(contentAlignment = Alignment.BottomStart) { | ||
// Reserve the space for the typing notification by adding an invisible text | ||
TypingText(text = typingNotificationText, textModifier = Modifier.alpha(0f)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screen Reader may still read this invisible text (I am not 💯 sure though). So maybe disable the contentDescription adding .clearAndSetSemantics {}
to the Modifier.
@@ -99,6 +142,7 @@ internal fun TypingNotificationViewPreview( | |||
@PreviewParameter(TypingNotificationStateProvider::class) state: TypingNotificationState, | |||
) = ElementPreview { | |||
TypingNotificationView( | |||
modifier = Modifier.border(1.dp, Color.Blue), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, but maybe set the border only when state.reserveSpace == true && state.typingMembers.isNotEmpty
to avoid impacting the existing screenshots
c16e344
to
eacc5fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
Also add screenshot for typing notifications in the timeline
4a9fe0b
to
c09c570
Compare
Quality Gate passedIssues Measures |
Type of change
Content
MigrationScreenView
animation works, since I forgotAnimatedVisibility()
existed.Motivation and context
Screenshots / GIFs
typing_2.mp4
Tests
Open a room, scroll to the bottom, wait until you receive typing notifications. You should see:
Tested devices
Checklist