Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
@@ -1,7 +1,20 @@
namespace Microsoft.Maui.Platform;

internal interface IPlatformMeasureInvalidationController
/// <summary>
/// Provides platform-specific measure invalidation control for iOS views.
/// </summary>
public interface IPlatformMeasureInvalidationController
{
/// <summary>
/// Schedules measure invalidation to occur when the view is moved to a window.
/// This is used to handle scenarios where invalidation is attempted before the view is attached to a window.
/// </summary>
void InvalidateAncestorsMeasuresWhenMovedToWindow();

/// <summary>
/// Invalidates the current view via SetNeedsLayout and returns whether to continue propagating the invalidation to ancestors or not.
/// </summary>
/// <param name="isPropagating">True if this invalidation is being propagated from a descendant view, false if this is the initial view that triggered the invalidation.</param>
/// <returns>True to continue propagating invalidation to ancestor views, false to stop propagation.</returns>
bool InvalidateMeasure(bool isPropagating = false);
}
7 changes: 5 additions & 2 deletions src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#nullable enable
#nullable enable
Microsoft.Maui.Platform.IPlatformMeasureInvalidationController
Microsoft.Maui.Platform.IPlatformMeasureInvalidationController.InvalidateAncestorsMeasuresWhenMovedToWindow() -> void
Microsoft.Maui.Platform.IPlatformMeasureInvalidationController.InvalidateMeasure(bool isPropagating = false) -> bool
virtual Microsoft.Maui.Animations.Lerp.LerpDelegate.Invoke(object! start, object! end, double progress) -> object!
Microsoft.Maui.Converters.SafeAreaEdgesTypeConverter
Microsoft.Maui.Converters.SafeAreaEdgesTypeConverter.SafeAreaEdgesTypeConverter() -> void
Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.ContextFlyoutItemHandlerUpdate(Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate! original) -> void
Expand Down Expand Up @@ -223,7 +227,6 @@ static Microsoft.Maui.SwipeViewSwipeEnded.operator !=(Microsoft.Maui.SwipeViewSw
static Microsoft.Maui.SwipeViewSwipeEnded.operator ==(Microsoft.Maui.SwipeViewSwipeEnded? left, Microsoft.Maui.SwipeViewSwipeEnded? right) -> bool
static Microsoft.Maui.SwipeViewSwipeStarted.operator !=(Microsoft.Maui.SwipeViewSwipeStarted? left, Microsoft.Maui.SwipeViewSwipeStarted? right) -> bool
static Microsoft.Maui.SwipeViewSwipeStarted.operator ==(Microsoft.Maui.SwipeViewSwipeStarted? left, Microsoft.Maui.SwipeViewSwipeStarted? right) -> bool
virtual Microsoft.Maui.Animations.Lerp.LerpDelegate.Invoke(object! start, object! end, double progress) -> object!
virtual Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.<Clone>$() -> Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate!
virtual Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.EqualityContract.get -> System.Type!
virtual Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.Equals(Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate? other) -> bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#nullable enable
#nullable enable
Microsoft.Maui.Platform.IPlatformMeasureInvalidationController
Microsoft.Maui.Platform.IPlatformMeasureInvalidationController.InvalidateAncestorsMeasuresWhenMovedToWindow() -> void
Microsoft.Maui.Platform.IPlatformMeasureInvalidationController.InvalidateMeasure(bool isPropagating = false) -> bool
virtual Microsoft.Maui.Animations.Lerp.LerpDelegate.Invoke(object! start, object! end, double progress) -> object!
Microsoft.Maui.Converters.SafeAreaEdgesTypeConverter
Microsoft.Maui.Converters.SafeAreaEdgesTypeConverter.SafeAreaEdgesTypeConverter() -> void
Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.ContextFlyoutItemHandlerUpdate(Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate! original) -> void
Expand Down Expand Up @@ -226,7 +230,6 @@ static Microsoft.Maui.SwipeViewSwipeEnded.operator !=(Microsoft.Maui.SwipeViewSw
static Microsoft.Maui.SwipeViewSwipeEnded.operator ==(Microsoft.Maui.SwipeViewSwipeEnded? left, Microsoft.Maui.SwipeViewSwipeEnded? right) -> bool
static Microsoft.Maui.SwipeViewSwipeStarted.operator !=(Microsoft.Maui.SwipeViewSwipeStarted? left, Microsoft.Maui.SwipeViewSwipeStarted? right) -> bool
static Microsoft.Maui.SwipeViewSwipeStarted.operator ==(Microsoft.Maui.SwipeViewSwipeStarted? left, Microsoft.Maui.SwipeViewSwipeStarted? right) -> bool
virtual Microsoft.Maui.Animations.Lerp.LerpDelegate.Invoke(object! start, object! end, double progress) -> object!
virtual Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.<Clone>$() -> Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate!
virtual Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.EqualityContract.get -> System.Type!
virtual Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.Equals(Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate? other) -> bool
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot delete this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted the IPlatformMeasureInvalidationControllerTests.cs file as requested. Build verified successfully after removal. Commit: df32577

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System;
using Xunit;

#if IOS
using Microsoft.Maui.Platform;

namespace Microsoft.Maui.UnitTests.Platform
{
public class IPlatformMeasureInvalidationControllerTests
{
[Fact]
public void InterfaceCanBeImplemented()
{
// Verify that the interface is public and can be implemented by external code
var implementation = new TestPlatformMeasureInvalidationController();

Assert.NotNull(implementation);
Assert.True(implementation is IPlatformMeasureInvalidationController);
}

[Fact]
public void InvalidateMeasureMethod_CanBeCalledWithDefaultParameter()
{
var implementation = new TestPlatformMeasureInvalidationController();

// Should be able to call with default parameter (isPropagating = false)
bool result = implementation.InvalidateMeasure();

Assert.True(result); // Default implementation returns true
}

[Fact]
public void InvalidateMeasureMethod_CanBeCalledWithExplicitParameter()
{
var implementation = new TestPlatformMeasureInvalidationController();

// Should be able to call with explicit parameter
bool result1 = implementation.InvalidateMeasure(isPropagating: false);
bool result2 = implementation.InvalidateMeasure(isPropagating: true);

Assert.True(result1);
Assert.False(result2); // Test implementation returns false when propagating
}

[Fact]
public void InvalidateAncestorsMeasuresWhenMovedToWindowMethod_CanBeCalled()
{
var implementation = new TestPlatformMeasureInvalidationController();

// Should be able to call without exceptions
implementation.InvalidateAncestorsMeasuresWhenMovedToWindow();

Assert.True(implementation.WasInvalidateAncestorsCalled);
}

/// <summary>
/// Test implementation of IPlatformMeasureInvalidationController for testing purposes.
/// Demonstrates how external customers can implement the interface to control propagation.
/// </summary>
private class TestPlatformMeasureInvalidationController : IPlatformMeasureInvalidationController
{
public bool WasInvalidateAncestorsCalled { get; private set; }

public void InvalidateAncestorsMeasuresWhenMovedToWindow()
{
WasInvalidateAncestorsCalled = true;
}

public bool InvalidateMeasure(bool isPropagating = false)
{
// Return false when propagating to test stopping propagation scenario
// This demonstrates how customers can control propagation behavior
return !isPropagating;
}
}
}
}
#endif
Loading