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

[Reader IA] Fix top navigation bar disappearing when system has low-memory #20114

Merged

Conversation

thomashorta
Copy link
Contributor

@thomashorta thomashorta commented Feb 2, 2024

Fixes #20105

A couple of things were done to fix this issue:

  • Try to wait for a non-null top app bar state in functions that REQUIRE an existing top app bar to work
  • Properly save and restore top bar state using the Reader Fragment Saved Instance State Bundle

To Test:

  1. Enable the don't keep activities option.
  2. Install and log into Jetpack
  3. Go to the Reader
  4. Go to the Subscriptions feed
  5. Open a single post in the reader
  6. Tap back
  7. Verify that the top bar is still there in the correct state

Also, try doing that in other feeds, including selected blog/tag filters, to confirm the top bar does not disappear and saves the correct state.


Regression Notes

  1. Potential unintended areas of impact

    • Wrong top bar state being shown at any given time.
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

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

    • None yet. Unit tests should be added in a future PR to cover the fixed scenarios.

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes Testing Checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

Thomas Horta added 4 commits February 2, 2024 16:15
The added code tries to wait until the topBarUiState is not null by polling for
its data for a few times. If it's still null it simply doesn't run the code, to
avoid calling topbar updates that should only happen if there is already a top
bar visible. If it's not null after that check (normal scenario) then it calls
the block and executes the logic.
Save information about the selected feed id and top bar filter ui state in the
SavedInstanceState Bundle and recover it when the activity is destroyed due to
system-initiated destruction (low-memory or "Don't keep activities"	dev setting)
to keep the experience consistent.
@thomashorta thomashorta self-assigned this Feb 2, 2024
@thomashorta thomashorta changed the base branch from trunk to feature/reader-ia February 2, 2024 20:36
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 2, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20114-777633f
Commit777633f
Direct Downloadjetpack-prototype-build-pr20114-777633f.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 2, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20114-777633f
Commit777633f
Direct Downloadwordpress-prototype-build-pr20114-777633f.apk
Note: Google Login is not supported on these builds.

@peril-wordpress-mobile
Copy link

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

Avoid breaking existing unit tests.
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 45 lines in your changes are missing coverage. Please review.

Comparison is base (f37f1ec) 40.48% compared to head (777633f) 40.47%.
Report is 210 commits behind head on feature/reader-ia.

Files Patch % Lines
...ss/android/ui/reader/viewmodels/ReaderViewModel.kt 13.46% 42 Missing and 3 partials ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##           feature/reader-ia   #20114      +/-   ##
=====================================================
- Coverage              40.48%   40.47%   -0.01%     
=====================================================
  Files                   1447     1447              
  Lines                  66788    66812      +24     
  Branches               11030    11030              
=====================================================
+ Hits                   27036    27045       +9     
- Misses                 37268    37279      +11     
- Partials                2484     2488       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@develric develric left a comment

Choose a reason for hiding this comment

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

Code LGTM @thomashorta , also I was able to replicate consistently on a pixel 4 emulator, the VM gets deallocated and with the PR patch when it is reinitialized restores the state correctly from the saved state 👍

I'm approving this one 🙇

@thomashorta thomashorta merged commit bf7aa1e into feature/reader-ia Feb 3, 2024
20 checks passed
@thomashorta thomashorta deleted the issue/20105-reader-top-navigation-disappear branch February 3, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants