[HOLD for payment 2021-09-28] If you mark a message as unread and close the app or minimize it, the unread status is removed.
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
- Open app and login
- Open any chat
- Long tap any old message
- Tap "Mark as Unread"
- Force close the app and open it again
- Open the same chat as before
Expected Result:
Message is still marked as unread
Actual Result:
Message will lose unread status after force close + reopening
Workaround:
Unknown
Platform:
Where is this issue occurring?
- Web
- iOS ✔️
- Android ✔️
- Desktop App
- Mobile Web
Version Number: 1.0.88 Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos:
https://user-images.githubusercontent.com/43996225/130993476-c0c7d322-36c1-486b-99d4-bfe837f444a9.mp4
Expensify/Expensify Issue URL:
Upwork job link https://www.upwork.com/jobs/~0160911a1308566e83
:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
- Identify the pull request that introduced this issue and revert it.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
Triggered auto assignment to @Jag96 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
Confirmed this is also happening in Prod, removing the deploy blocker label.
Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
This is not just for force close, this occurs for all activeReports. Whenever, the app visibility changes, the activeReport gets marked as read.
https://reactnative.dev/docs/appstate
Our isVisible implementation for mobile always returns true
https://github.com/Expensify/App/blob/ae6a75445896e0ba69b26253395defc106bdfdc7/src/libs/Visibility/index.native.js#L1-L7
which leads to always marking the report as read irrespective of visibility changing to active or background https://github.com/Expensify/App/blob/8a5cf2d190e8e259a1bcb4090fcb437e42f78dbe/src/pages/home/report/ReportActionsView.js#L241-L248
So, when we mark something as unread and change the app or try to close it, AppState's change event gets triggered, our handler gets triggered, since isVisible is always true, we end up marking the report as read, and hence, we don't get the marker again.
Proposal
Use AppState to get currentState and only return true when the app is active.
function isVisible() {
return AppState.currentState === 'active';
}
and change onVisibilityChange method to check if app is active and drawer is not open
onVisibilityChange() {
if (Visibility.isVisible() && !this.props.isDrawerOpen) {
updateLastReadActionID(this.props.reportID);
}
}
Issue reproducible during KI retests
Thanks for reporting this @kavimuru! Did you want to provide a solution proposal for this bug that you reported?
If not, @meetmangukiya is the first in line for proposal review.
@kavimuru I'm sorry for the confusion, I failed to see you were QA applause. I'll remember that next time 🙏 .
@meetmangukiya your proposal is first in line for review 😉
@meetmangukiya feel free to apply for this particular job on upwork [here](Upwork job link https://www.upwork.com/jobs/~0160911a1308566e83).
Triggered auto assignment to @aldo-expensify (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
Triggered auto assignment to @Jag96 (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
~@michaelhaxhiu sorry for the confusion I missed this issue somehow. This duplicate of #4357~
Sorry a slightly different bug @michaelhaxhiu, @meetmangukiya
@Santhosh-Sellavel I don't think your PR is addressing the bug in onVisibilityChange and isVisible for native?
@Santhosh-Sellavel ohhh yeah i remember that one, thanks for buddy checking anyway, always helpful.
@Jag96 I got my wires crossed and accidentally un-assigned the wrong engineer 🤦 . Rightfully assigning you, as initially selected.
@meetmangukiya, it looks like your proposal works if you background the app and reopen, but if you kill the app and then reopen, the message is no longer bolded (at least on iOS). Is there something else required for that part of the fix?
Will check this today
Issue reproducible during KI retests
@meetmangukiya any update on this one?
@michaelhaxhiu @Jag96 Yes, I think this is happening because we are always marking it as read on componentDidMount. So whenever we open the app, the last active report will always get marked as read.
https://github.com/Expensify/App/blob/8a5cf2d190e8e259a1bcb4090fcb437e42f78dbe/src/pages/home/report/ReportActionsView.js#L131
This should be fixed by only calling the function when the drawer is not open i.e. when the report is open.
if (!this.props.isDrawerOpen) {
updateLastReadActionID(this.props.reportID);
}