Skip to content
Merged
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 @@ -49,9 +49,16 @@ static void OnConfigureLifeCycle(IiOSLifecycleBuilder iOS)
app.GetWindow()?.Stopped();
});

// Pre iOS 13 doesn't support scenes
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

iOS
.SceneWillEnterForeground(scene =>
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

if (scene.Delegate is IUIWindowSceneDelegate windowScene &&
scene.ActivationState != UISceneActivationState.Unattached)
{
Expand All @@ -60,33 +67,51 @@ static void OnConfigureLifeCycle(IiOSLifecycleBuilder iOS)
})
.SceneOnActivated(scene =>
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

if (scene.Delegate is IUIWindowSceneDelegate sd)
sd.GetWindow().GetWindow()?.Activated();
})
.SceneOnResignActivation(scene =>
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

if (scene.Delegate is IUIWindowSceneDelegate sd)
sd.GetWindow().GetWindow()?.Deactivated();
})
.SceneDidEnterBackground(scene =>
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

if (scene.Delegate is IUIWindowSceneDelegate sd)
sd.GetWindow().GetWindow()?.Stopped();
})
.SceneDidDisconnect(scene =>
{
if (!OperatingSystem.IsIOSVersionAtLeast(13))
return;

if (scene.Delegate is IUIWindowSceneDelegate sd)
sd.GetWindow().GetWindow()?.Destroying();
});
}

static void OnConfigureWindow(IiOSLifecycleBuilder iOS)
{
// Pre iOS 13 doesn't support scenes
if (!OperatingSystem.IsIOSVersionAtLeast(13))
{
return;
}

iOS = iOS
.WindowSceneDidUpdateCoordinateSpace((windowScene, _, _, _) =>
{
// Mac Catalyst version 16+ supports effectiveGeometry property on window scenes.
if (OperatingSystem.IsMacCatalystVersionAtLeast(16))
if (!OperatingSystem.IsIOSVersionAtLeast(13) || (OperatingSystem.IsMacCatalystVersionAtLeast(16)))
{
return;
}
Expand Down
91 changes: 80 additions & 11 deletions src/Core/src/Platform/iOS/ColorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,126 @@ public static class ColorExtensions

internal static UIColor LabelColor
{
get => UIColor.Label;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.Label;

return UIColor.Black;
}
}

internal static UIColor PlaceholderColor
{
get => UIColor.PlaceholderText;
get
{

if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.PlaceholderText;

return SeventyPercentGrey;
}
}

internal static UIColor SecondaryLabelColor
{
get => UIColor.SecondaryLabel;
get
{

if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.SecondaryLabel;

return new Color(.32f, .4f, .57f).ToPlatform();
}
}

internal static UIColor BackgroundColor
{
get => UIColor.SystemBackground;
get
{

if (OperatingSystem.IsIOSVersionAtLeast(13))
return UIColor.SystemBackground;

return UIColor.White;
}
}

internal static UIColor SeparatorColor
{
get => UIColor.Separator;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.Separator;

return UIColor.Gray;
}
}

internal static UIColor OpaqueSeparatorColor
{
get => UIColor.OpaqueSeparator;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.OpaqueSeparator;

return UIColor.Black;
}
}

internal static UIColor GroupedBackground
{
get => UIColor.SystemGroupedBackground;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13))
return UIColor.SystemGroupedBackground;

return new UIColor(247f / 255f, 247f / 255f, 247f / 255f, 1);
}
}

internal static UIColor AccentColor
{
get => UIColor.SystemBlue;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.SystemBlue;

return Color.FromRgba(50, 79, 133, 255).ToPlatform();
}
}

internal static UIColor Red
{
get => UIColor.SystemRed;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.SystemRed;

return UIColor.FromRGBA(255, 0, 0, 255);
}
}

internal static UIColor Gray
{
get => UIColor.SystemGray;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13))
return UIColor.SystemGray;

return UIColor.Gray;
}
}

internal static UIColor LightGray
{
get => UIColor.SystemGray2;
get
{
if (OperatingSystem.IsIOSVersionAtLeast(13))
return UIColor.SystemGray2;

return UIColor.LightGray;
}
}

public static CGColor ToCGColor(this Color color)
Expand Down
5 changes: 4 additions & 1 deletion src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ internal static void AdjustPosition()
}
else
{
statusBarHeight = window.WindowScene?.StatusBarManager?.StatusBarFrame.Height ?? 0;
if (OperatingSystem.IsIOSVersionAtLeast(13, 0))
statusBarHeight = window.WindowScene?.StatusBarManager?.StatusBarFrame.Height ?? 0;
else
statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height;

navigationBarAreaHeight = statusBarHeight;
}
Expand Down