Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,33 @@ struct SPKRouterTests {
}
}

@Test func navigationControllerUsesNonSparklingTopControllerPolicy() {
final class HostViewController: UIViewController {
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
.portraitUpsideDown
}

override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
.portraitUpsideDown
}
}

let delegate = SPKViewController(
withURL: nil,
config: SPKSchemeParam(),
context: SPKContext(),
frame: .zero)
let host = HostViewController()
let navigationController = UINavigationController(rootViewController: host)

#expect(
delegate.navigationControllerSupportedInterfaceOrientations(
navigationController) == .portraitUpsideDown)
#expect(
delegate.navigationControllerPreferredInterfaceOrientationForPresentation(
navigationController) == .portraitUpsideDown)
Comment on lines +129 to +142
}

@Test func viewAppearanceSchedulesPortraitGeometryUpdate() {
let context = SPKContext()
context.interfaceOrientationPolicy = .portrait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,16 +1121,16 @@ extension SPKViewController: UINavigationControllerDelegate {
public func navigationControllerSupportedInterfaceOrientations(
_ navigationController: UINavigationController
) -> UIInterfaceOrientationMask {
return (navigationController.topViewController as? SPKViewController)?
.supportedInterfaceOrientations ?? navigationController.supportedInterfaceOrientations
return navigationController.topViewController?.supportedInterfaceOrientations
?? super.supportedInterfaceOrientations
Comment on lines +1124 to +1125
}

public func navigationControllerPreferredInterfaceOrientationForPresentation(
_ navigationController: UINavigationController
) -> UIInterfaceOrientation {
return (navigationController.topViewController as? SPKViewController)?
return navigationController.topViewController?
.preferredInterfaceOrientationForPresentation
?? navigationController.preferredInterfaceOrientationForPresentation
?? super.preferredInterfaceOrientationForPresentation
}
}

Expand Down
Loading