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

Improve typing notification animations #2386

Merged
merged 5 commits into from
Feb 14, 2024

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Feb 13, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other : UX improvement

Content

  • Make typing notifications appear using an animation, and keep the extra bottom space after the first one is displayed.
  • Also, simplify how MigrationScreenView animation works, since I forgot AnimatedVisibility() existed.

Motivation and context

  • Iterate on the initial implementation.

Screenshots / GIFs

typing_2.mp4

Tests

Open a room, scroll to the bottom, wait until you receive typing notifications. You should see:

  • An extra space is added at the bottom once the first typing notification appears.
  • The typing notifications will appear and disappear using a fade in/out animation.
  • The extra space is still there after the first notification disappears, so we only resize it once.

Tested devices

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

Checklist

@jmartinesp jmartinesp requested a review from a team as a code owner February 13, 2024 12:03
@jmartinesp jmartinesp requested review from bmarty and removed request for a team February 13, 2024 12:03
Copy link
Contributor

github-actions bot commented Feb 13, 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/PHWA83

@jmartinesp jmartinesp added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Feb 13, 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 Feb 13, 2024
Copy link
Member Author

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.

@jmartinesp jmartinesp added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Feb 13, 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 Feb 13, 2024
Copy link

codecov bot commented Feb 13, 2024

Codecov Report

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

Comparison is base (58a4cc2) 72.09% compared to head (730ed46) 72.11%.

Files Patch % Lines
...res/messages/impl/typing/TypingNotificationView.kt 83.33% 3 Missing and 6 partials ⚠️
...res/roomlist/impl/migration/MigrationScreenView.kt 85.71% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bmarty bmarty left a 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),
)
Copy link
Member

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
Copy link
Member

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.

Copy link
Member

@bmarty bmarty Feb 13, 2024

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.

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 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))
Copy link
Member

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),
Copy link
Member

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

@jmartinesp jmartinesp force-pushed the misc/jme/improve-typing-notification-animations branch from c16e344 to eacc5fa Compare February 13, 2024 15:23
@jmartinesp jmartinesp enabled auto-merge (squash) February 13, 2024 15:53
Copy link
Member

@bmarty bmarty left a 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!

@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Feb 13, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Feb 13, 2024
@jmartinesp jmartinesp force-pushed the misc/jme/improve-typing-notification-animations branch from 4a9fe0b to c09c570 Compare February 14, 2024 07:28
@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Feb 14, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Feb 14, 2024
Copy link

sonarcloud bot commented Feb 14, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@jmartinesp jmartinesp merged commit 1b690c1 into develop Feb 14, 2024
18 checks passed
@jmartinesp jmartinesp deleted the misc/jme/improve-typing-notification-animations branch February 14, 2024 08:05
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.

2 participants