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

Allow App to Navigate to Last Visited Room On visiting with HOME url #6978

Merged
merged 4 commits into from
Jan 11, 2022

Conversation

K4tsuki
Copy link
Contributor

@K4tsuki K4tsuki commented Jan 3, 2022

Fixing navigate to last visited room feature when user access App using HOME url
If onyx local data is exist, App will navigate to last visited room on that device.
If onyx is not exist in the device, App will use server data, hence will open last visited room by other device.

Details

  1. Revert change on Remove unnecessary calls to updateLastRead #4078 because this feature (navigate to last visited room) depend on lastVisitedTimestamp and it is set by updateLastReadActionID. [Instructed]
  2. Remove unnecessary updateLastReadActionID on create new message [Instructed]
  3. Remove updateLastReadActionID on keyboardDidShow ( not instructed. I have tested it on android: updateLastReadActionID is being called each time user open keyboard. if user open a room updateLastReadActionID is called automatically. When he is on top scroll (for example reading old message) then new message coming, updateLastReadActionID is also called (If updateLastReadActionID not called here, then updateLastReadActionID is necessary when he open keyboard). So this updateLastReadActionID when keyboard open up is unnecessary.

Fixed Issues

$ #6474

Tests

  1. Open web new expensify
  2. Navigate between rooms. Remember last time visited room.
  3. Close tab
  4. Open web new expensify on new tab with HOME url
  5. App should navigate tor last visited room
    ############
  6. Create new message
  7. When creating new message, API Report_UpdateLastRead is called only twice. (on developer tools)
    ############
  8. On android When keyboard show up on report action view, Report_UpdateLastRead is not called unnecesarrily.

QA Steps

  1. Open web new expensify
  2. Navigate between rooms. Remember last time visited room.
  3. Close tab
  4. Open web new expensify on new tab with HOME url
  5. App should navigate tor last visited room
    ###############
  6. All scenarios should be tested when messages are marked read. When we switch between reports, When we resize the window on Desktop from mobile to Web, etc...
    ############
  7. Create new message
  8. When creating new message, API Report_UpdateLastRead is called only twice. (on developer tools)
    ############
  9. On android When keyboard show up on report action view, Report_UpdateLastRead is not called unnecessarily.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

last_visit.mp4

Mobile Web

Desktop

iOS

Android

@K4tsuki K4tsuki requested a review from a team as a code owner January 3, 2022 03:41
@MelvinBot MelvinBot requested review from marcaaron and parasharrajat and removed request for a team January 3, 2022 03:41
@parasharrajat
Copy link
Member

@K4tsuki Could you please add videos for other platforms as well?

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. There are just a couple of style inconsistencies that need to be fixed.

src/pages/home/report/ReportActionsView.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionsView.js Outdated Show resolved Hide resolved
Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great.
Fixes:

  1. Current issue.
  2. Last visited chat issue on the SearchPage.

🎀 👀 🎀 C+ reviewed

Comment on lines -144 to +143
this.scrollToListBottom();
ReportScrollManager.scrollToBottom();
Copy link
Member

@parasharrajat parasharrajat Jan 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed, Why aren't we calling scrollToBottomAndUpdateLastRead here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is explained in the issue description:

Remove updateLastReadActionID on keyboardDidShow ( not instructed. I have tested it on android: updateLastReadActionID is being called each time user open keyboard. if user open a room and he is on a room, updateLastReadActionID is called automatically, whether he is viewing old message (scroll at the top) or not. So, when scroll at the top and user open keyboard updateLastReadActionID is unnecessary. )

I think the assumption is that we are already updating the last read when the report opens and so it is unnecessary to do it again when the keyboard opens. Feels fine to me but maybe there's some reason why we are setting it when the keyboard opens? I would guess the original intention is to just scroll to the bottom. But the excess calls to the API are because those two behaviors were stuck together before.

Copy link
Member

@parasharrajat parasharrajat Jan 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why it was added so it seems fine. But let's add proper tests so that QA can test the unread/read behavior properly.

All scenarios should be tested when messages are marked read.

  1. When we switch between reports.
  2. When we resize the window on Desktop from mobile to Web.
  3. etc...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @K4tsuki See ⬆️

@marcaaron
Copy link
Contributor

I think we are working on getting the tests passing. Is this safe to merge before then? cc @roryabraham @AndrewGable

@roryabraham
Copy link
Contributor

Yes, all the standard non-broken Jest tests passed. This is safe to merge with regard to unit tests.

@K4tsuki
Copy link
Contributor Author

K4tsuki commented Jan 11, 2022

@parasharrajat I have updated the QA steps.

@marcaaron marcaaron merged commit 913bd46 into Expensify:main Jan 11, 2022
@botify
Copy link

botify commented Jan 11, 2022

@marcaaron looks like this was merged without passing tests. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@marcaaron
Copy link
Contributor

Not an Emergency. See Rory's comment above.

@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @marcaaron in version: 1.1.27-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @marcaaron in version: 1.1.27-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @marcaaron in version: 1.1.27-3 🚀

platform result
🤖 android 🤖 skipped 🚫
🖥 desktop 🖥 skipped 🚫
🍎 iOS 🍎 skipped 🚫
🕸 web 🕸 skipped 🚫

@mvtglobally
Copy link

As per steps this PR needs URL change. QA validated on Web (PASS) and It can't be QA-ed on Android app

@parasharrajat
Copy link
Member

You can check this on Search Page.

  1. Open any chat.
  2. Confirm that it is visible on the top on search Page.

@mvtglobally

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @Jag96 in version: 1.1.29-5 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

7 participants