Fix the issue of detail view of SplitViewController when switching out-in the app #3118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs: MBL-18549
affects: Student, Teacher
release note: Fixed the issue where app doesn't refresh shown page properly after switching to another app
Issue Analysis
Upon testing on an isolated case, turned out that
UISplitViewController
always report collapse then expansion whenever app is put to background. For that,CoreSplitViewController
in that case calls delegate's methods of:func splitViewController(_ splitViewController: UISplitViewController, separateSecondaryFrom primaryViewController: UIViewController)
upon expansion.func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController)
upon collapsing.Which causes the unnecessary disruption on SplitView, although nothing was actually changed from that perspective.
To get around this issue, a new property
preBackgroundedSecondaryController
to cache secondary view controller when the app is about to be backgrounded. And use that in the expansion delegate's method, instead of executing theDefaultViewProvider
logic there, which assumes a real expansion is going on.One note though, I think we need to rethink the protocol
DefaultViewProvider
as the main way to extract a secondary view controller in case of expansion. Apparently, it is not being utilized in course details except for home and assignments tabs.Test Plan
See ticket's description.
Checklist