Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[iOS] Fix usage of iOS11 api #5893

Merged
merged 2 commits into from Apr 15, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
Expand Up @@ -47,7 +47,7 @@ public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
return ChildViewControllers[0].GetSupportedInterfaceOrientations();
}

return base.GetSupportedInterfaceOrientations();
}

Expand Down Expand Up @@ -104,7 +104,8 @@ public override void ViewDidLoad()
{
base.ViewDidLoad();
SetNeedsStatusBarAppearanceUpdate();
SetNeedsUpdateOfHomeIndicatorAutoHidden();
if (Forms.IsiOS11OrNewer)
SetNeedsUpdateOfHomeIndicatorAutoHidden();
}

public override UIViewController ChildViewControllerForStatusBarStyle()
Expand Down Expand Up @@ -139,7 +140,7 @@ public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentat
}
return base.PreferredInterfaceOrientationForPresentation();
}

public override UIViewController ChildViewControllerForStatusBarHidden()
{
return (UIViewController)Platform.GetRenderer(this.Platform.Page);
Expand Down Expand Up @@ -198,7 +199,8 @@ public override void ViewDidLoad()
{
base.ViewDidLoad();
SetNeedsStatusBarAppearanceUpdate();
SetNeedsUpdateOfHomeIndicatorAutoHidden();
if (Forms.IsiOS11OrNewer)
SetNeedsUpdateOfHomeIndicatorAutoHidden();
}
}
}
11 changes: 6 additions & 5 deletions Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
Expand Up @@ -231,7 +231,8 @@ public override void ViewDidLoad()
UpdateBarTextColor();
UpdateUseLargeTitles();
UpdateHideNavigationBarSeparator();
SetNeedsUpdateOfHomeIndicatorAutoHidden();
if (Forms.IsiOS11OrNewer)
SetNeedsUpdateOfHomeIndicatorAutoHidden();

// If there is already stuff on the stack we need to push it
navPage.Pages.ForEach(async p => await PushPageAsync(p, false));
Expand Down Expand Up @@ -724,9 +725,9 @@ internal async Task UpdateFormsInnerNavigation(Page pageBeingRemoved)
{
if (NavPage == null)
return;
if (_ignorePopCall)
if (_ignorePopCall)
return;

_ignorePopCall = true;
if (Element.Navigation.NavigationStack.Contains(pageBeingRemoved))
await (NavPage as INavigationPageController)?.RemoveAsyncInner(pageBeingRemoved, false, true);
Expand Down Expand Up @@ -1347,7 +1348,7 @@ public override void LayoutSubviews()

break;
}
else if(view.Class.Name == "UINavigationItemButtonView")
else if (view.Class.Name == "UINavigationItemButtonView")
{
if (view.Subviews.Length == 0)
NavBarLabel = null;
Expand Down Expand Up @@ -1475,7 +1476,7 @@ public override void LayoutSubviews()
if (_child.Element.Bounds != layoutBounds)
Layout.LayoutChildIntoBoundingRegion(_child.Element, layoutBounds);
}
else if(_icon != null && Superview != null)
else if (_icon != null && Superview != null)
{
_icon.Center = new PointF(Superview.Frame.Width / 2 - Frame.X, Superview.Frame.Height / 2);
}
Expand Down
5 changes: 3 additions & 2 deletions Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
Expand Up @@ -171,7 +171,8 @@ public override void ViewDidAppear(bool animated)

_appeared = true;
UpdateStatusBarPrefersHidden();
SetNeedsUpdateOfHomeIndicatorAutoHidden();
if(Forms.IsiOS11OrNewer)
SetNeedsUpdateOfHomeIndicatorAutoHidden();

if (Element.Parent is CarouselPage)
return;
Expand Down Expand Up @@ -439,7 +440,7 @@ IEnumerable<UIView> ViewAndSuperviewsOfView(UIView view)

void UpdateHomeIndicatorAutoHidden()
{
if (Element == null)
if (Element == null || !Forms.IsiOS11OrNewer)
return;

SetNeedsUpdateOfHomeIndicatorAutoHidden();
Expand Down
Expand Up @@ -336,7 +336,8 @@ void UpdateMasterDetailContainers()
_detailController.AddChildViewController(detailRenderer.ViewController);

SetNeedsStatusBarAppearanceUpdate();
SetNeedsUpdateOfHomeIndicatorAutoHidden();
if (Forms.IsiOS11OrNewer)
SetNeedsUpdateOfHomeIndicatorAutoHidden();
}

void UpdateLeftBarButton()
Expand Down