Skip to content

feat: Close popups and flyout on hardware back button #20764

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

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

MartinZikmund
Copy link
Member

@MartinZikmund MartinZikmund commented Jun 11, 2025

GitHub Issue: closes #20757

PR Type:

What is the current behavior? πŸ€”

What is the new behavior? πŸš€

PR Checklist βœ…

Please check if your PR fulfills the following requirements:

Other information ℹ️

@Copilot Copilot AI review requested due to automatic review settings June 11, 2025 13:54
@MartinZikmund MartinZikmund marked this pull request as draft June 11, 2025 13:54
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 introduces functionality to handle hardware back button events by closing popups and flyouts. Key changes include:

  • Refactoring the singleton pattern in SystemNavigationManager.
  • Adding BackButtonIntegration for managing back button listeners.
  • Creating runtime tests for back button integration.

Reviewed Changes

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

Show a summary per file
File Description
src/Uno.UWP/UI/Core/SystemNavigationManager.cs Simplified singleton implementation via internal Instance property.
src/Uno.UI/UI/Xaml/Application.cs Added initialization for back button integration.
src/Uno.UI/DirectUI/BackButton/IBackButtonListener.cs Introduced new interface for back button listeners.
src/Uno.UI/DirectUI/BackButton/BackButtonIntegration.cs Implemented listener registration and cleanup using a weak reference pool.
src/Uno.UI.RuntimeTests/Tests/DirectUI/Given_BackButtonIntegration.cs Added tests to verify back button listener behavior.
Comments suppressed due to low confidence (2)

src/Uno.UWP/UI/Core/SystemNavigationManager.cs:9

  • The simplified singleton implementation looks clear and concise; please ensure that changing the visibility to 'internal' is intentional and does not expose the instance beyond its intended scope.
internal static SystemNavigationManager Instance { get; } = new();

src/Uno.UI/DirectUI/BackButton/BackButtonIntegration.cs:45

  • [nitpick] Consider verifying that the weak reference pooling mechanism and removal pattern here meet the application's concurrency requirements, even if it's currently used on the UI thread.
WeakReferencePool.ReturnWeakReference(_listeners, weakListener);

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20764/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20764/docs/index.html

@MartinZikmund MartinZikmund force-pushed the dev/mazi/back-handling-popups branch from afb7760 to cece779 Compare June 11, 2025 14:41
@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20764/docs/index.html

@MartinZikmund MartinZikmund force-pushed the dev/mazi/back-handling-popups branch from cece779 to d16d83c Compare July 2, 2025 14:31
@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20764/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20764/docs/index.html

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20764/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20764/docs/index.html

@github-actions github-actions bot added the area/automation Categorizes an issue or PR as relevant to project automation label Jul 2, 2025
@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20764/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20764/docs/index.html

@MartinZikmund MartinZikmund marked this pull request as ready for review July 2, 2025 16:41
@MartinZikmund MartinZikmund changed the title [WIP] feat: Close popups and flyout on hardware back button feat: Close popups and flyout on hardware back button Jul 2, 2025
@MartinZikmund MartinZikmund marked this pull request as draft July 2, 2025 16:42
@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20764/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20764/docs/index.html

@MartinZikmund MartinZikmund force-pushed the dev/mazi/back-handling-popups branch from 55bb9b8 to e4e4aba Compare July 10, 2025 08:30
@unodevops
Copy link
Contributor

πŸ€– Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-20764/docs/index.html

@unodevops
Copy link
Contributor

πŸ€– Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-20764/wasm-skia-net9/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/automation Categorizes an issue or PR as relevant to project automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Skia Android] Hardware back button does not close popups
2 participants