Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Jan 27, 2023

Fixes #20003

Description

A crash happens when dismissing "Manage Stats Cards" on iPad after making changes.

This is a classic iOS crash that happens when UIAlertViewController is presented as actionSheet on iPad without specifying sourceView.

Solution

Instead of setting sourceView, I decided to show alert on iPad when there're unsaved changes.

Testing instructions

Case 1:

  1. Launch the JP app on the iPad and log in.
  2. Open "My Site → Stats".
  3. Tap ⚙️ button at the top of the screen.
  4. Make some changes by adding or removing active cards.
  5. Tap Ⅹ button to close the Manage Stats Cards.
  6. Alert should appear, no crash should be happening

Regression Notes

  1. Potential unintended areas of impact

None

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

None

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

None

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • 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.

Images & Videos

iPad

Simulator.Screen.Recording.-.iPad.Pro.11-inch.4th.generation.-.2023-01-27.at.09.42.12.mp4

iPhone

Simulator.Screen.Recording.-.iPhone.14.-.2023-01-27.at.09.45.39.mp4

When showing UIAlertViewController as actionSheet on iPad sourceView and sourceRect is required to be set to avoid a crash.
@peril-wordpress-mobile
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@wpmobilebot
Copy link
Contributor

You can test the changes in WordPress from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr20013-5b38456 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@wpmobilebot
Copy link
Contributor

You can test the changes in Jetpack from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr20013-5b38456 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Copy link
Member

@irfano irfano left a comment

Choose a reason for hiding this comment

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

Instead of setting sourceView, I decided to show alert on iPad when there're unsaved changes.

Makes sense!
I tested and it doesn't crash anymore.

@staskus staskus merged commit f0df96a into release/21.6 Jan 30, 2023
@staskus staskus deleted the fix/20003-crash-when-dismissing-unsaved-manage-insights-view-on-ipad branch January 30, 2023 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants