From fe5d2436d764f0f49869f41ee463e800fe6fab0e Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Mon, 8 May 2023 19:04:32 +0300 Subject: [PATCH 1/2] fix!: `SimpleOrientationSensor` should not schedule on `Dispatcher` BREAKING CHANGE: `SimpleOrientationSensor` should not schedule on `Dispatcher` --- .../Devices/Sensors/SimpleOrientationSensor.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/Uno.UWP/Devices/Sensors/SimpleOrientationSensor.cs b/src/Uno.UWP/Devices/Sensors/SimpleOrientationSensor.cs index 4e6d0a7a7bf2..0ac3375709d6 100644 --- a/src/Uno.UWP/Devices/Sensors/SimpleOrientationSensor.cs +++ b/src/Uno.UWP/Devices/Sensors/SimpleOrientationSensor.cs @@ -65,21 +65,6 @@ private SimpleOrientationSensor() #if __ANDROID__ || __IOS__ private void SetCurrentOrientation(SimpleOrientation orientation) - { - if (CoreDispatcher.Main.HasThreadAccess) - { - CalculateCurrentOrientation(orientation); - } - else - { - _ = CoreDispatcher.Main.RunAsync(CoreDispatcherPriority.Normal, () => - { - CalculateCurrentOrientation(orientation); - }); - } - } - - private void CalculateCurrentOrientation(SimpleOrientation orientation) { if (_currentOrientation != orientation) { From 7daa77ac886f6a8ebb2d7a23bb9dd2e3a6e84281 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Mon, 8 May 2023 22:44:45 +0300 Subject: [PATCH 2/2] chore: Address review comment --- src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs b/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs index 6e86ca6643c4..35ce2ec3422b 100644 --- a/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs +++ b/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs @@ -18,6 +18,7 @@ using Windows.Security.Authentication.Web; using Windows.Storage.Pickers; using Windows.System; +using Windows.UI.Core; using Windows.UI.ViewManagement; using Windows.UI.Xaml.Media; using WinUICoreServices = Uno.UI.Xaml.Core.CoreServices; @@ -73,7 +74,7 @@ public override void OnAttachedToWindow() private void OnSensorOrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args) { - RaiseConfigurationChanges(); + _ = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, RaiseConfigurationChanges); } private void OnInputPaneVisibilityChanged(InputPane sender, InputPaneVisibilityEventArgs args)