Skip to content

Commit 1cf85d7

Browse files
committed
chore: Adjust check
1 parent 4188b5f commit 1cf85d7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/Uno.UI/UI/Xaml/Application.Android.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,13 @@ static partial void StartPartial(ApplicationInitializationCallback callback)
3232
/// </remarks>
3333
private DateTimeOffset GetSuspendingOffset() => DateTimeOffset.Now.AddSeconds(5);
3434

35-
partial void ApplySystemOverlaysTheming() => NativeWindowWrapper.Instance?.ApplySystemOverlaysTheming();
35+
partial void ApplySystemOverlaysTheming()
36+
{
37+
// This is needed only due to the fact that currently Instance accessor creates the wrapper
38+
// eagerly - which could then happen too early. Will no longer be needed when un-singletoned.
39+
if (InitializationComplete)
40+
{
41+
NativeWindowWrapper.Instance.ApplySystemOverlaysTheming();
42+
}
43+
}
3644
}

src/Uno.UI/UI/Xaml/Application.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,7 @@ private void SetRequestedTheme(ApplicationTheme requestedTheme)
444444

445445
internal void OnRequestedThemeChanged()
446446
{
447-
if (InitializationComplete)
448-
{
449-
ApplySystemOverlaysTheming();
450-
}
447+
ApplySystemOverlaysTheming();
451448
OnResourcesChanged(ResourceUpdateReason.ThemeResource);
452449
}
453450

0 commit comments

Comments
 (0)