Skip to content

Commit 6d49db7

Browse files
committed
Re-introduce accidentally removed check in MainShareViewController
This occurred while removing `#available(iOS 13, *)` checks a few commits before this. I was too eager in my deletions. See discussion at #19513 (comment) For the record, I started looking at how to add a unit test to catch this issue but I run into a number of problems. 1. The code is in the WordPressShareExtension target and we cannot test that one directly; Xcode doesn't let you create test target against app extensions 2. Even if we could access the code, the logic depends on `editorController`, an instance property that sets the state based whether `Bundle.main.bundleIdentifier` contains "DraftAction". That is something we cannot modify at test run time. In short, to test this trivial behavior, we'll need to put in place a far-from trivial test harness. The idea I have at the moment would be to extract as much of the logic shared between WordPressShareExtension, WordPressDraftActionExtension, and their two Jetpack counter parts into a framework, which we could then test in isolation and design in such a way that we don't need to inspect the bundle identifier at runtime. It's worth saying that folks were aware of the code limitations at the time of implementing the behavior but must have been pressed for time to ship a bug fix, as evidenced by the comment in the `editorController` implementation.
1 parent 220efe0 commit 6d49db7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

WordPress/WordPressShareExtension/MainShareViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ private extension MainShareViewController {
9696

9797
let shareNavController = UINavigationController(rootViewController: editorController)
9898

99-
// We need to make sure we don't end up with stacked modal view controllers by using this:
100-
shareNavController.modalPresentationStyle = .overFullScreen
99+
if editorController.originatingExtension == .saveToDraft {
100+
// We need to make sure we don't end up with stacked modal view controllers by using this:
101+
shareNavController.modalPresentationStyle = .overFullScreen
102+
}
101103

102104
present(shareNavController, animated: true)
103105
}

0 commit comments

Comments
 (0)