App icon indicating copy to clipboard operation
App copied to clipboard

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

Open kavimuru opened this issue 5 years ago • 30 comments

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:

  1. Open app and login
  2. Open any chat
  3. Long tap any old message
  4. Tap "Mark as Unread"
  5. Force close the app and open it again
  6. 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:

View all open jobs on GitHub

Upwork job link https://www.upwork.com/jobs/~0160911a1308566e83

kavimuru avatar Aug 26 '21 15:08 kavimuru

: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:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

OSBotify avatar Aug 26 '21 15:08 OSBotify

Triggered auto assignment to @Jag96 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 26 '21 15:08 MelvinBot

Confirmed this is also happening in Prod, removing the deploy blocker label.

isagoico avatar Aug 26 '21 16:08 isagoico

Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Aug 26 '21 20:08 MelvinBot

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);
    }
}

meetmangukiya avatar Aug 27 '21 15:08 meetmangukiya

Issue reproducible during KI retests

isagoico avatar Aug 30 '21 15:08 isagoico

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.

michaelhaxhiu avatar Aug 31 '21 14:08 michaelhaxhiu

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

michaelhaxhiu avatar Aug 31 '21 14:08 michaelhaxhiu

@meetmangukiya feel free to apply for this particular job on upwork [here](Upwork job link https://www.upwork.com/jobs/~0160911a1308566e83).

michaelhaxhiu avatar Aug 31 '21 15:08 michaelhaxhiu

Triggered auto assignment to @aldo-expensify (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 31 '21 15:08 MelvinBot

Triggered auto assignment to @Jag96 (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Aug 31 '21 15:08 MelvinBot

~@michaelhaxhiu sorry for the confusion I missed this issue somehow. This duplicate of #4357~

Sorry a slightly different bug @michaelhaxhiu, @meetmangukiya

Santhosh-Sellavel avatar Aug 31 '21 16:08 Santhosh-Sellavel

@Santhosh-Sellavel I don't think your PR is addressing the bug in onVisibilityChange and isVisible for native?

meetmangukiya avatar Aug 31 '21 17:08 meetmangukiya

@Santhosh-Sellavel ohhh yeah i remember that one, thanks for buddy checking anyway, always helpful.

michaelhaxhiu avatar Aug 31 '21 21:08 michaelhaxhiu

@Jag96 I got my wires crossed and accidentally un-assigned the wrong engineer 🤦 . Rightfully assigning you, as initially selected.

michaelhaxhiu avatar Aug 31 '21 21:08 michaelhaxhiu

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

Jag96 avatar Aug 31 '21 22:08 Jag96

Will check this today

meetmangukiya avatar Sep 02 '21 13:09 meetmangukiya

Issue reproducible during KI retests

isagoico avatar Sep 05 '21 23:09 isagoico

@meetmangukiya any update on this one?

michaelhaxhiu avatar Sep 06 '21 02:09 michaelhaxhiu

@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);
}

meetmangukiya avatar Sep 06 '21 06:09 meetmangukiya