-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Stats Revamp] Fix crash after backgrounding app from Stats screen #20008
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
[Stats Revamp] Fix crash after backgrounding app from Stats screen #20008
Conversation
… in the background
You can test the changes in WordPress from this Pull Request by:
|
You can test the changes in Jetpack from this Pull Request by:
|
guarani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix! I reproduced this on release/21.6 on a physical device (it doesn't seem to happen on sims) and then verified the bug isn't reproducible on this branch.
I found a few mentions of similar bugs, see #12554 and #12519, but no clear solution.
Those PRs mention a fix that works but prevents the system from capturing a screenshot of the app in both light & dark mode as the app transitions to the background. I'm actually not sure if the system still does this. As an app is backgrounded, it's still showing animations in motion, so I think the app switcher keeps the apps "running" (i.e. it doesn't show screenshots anymore).
Feel free to merge this as-is. In the meantime, are there any downsides you see to this fix?
Apple's docs say this about Swift and Obj-C exceptions:
So it looks like this internal exception (which could be an Apple bug) can't be caught by Swift. |
|
@guarani thanks for testing!
So interesting, couldn't resist testing it immediately. It does look like the app switcher "screenshots" are not perfect and the guide text appears in the wrong color. Simulator.Screen.Recording.-.iPhone.14.-.2023-01-26.at.21.55.59.mp4
If you look at the video, the guide text reappears after coming back from the background. I'm thinking if a better solution would be to add this Simulator.Screen.Recording.-.iPhone.14.-.2023-01-26.at.22.03.27.mp4 |
|
Thanks for sharing those videos. In the first video, it's noticeable how the card changes in size due to the guide text being re-added. I agree that the second video where the card does not change size is much better (the guide color changing isn't very noticeable). |
Fixes #20006
Description
We call this method when the app is in the background, which causes the crash. This method is called in the background since
traidCollectionDidChangemethod is triggered when apps go into background. This issue is only reproducible when there's Total Likes and Total Comments cards with guide text when going into background. That's why it wasn't found before.It's concerning since we used a failable
try?initializer.Fixing the issue by checking if app is not in the background before rebuilding
NSAttributedStringwith html.Testing instructions
Case 1:
Regression Notes
None
None
None
PR submission checklist:
RELEASE-NOTES.txtif necessary.Images & Videos