wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.68k stars 1.11k forks source link

Display previously viewed screen when switching back to Site, Notification, and Reader #23578

Closed crazytonyli closed 3 weeks ago

crazytonyli commented 4 weeks ago

Issue

  1. In iPad full-screen mode, open sidebar, select the Reader(*).
  2. View a post's comments from the Reader.
  3. Open sidebar, select Notifications.
  4. Go back to the Reader.

I'd expect the content in step 2 is displayed. But the actual result is the root-level of the Reader is displayed.

(*) The same issue can happen on a site or the Notifications.

Changes

This PR preserves the previously viewed content by keeping the relevant view controllers in memory and using them instead of creating new ones when switching back.

At the moment, other than sidebar, there are three things that can be displayed within the split view: site details, Notifications, and Reader. I have create dedicated types for those content, so that they are better organized in code than storing view controller instances directly as SplitViewRootPresenter properties.

Please note, when switching between sites, the previously viewed screen in the last site will still be lost. It'd be a simple change to preserve that too. I'm open for suggestions, but I don't feel like it's as important as preserving previously viewed screen in the Notifications and Reader.

Regression Notes

  1. Potential unintended areas of impact

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

Testing checklist:

wpmobilebot commented 4 weeks ago
Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr23578-345b07c
Version25.3
Bundle IDcom.jetpack.alpha
Commit345b07cbcdd901e29cb975a3495c8b0869730016
App Center Buildjetpack-installable-builds #9719
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.
wpmobilebot commented 4 weeks ago
WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr23578-345b07c
Version25.3
Bundle IDorg.wordpress.alpha
Commit345b07cbcdd901e29cb975a3495c8b0869730016
App Center BuildWPiOS - One-Offs #10675
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.
kean commented 4 weeks ago

It’s a great start. I didn’t think of preserving the state when switching tabs, but it makes so much sense. In terms of the architecture, it’s a great idea to extract the individual tabs.

I noticed an issue where when you switch from “Notifications” to “Reader”, the main sidebar loses the selection state or shows the previous selection, but I think I also saw this in trunk.

crazytonyli commented 3 weeks ago

@kean I believe I have addressed all your comment. Do you mind having another look?

I noticed an issue where when you switch from “Notifications” to “Reader”, the main sidebar loses the selection state or shows the previous selection

I couldn't reproduce this issue...

kean commented 3 weeks ago

The updates are looking good!

I fixed the menu showing incorrect selection issue separately here https://github.com/wordpress-mobile/WordPress-iOS/pull/23595.

In term of memory warnings, I think it's fine to keep, but I'm not sure there is much value. I'd rather remove them.

crazytonyli commented 3 weeks ago

In term of memory warnings, I think it's fine to keep, but I'm not sure there is much value. I'd rather remove them.

Ops. I forgot about your comment about the memory warnings. I'm okay with removing that.

I didn't really measure how much memory the Notifications and Reader may take. It's just a gut feeling that they may take up a not small amount of memory because there are potentially a few view controllers in those "tabs", not just the one at the root level.