Fix mark message from notification#41484
Conversation
…x-34829-mark-message-from-notification
|
@ishpaul777 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: Nativenot affected Android: mWeb Chromenot affected iOS: Nativenot afftected iOS: mWeb Safarinot affected MacOS: Chrome / SafariScreen.Recording.2024-05-08.at.1.54.46.AM.movMacOS: DesktopScreen.Recording.2024-05-08.at.1.38.39.AM.mov |
| // On desktop, when the notification center is displayed, Visibility.isVisible() will return false. | ||
| // Currently, there's no programmatic way to dismiss the notification center panel. | ||
| // To handle this, we use the 'referrer' parameter to check if the current navigation is triggered from a notification. const isFromNotification = (route?.params as {referrer?: string})?.referrer === 'notification'; | ||
| const isFromNotification = (route?.params as {referrer?: string})?.referrer === 'notification'; |
There was a problem hiding this comment.
can you please add referrer in route param type here
App/src/libs/Navigation/types.ts
Lines 52 to 56 in cec7224
There was a problem hiding this comment.
we dont need type assertion anymore can you please remove it
| const isFromNotification = (route?.params as {referrer?: string})?.referrer === 'notification'; | |
| const isFromNotification = route?.params?.referrer === 'notification'; |
Also can you please use constant for 'notification'
Co-authored-by: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com>
…x-34829-mark-message-from-notification
|
LGTM, going to hold until merge freeze is over though. |
…x-34829-mark-message-from-notification
|
@blimpich where can we track if the merge freeze is over? Or is there an ETA? |
|
We can merge this today when @blimpich is online |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/blimpich in version: 1.4.74-0 🚀
|
|
The PR never intended to fix this IOS, from the starting we asssumed (issue title and reproduced platforms was only Desktop) and specifically decided to fix for desktop. |
|
@kavimuru agree with @ishpaul777. Does it also occur on Android? The same solution might work for iOS by adding this iOS-specific code, but I'm not sure how to test the native notification in development. src/libs/actions/navigateFromNotification/index.ios.ts If the above code is not working, the root cause might be different. Since that was not specified earlier, I believe the native issue should be handled separately. |
|
I will ask the tester to test in android too who got the fail result in iOS. Android was tester by another tester. |
|
Checking off this issue in the checklist since the solution here is specific to desktop. If the issue exists elsewhere please create an issue we can discuss specific solutions. |
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.4.74-6 🚀
|
| if ((Visibility.isVisible() || isFromNotification) && scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD) { | ||
| Report.readNewestAction(report.reportID); | ||
| Navigation.setParams({referrer: undefined}); |
There was a problem hiding this comment.
Coming from #45093 we should only set navigation param referrer to undefined when user is linked through notification
| // Currently, there's no programmatic way to dismiss the notification center panel. | ||
| // To handle this, we use the 'referrer' parameter to check if the current navigation is triggered from a notification. | ||
| const isFromNotification = route?.params?.referrer === CONST.REFERRER.NOTIFICATION; | ||
| if ((Visibility.isVisible() || isFromNotification) && scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD) { |
There was a problem hiding this comment.
Coming from this issue
In most cases, Visibility.isVisible() returns the value that the app is not visible (inactive). It happens because of the leverage of outdated value.
As result chat is not marked as read (chat is bold) on LHN when opening a new message via notification and navigating to another chat.
So the more preferable value is to use isVisible in this screen
@ishpaul777
Details
Fix chat item not marked as read when clicked from desktop notification
Fixed Issues
$ #34829
PROPOSAL: #34829 (comment)
Tests
Important
In Development, mWeb and Native do not show notifications, we can only ensure the chat is marked as read after being opened (Step 6-7)
Offline tests
Same as Test
QA Steps
Same as Test
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
Kapture.2024-05-02.at.14.29.43.mp4
iOS: Native
Kapture.2024-05-02.at.14.32.40.mp4
iOS: mWeb Safari
Kapture.2024-05-02.at.14.16.48.mp4
MacOS: Chrome / Safari
Kapture.2024-05-02.at.14.13.21.mp4
MacOS: Desktop
Kapture.2024-05-02.at.14.06.19.mp4