Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obsolete IBorder #23224

Merged
merged 5 commits into from
Jun 25, 2024
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
7 changes: 6 additions & 1 deletion src/Core/src/Core/IBorder.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
namespace Microsoft.Maui;
using System;
using System.ComponentModel;

namespace Microsoft.Maui;

/// <summary>
/// Provides functionality to provide a border.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("IBorder is not used and will be removed in a future release. Use IBorderView or IBorderStroke instead.")]
public interface IBorder
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Core/src/Handlers/View/ViewHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public abstract partial class ViewHandler : ElementHandler, IViewHandler
[nameof(IView.AnchorX)] = MapAnchorX,
[nameof(IView.AnchorY)] = MapAnchorY,
[nameof(IViewHandler.ContainerView)] = MapContainerView,
#pragma warning disable CS0618 // Type or member is obsolete
[nameof(IBorder.Border)] = MapBorderView,
#pragma warning restore CS0618 // Type or member is obsolete
#if ANDROID || WINDOWS || TIZEN
[nameof(IToolbarElement.Toolbar)] = MapToolbar,
#endif
Expand Down Expand Up @@ -419,6 +421,7 @@ public static void MapContainerView(IViewHandler handler, IView view)
handler.HasContainer = view.NeedsContainer();
}

#pragma warning disable CS0618 // Type or member is obsolete
/// <summary>
/// Maps the abstract <see cref="IBorder.Border"/> property to the platform-specific implementations.
/// </summary>
Expand All @@ -430,6 +433,7 @@ public static void MapBorderView(IViewHandler handler, IView view)

((PlatformView?)handler.ContainerView)?.UpdateBorder(view);
}
#pragma warning restore CS0618 // Type or member is obsolete

static partial void MappingFrame(IViewHandler handler, IView view);

Expand Down
2 changes: 2 additions & 0 deletions src/Core/src/Platform/Android/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public static void UpdateShadow(this AView platformView, IView view)
if (platformView is WrapperView wrapper)
wrapper.Shadow = view.Shadow;
}

[Obsolete("IBorder is not used and will be removed in a future release.")]
public static void UpdateBorder(this AView platformView, IView view)
{
if (platformView is WrapperView wrapper)
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Platform/Tizen/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public static async Task UpdateBackgroundImageSourceAsync(this NView platformVie
}
}

[Obsolete("IBorder is not used and will be removed in a future release.")]
public static void UpdateBorder(this NView platformView, IView view)
{
if (view is IBorder border && platformView is WrapperView wrapperView)
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Platform/Windows/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public static void UpdateShadow(this FrameworkElement platformView, IView view)
}
}

[Obsolete("IBorder is not used and will be removed in a future release.")]
public static void UpdateBorder(this FrameworkElement platformView, IView view)
{
var border = (view as IBorder)?.Border;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Platform/WrapperView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public partial class WrapperView
IShape? _clip;
[UnconditionalSuppressMessage("Memory", "MEM0002", Justification = "IShadow is a non-NSObject in MAUI.")]
IShadow? _shadow;
[UnconditionalSuppressMessage("Memory", "MEM0002", Justification = "IBorder is a non-NSObject in MAUI.")]
[UnconditionalSuppressMessage("Memory", "MEM0002", Justification = "IBorderStroke is a non-NSObject in MAUI.")]
IBorderStroke? _border;

#if WINDOWS
Expand Down
2 changes: 2 additions & 0 deletions src/Core/src/Platform/iOS/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ public static void UpdateShadow(this UIView platformView, IView view)
wrapperView.Shadow = view.Shadow;
}
}

[Obsolete("IBorder is not used and will be removed in a future release.")]
public static void UpdateBorder(this UIView platformView, IView view)
{
var border = (view as IBorder)?.Border;
Expand Down
2 changes: 2 additions & 0 deletions src/Core/src/ViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ internal static bool NeedsContainer(this IView? view)
#endif

#if ANDROID || IOS
#pragma warning disable CS0618 // Type or member is obsolete
if (view is IBorder border && border.Border != null)
return true;
#pragma warning restore CS0618 // Type or member is obsolete
#elif WINDOWS
if (view is IBorderView border)
return border?.Shape != null || border?.Stroke != null;
Expand Down
Loading