fix android deeplink activation#22301
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Android deeplink activation by ensuring that protocol activation events are properly handled on Android Skia builds. The fix addresses the issue where deeplinks received before the application is fully running would not trigger the OnActivated event correctly.
Key changes:
- Enables
ProtocolActivatedEventArgsconstructor across all platforms by removing platform-specific conditional compilation - Implements deferred protocol activation for Android Skia using a ThreadStatic storage mechanism
- Updates generated code to reflect the platform availability changes
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Uno.UWP/Generated/3.0.0.0/Windows.ApplicationModel.Activation/ProtocolActivatedEventArgs.cs |
Simplifies conditional compilation directives from multi-platform checks to #if false, effectively disabling the generated implementations in favor of the partial class implementations |
src/Uno.UWP/ApplicationModel/Activation/ProtocolActivatedEventArgs.cs |
Removes __APPLE_UIKIT__ || __ANDROID__ || __WASM__ conditional compilation, making the constructor available on all platforms including Android Skia |
src/Uno.UI/UI/Xaml/NativeApplication.cs |
Adds Android Skia-specific logic to defer protocol activation when the app is not yet running, storing the URI for later activation |
src/Uno.UI/UI/Xaml/Application.skia.cs |
Introduces _activationUri ThreadStatic field and SetActivationUri method to store deferred activation URIs, then triggers OnActivated after OnLaunched completes on Android |
Comments suppressed due to low confidence (1)
src/Uno.UWP/ApplicationModel/Activation/ProtocolActivatedEventArgs.cs:30
- The platform-specific conditional compilation directive has been removed, making this constructor available on all platforms. However, there's no corresponding test coverage to verify that deeplink activation works correctly across all platforms, especially for the Android Skia scenario this PR is fixing. Consider adding runtime tests in the Uno.UI.RuntimeTests project to verify protocol activation behavior, particularly testing the deferred activation scenario where the app is not running when the deeplink is received.
/// <summary>
/// Internal-only constructor for protocol activation.
/// </summary>
/// <param name="uri">Activated uri.</param>
/// <param name="previousExecutionState">Previous execution state.</param>
internal ProtocolActivatedEventArgs(Uri uri, ApplicationExecutionState previousExecutionState)
{
Uri = uri;
PreviousExecutionState = previousExecutionState;
}
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22301/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22301/docs/index.html |
|
This is a WA until @MartinZikmund PR is merged #20027 which is fixing/updating the app activation for both iOS and Android |
|
/unobot backport release/stable/6.4 |
…bp22301 fix android deeplink activation (backport #22301)
GitHub Issue: closes #22300
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️