KEMBAR78
[NET 10] Make public some APIs for StackNavigationManager on Android by pictos · Pull Request #30455 · dotnet/maui · GitHub
Skip to content

Conversation

pictos
Copy link
Contributor

@pictos pictos commented Jul 7, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

This is building using net9, but the merge must happens on net10 branch

Issues Fixed

Fixes #30454

@Copilot Copilot AI review requested due to automatic review settings July 7, 2025 00:08
@pictos pictos requested a review from a team as a code owner July 7, 2025 00:08
@pictos pictos requested review from jfversluis and mattleibow July 7, 2025 00:08
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 exposes and refines navigation APIs on Android’s StackNavigationManager, allowing customization of fragment types and improving handler initialization.

  • Exposed several internal navigation properties and methods in PublicAPI.Unshipped.txt
  • Changed access modifiers on StackNavigationManager members and added SetNavigationViewFragmentType
  • Updated NavigationViewHandler to lazily initialize and enforce a single StackNavigationManager instance

Reviewed Changes

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

File Description
src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt Added entries for new StackNavigationManager navigation APIs
src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs Made navigation members protected, added _navigationViewFragmentType, SetNavigationViewFragmentType, and updated AddFragmentDestination
src/Core/src/Handlers/NavigationPage/NavigationViewHandler.Android.cs Changed StackNavigationManager property to protected with setter, using lazy init and single-instance enforcement
Comments suppressed due to low confidence (8)

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:226

  • The new SetNavigationViewFragmentType method isn't covered by existing tests. Please add UI tests in TestCases.HostApp and TestCases.Shared.Tests to validate custom fragment type injection.
		public void SetNavigationViewFragmentType(Type type)

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:226

  • After introducing SetNavigationViewFragmentType and related public APIs, please update the XML documentation in the /docs/ folder to describe the new customization feature.
		public void SetNavigationViewFragmentType(Type type)

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:36

  • The NavHost property is declared as protected but is listed in PublicAPI.Unshipped.txt; consider making it public to match the exposed API surface.
		protected NavHostFragment NavHost =>

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:39

  • The NavController property is declared as protected but is listed in PublicAPI.Unshipped.txt; consider making it public to match the exposed API surface.
		protected NavController NavController =>

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:42

  • The FragmentNavigator property is declared as protected but is listed in PublicAPI.Unshipped.txt; consider making it public to match the exposed API surface.
		protected FragmentNavigator FragmentNavigator =>

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:45

  • The NavGraph property is declared as protected but is listed in PublicAPI.Unshipped.txt; consider making it public to match the exposed API surface.
		protected NavGraph NavGraph => _navGraph ??

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:48

  • The HasNavHost property is declared as protected but is listed in PublicAPI.Unshipped.txt; consider making it public to match the exposed API surface.
		protected bool HasNavHost => _navHost is not null;

src/Core/src/Platform/Android/Navigation/StackNavigationManager.cs:55

  • The ToolbarElement property is declared as protected but is listed in PublicAPI.Unshipped.txt; consider making it public to match the exposed API surface.
		protected IToolbarElement? ToolbarElement =>

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 7, 2025
@PureWeen PureWeen added this to the .NET 10.0-preview7 milestone Jul 7, 2025
@PureWeen PureWeen added the p/0 Work that we can't release without label Jul 7, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

There are a few more necessary pending changes:

C:\a\_work\1\s\src\Core\src\Handlers\Toolbar\ToolbarHandler.Android.cs(81,40): error CS0122: 'StackNavigationManager.NavGraph' is inaccessible due to its protection level [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net9.0-android35.0]
C:\a\_work\1\s\src\Core\src\Platform\Android\Navigation\NavigationViewFragment.cs(72,51): error CS0122: 'StackNavigationManager.HasNavHost' is inaccessible due to its protection level [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net9.0-android35.0]
    2 Error(s)

@github-project-automation github-project-automation bot moved this from Todo to Changes Requested in MAUI SDK Ongoing Jul 7, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen moved this from Changes Requested to Ready To Review in MAUI SDK Ongoing Jul 17, 2025
@pictos pictos requested a review from jsuarezruiz July 21, 2025 01:03
@pictos pictos mentioned this pull request Jul 22, 2025
@PureWeen
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the navigation-handler-droid-net10 branch from 0cb499f to b5fc34f Compare July 24, 2025 20:45
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

jsuarezruiz
jsuarezruiz previously approved these changes Jul 28, 2025
@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Jul 28, 2025
@rmarinho rmarinho changed the base branch from main to net10.0 July 28, 2025 11:42
@rmarinho rmarinho dismissed jsuarezruiz’s stale review July 28, 2025 11:42

The base branch was changed.

@rmarinho
Copy link
Member

@pictos needs rebase on top of net10 please

@rmarinho rmarinho moved this from Approved to Changes Requested in MAUI SDK Ongoing Jul 28, 2025
@rmarinho rmarinho requested review from PureWeen and jsuarezruiz July 28, 2025 11:43
@PureWeen PureWeen force-pushed the navigation-handler-droid-net10 branch from b5fc34f to ccc2888 Compare July 28, 2025 19:55
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

/backport to release/10.0.1xx-preview7

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx-preview7: https://github.com/dotnet/maui/actions/runs/16578966943

@github-project-automation github-project-automation bot moved this from Changes Requested to Approved in MAUI SDK Ongoing Jul 29, 2025
@jfversluis jfversluis enabled auto-merge (squash) July 29, 2025 14:28
@rmarinho rmarinho disabled auto-merge July 29, 2025 17:30
@rmarinho rmarinho merged commit f0f564f into dotnet:net10.0 Jul 29, 2025
125 of 129 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Jul 29, 2025
@pictos pictos deleted the navigation-handler-droid-net10 branch July 29, 2025 22:35
@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution p/0 Work that we can't release without

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[NET 10] Make public members to allow access to Navigation members on Android

5 participants