Commit 79e56d8
fix(iOS): drain UISceneConnectionOptions on cold launch (AvaloniaUI#21362) (AvaloniaUI#21394)
When the iOS app uses scene-based lifecycle (iOS 13+), Apple delivers
cold-launch user activities and URL contexts via UISceneConnectionOptions
on scene:willConnectToSession:options: — NOT via the warm-path selectors
scene:continueUserActivity: or scene:openURLContexts:. AvaloniaSceneDelegate
ignored connectionOptions entirely, so cold-launching the app from a
Universal Link or custom-scheme URL dropped the URL on the floor.
The user's subscriber to IActivatableLifetime.Activated then only saw
the base ActivatedEventArgs raised by the foreground transition
(OnLeavingBackground), never a ProtocolActivatedEventArgs with the URL.
Fix: in WillConnect, after the window is created and made key, drain
both connectionOptions.UserActivities and connectionOptions.UrlContexts
through the existing IAvaloniaAppInternalDelegate paths. Also add a
scene:openURLContexts: handler so warm custom-scheme URLs work under
scene lifecycle (previously these were silently dropped too —
application:openURL: on the AppDelegate is not called when scenes are
in use).
Closes AvaloniaUI#21362 (cold path of AvaloniaUI#17600 / AvaloniaUI#18005).
The IAvaloniaAppInternalDelegate interface gains an OpenUrl(NSUrl)
method so the scene delegate can route URL contexts through the same
code path the existing application:openURL:options: AppDelegate handler
uses.
No new tests — the Avalonia.iOS UnitTests and IntegrationTests projects
don't currently exist in the repo. Manual verification steps in the
issue: build any Avalonia.iOS app with Associated Domains entitlement
+ AASA served, force-quit, tap a Universal Link, observe the
Activated event fires with ProtocolActivatedEventArgs (not base
ActivatedEventArgs). Happy to add a test if maintainers can point at
a scene-lifecycle test fixture to model from.1 parent 74109cc commit 79e56d8
2 files changed
Lines changed: 49 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| |||
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
101 | | - | |
| 105 | + | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
25 | 39 | | |
26 | 40 | | |
27 | 41 | | |
| |||
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
34 | 77 | | |
35 | 78 | | |
36 | 79 | | |
| |||
0 commit comments