Browse Source

Support activation with universal links (#18005)

release/11.2.4
kerams 1 year ago
committed by Max Katz
parent
commit
65013d2531
  1. 13
      src/iOS/Avalonia.iOS/AvaloniaAppDelegate.cs

13
src/iOS/Avalonia.iOS/AvaloniaAppDelegate.cs

@ -89,6 +89,19 @@ namespace Avalonia.iOS
return false;
}
[Export("application:continueUserActivity:restorationHandler:")]
public bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler)
{
if (userActivity.ActivityType == NSUserActivityType.BrowsingWeb && Uri.TryCreate(userActivity.WebPageUrl?.ToString(), UriKind.RelativeOrAbsolute, out var uri))
{
// Activation using a univeral link or web browser-to-native app Handoff
_onActivated?.Invoke(this, new ProtocolActivatedEventArgs(uri));
return true;
}
return false;
}
private void OnEnteredBackground(NSNotification notification)
{
_onDeactivated?.Invoke(this, new ActivatedEventArgs(ActivationKind.Background));

Loading…
Cancel
Save