Browse Source

Support activation with universal links (#18005)

pull/18034/head
kerams 1 year ago
committed by GitHub
parent
commit
c15dc0d8c0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  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