From 4595a3b52bfae488377951f7852692173c915614 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 25 Jun 2024 02:11:24 +0800 Subject: [PATCH 1/5] Obsolete IBorder This was used for something before, but instead we ended up with something else. --- src/Core/src/Core/IBorder.cs | 1 + src/Core/src/Platform/Android/ViewExtensions.cs | 2 ++ src/Core/src/Platform/Tizen/ViewExtensions.cs | 1 + src/Core/src/Platform/Windows/ViewExtensions.cs | 1 + src/Core/src/Platform/WrapperView.cs | 2 +- src/Core/src/Platform/iOS/ViewExtensions.cs | 2 ++ 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Core/src/Core/IBorder.cs b/src/Core/src/Core/IBorder.cs index 4b28ab1f9f45..3bd49ee2c71a 100644 --- a/src/Core/src/Core/IBorder.cs +++ b/src/Core/src/Core/IBorder.cs @@ -3,6 +3,7 @@ /// /// Provides functionality to provide a border. /// +[Obsolete("IBorder is not used and will be removed in a future release. Use IBorderView or IBorderStroke instead.")] public interface IBorder { /// diff --git a/src/Core/src/Platform/Android/ViewExtensions.cs b/src/Core/src/Platform/Android/ViewExtensions.cs index da702477f4d8..839c706b9f9c 100644 --- a/src/Core/src/Platform/Android/ViewExtensions.cs +++ b/src/Core/src/Platform/Android/ViewExtensions.cs @@ -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) diff --git a/src/Core/src/Platform/Tizen/ViewExtensions.cs b/src/Core/src/Platform/Tizen/ViewExtensions.cs index 83e917292318..7bb64aa7130d 100644 --- a/src/Core/src/Platform/Tizen/ViewExtensions.cs +++ b/src/Core/src/Platform/Tizen/ViewExtensions.cs @@ -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) diff --git a/src/Core/src/Platform/Windows/ViewExtensions.cs b/src/Core/src/Platform/Windows/ViewExtensions.cs index c275fb1c378e..3d19209f5881 100644 --- a/src/Core/src/Platform/Windows/ViewExtensions.cs +++ b/src/Core/src/Platform/Windows/ViewExtensions.cs @@ -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; diff --git a/src/Core/src/Platform/WrapperView.cs b/src/Core/src/Platform/WrapperView.cs index 700c440d5ba3..7aeaae954924 100644 --- a/src/Core/src/Platform/WrapperView.cs +++ b/src/Core/src/Platform/WrapperView.cs @@ -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 diff --git a/src/Core/src/Platform/iOS/ViewExtensions.cs b/src/Core/src/Platform/iOS/ViewExtensions.cs index bec1da442bfc..588bed4abfc4 100644 --- a/src/Core/src/Platform/iOS/ViewExtensions.cs +++ b/src/Core/src/Platform/iOS/ViewExtensions.cs @@ -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; From bbd5e2c16a8744c0f0d7e6d1741b55e92e5d6bc3 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 25 Jun 2024 03:04:11 +0800 Subject: [PATCH 2/5] Update IBorder.cs --- src/Core/src/Core/IBorder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/src/Core/IBorder.cs b/src/Core/src/Core/IBorder.cs index 3bd49ee2c71a..4d4cee295b3d 100644 --- a/src/Core/src/Core/IBorder.cs +++ b/src/Core/src/Core/IBorder.cs @@ -3,7 +3,7 @@ /// /// Provides functionality to provide a border. /// -[Obsolete("IBorder is not used and will be removed in a future release. Use IBorderView or IBorderStroke instead.")] +[System.Obsolete("IBorder is not used and will be removed in a future release. Use IBorderView or IBorderStroke instead.")] public interface IBorder { /// From 4a1d16092a950795edbbd6f8b7cd6a8bc01c732a Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 25 Jun 2024 03:17:29 +0800 Subject: [PATCH 3/5] Update IBorder.cs --- src/Core/src/Core/IBorder.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Core/src/Core/IBorder.cs b/src/Core/src/Core/IBorder.cs index 4d4cee295b3d..84cec8723a47 100644 --- a/src/Core/src/Core/IBorder.cs +++ b/src/Core/src/Core/IBorder.cs @@ -1,9 +1,13 @@ -namespace Microsoft.Maui; +using System; +using System.ComponentModel; + +namespace Microsoft.Maui; /// /// Provides functionality to provide a border. /// -[System.Obsolete("IBorder is not used and will be removed in a future release. Use IBorderView or IBorderStroke instead.")] +[EditorBrowsable(EditorBrowsableState.Never)] +[Obsolete("IBorder is not used and will be removed in a future release. Use IBorderView or IBorderStroke instead.")] public interface IBorder { /// From 8fd43458bfd4fb4c8defaedd25459af64406f5da Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 25 Jun 2024 03:38:05 +0800 Subject: [PATCH 4/5] fix usages --- src/Core/src/Handlers/View/ViewHandler.cs | 4 ++++ src/Core/src/ViewExtensions.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Core/src/Handlers/View/ViewHandler.cs b/src/Core/src/Handlers/View/ViewHandler.cs index eb3ac9b6eaaf..f63053a52e76 100644 --- a/src/Core/src/Handlers/View/ViewHandler.cs +++ b/src/Core/src/Handlers/View/ViewHandler.cs @@ -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 @@ -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 /// /// Maps the abstract property to the platform-specific implementations. /// @@ -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); diff --git a/src/Core/src/ViewExtensions.cs b/src/Core/src/ViewExtensions.cs index 75cc700f25f7..7abedf01dd5c 100644 --- a/src/Core/src/ViewExtensions.cs +++ b/src/Core/src/ViewExtensions.cs @@ -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 retore CS0618 // Type or member is obsolete #elif WINDOWS if (view is IBorderView border) return border?.Shape != null || border?.Stroke != null; From 0564719ad9983bc278c84f3c5053b36a5de94140 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 25 Jun 2024 03:47:15 +0800 Subject: [PATCH 5/5] Update ViewExtensions.cs --- src/Core/src/ViewExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/src/ViewExtensions.cs b/src/Core/src/ViewExtensions.cs index 7abedf01dd5c..0b7a53d9eaca 100644 --- a/src/Core/src/ViewExtensions.cs +++ b/src/Core/src/ViewExtensions.cs @@ -63,7 +63,7 @@ internal static bool NeedsContainer(this IView? view) #pragma warning disable CS0618 // Type or member is obsolete if (view is IBorder border && border.Border != null) return true; -#pragma warning retore CS0618 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete #elif WINDOWS if (view is IBorderView border) return border?.Shape != null || border?.Stroke != null;