Skip to content

Replace MessagingCenter in AlertManager #27888

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

Merged
merged 7 commits into from
Jun 17, 2025
Merged

Replace MessagingCenter in AlertManager #27888

merged 7 commits into from
Jun 17, 2025

Conversation

jfversluis
Copy link
Member

@jfversluis jfversluis commented Feb 18, 2025

Description of Change

This is #12910 but targeting .NET 10.

Since the MessagingCenter was obsolete and now marked internal, we would love to remove it! Now it is happening!!!

This PR starts that process by removing usages of the MessagingCenter in the AlertManager.

Fixes #28857
Closes #12910

@jfversluis
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis jfversluis added this to the .NET 10.0-preview2 milestone Feb 18, 2025
@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

@jfversluis Could you rebase and fix the conflict? Thanks in advance.

@jfversluis jfversluis marked this pull request as ready for review June 10, 2025 13:17
@Copilot Copilot AI review requested due to automatic review settings June 10, 2025 13:17
@jfversluis jfversluis requested a review from a team as a code owner June 10, 2025 13:17
@jfversluis jfversluis requested a review from rmarinho June 10, 2025 13:17
@jfversluis jfversluis moved this from Todo to Ready To Review in MAUI SDK Ongoing Jun 10, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the deprecated MessagingCenter usage from the AlertManager and related components in favor of direct method calls, in line with the plan to decouple MessagingCenter from alert interactions. Key changes include:

  • Removal of MessagingCenter subscription/unsubscription in tests and platform implementations.
  • Replacement of MessagingCenter.Send calls in Page.cs with corresponding AlertManager Request calls.
  • Adjustments in Window.cs and NavigationPage.cs to align with the new AlertManager APIs.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Controls/tests/Core.UnitTests/PageTests.cs Removed MessagingCenter invocations and related tests.
src/Controls/tests/Core.UnitTests/AlertManagerTests.cs Added unit tests validating the new AlertManager subscription behavior.
src/Controls/src/Core/Window/Window.cs Moved SendWindowAppearing call to occur after handler assignment for better synchronization.
src/Controls/src/Core/Platform/AlertManager/*.cs Updated platform-specific AlertManager implementations to use partial methods instead of MessagingCenter.
src/Controls/src/Core/Page/Page.cs Replaced MessagingCenter.Send calls with AlertManager.Request* calls for alerts, action sheets, prompts, and busy notifications.
src/Controls/src/Core/NavigationPage/NavigationPage.cs Reordered a child removal call to follow setting the current page.
Comments suppressed due to low confidence (1)

src/Controls/src/Core/NavigationPage/NavigationPage.cs:787

  • [nitpick] The reordering of removing the current page from inner children—now performed after setting the new current page—may impact page lifecycle or navigation behavior. Please verify that this change is intentional and consistent with expected navigation state transitions.
Owner.RemoveFromInnerChildren(currentPage);

@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Jun 17, 2025
@rmarinho rmarinho merged commit 850f52d into net10.0 Jun 17, 2025
129 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Jun 17, 2025
@rmarinho rmarinho deleted the dev/messenger-net10 branch June 17, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants