Fix window insets display cutout behavior#2301
Conversation
| fun updateSafeAreaInsets(insets: PlatformInsets) { | ||
| mediator?.updateSafeAreaInsets(insets) | ||
| } | ||
| val safeAreaInsets: PlatformInsets get() = mediator?.safeAreaInsets ?: PlatformInsets.Zero |
There was a problem hiding this comment.
I would prefer to use hostingViewController.view.safeAreaInsets in tests instead, if possible. And remove this method.
There was a problem hiding this comment.
Removed, thanks for letting me know about the other option.
| fun updateSafeAreaInsets(insets: PlatformInsets) { | ||
| windowInsetsManager.safeAreaInsets.value = insets | ||
| } | ||
| val safeAreaInsets: PlatformInsets get() = windowInsetsManager.safeAreaInsets.value |
There was a problem hiding this comment.
Same here. It looks like we don't need to expose platform insets
| { safeAreaInsets.value }, | ||
| { keyboardOverlapHeight.value }, | ||
| { interfaceOrientation.value }, | ||
| { if (isPad) InterfaceOrientation.Portrait else interfaceOrientation.value }, |
There was a problem hiding this comment.
Some comments are required here. Or consider passing userInterfaceIdiom as another parameter to the UIKitWindowInsets and use it there.
| if ((appDelegate.window?.windowScene?.interfaceOrientation != UIInterfaceOrientationPortrait && interfaceOrientations == UIInterfaceOrientationMaskPortrait) || interfaceOrientations != UIInterfaceOrientationMaskPortrait) { | ||
| appDelegate.supportedInterfaceOrientations = interfaceOrientations | ||
| UIViewController.attemptRotationToDeviceOrientation() | ||
| delay(1000) |
There was a problem hiding this comment.
do you need this delay? As far as I remember, the rotation take around 500ms. If you absolutely need to keep the delay, please add a comment, why its needed.
There was a problem hiding this comment.
Delay 500 and 600 is too short. I have tried 700 and so far it passes on all runs for me locally, let's see.
…and PlatformWindowInsetsConfig interface
…istent and direct property getters
…s and interfaceOrientation, removing redundant update methods.
…ation.LandscapeRight to fix WindowInsets.displayCutout bug
…tInstrumentedTest
…remove redundant duplicate setContent functions
…ve redundant properties
…update related tests
3b3a596 to
55bd50d
Compare
In this PR:
WindowInsets.displayCutoutin different interface orientationsWindowInsets.displayCutouton iPadUIKitInstrumentedTestto modify interface orientation of the contentFixes
Testing
Tests for various interface orietations are added in this PR.
This should be tested by QA
Release Notes
Fixes - iOS
WindowInsets.displayCutoutin different interface orientationsWindowInsets.displayCutouton iPad