Skip to content

feat: Support for iOS SceneDelegate - #19083

Merged
MartinZikmund merged 28 commits into
feature/breakingchangesfrom
dev/mazi/scenedelegate
Sep 1, 2026
Merged

MartinZikmund merged 28 commits into
feature/breakingchangesfrom
dev/mazi/scenedelegate

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Dec 14, 2024 •

Copy link
Copy Markdown
Member

GitHub Issue (If applicable): closes #19082, closes https://github.com/unoplatform/uno-private/issues/1182, closes https://github.com/unoplatform/uno-private/issues/660

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@github-actions github-actions Bot added platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/automation Categorizes an issue or PR as relevant to project automation labels Dec 14, 2024
@MartinZikmund MartinZikmund changed the title chore: Start SceneDelegate support feat: Support for iOS SceneDelegate Dec 14, 2024
@MartinZikmund MartinZikmund changed the title feat: Support for iOS SceneDelegate [WIP] feat: Support for iOS SceneDelegate Dec 14, 2024
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 150308 has failed on Uno.UI - CI.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days.

@github-actions github-actions Bot added the stale This item has been marked as stale and will be closed if there is no activity. label Feb 15, 2025
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot removed the stale This item has been marked as stale and will be closed if there is no activity. label Feb 18, 2025
@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 155379 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 155528 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 155652 has failed on Uno.UI - CI.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 156060 has failed on Uno.UI - CI.

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/scenedelegate branch from cb590b8 to 304bfba Compare April 2, 2025 07:22
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 159422 has failed on Uno.UI - CI.

@MartinZikmund MartinZikmund self-assigned this Apr 3, 2025
MartinZikmund and others added 5 commits August 22, 2026 10:56
The base branch removed Mac Catalyst from the runtime source, but the
scene-delegate work had moved the same code, so the rebase reapplied it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01QTD5frho5FV6f3xFYUuG6V
Secondary windows crashed with "IDragDropManager is set twice on
CoreDragDropManager": InitDragAndDrop runs while the native window is
created, and with AttachToWindow deferred until afterwards the content
root could not resolve its owner window, so it fell back to the main
window's manager.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01QTD5frho5FV6f3xFYUuG6V
Apple documents NSUserActivity.ActivityType as a reverse-DNS
identifier. "platform.uno.window" was forward-DNS; the reverse form of
the platform.uno domain is "uno.platform.*", matching the bundle
identifiers already used by the sample apps.

The activity is only ever read back in-process from
UISceneConnectionOptions, so no NSUserActivityTypes plist entry is
required.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GP2BeVCQzY3sQB7QBv173u
The comment claimed ConfigureWindowChrome would be re-invoked once
NativeAppWindow became available via AppWindow.Changed, but
OnAppWindowChanged only calls it when args.DidPresenterChange is true.
No such retry path exists, so describe the guard as defensive instead.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GP2BeVCQzY3sQB7QBv173u
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/scenedelegate branch from 6bb62a1 to 3d7b391 Compare August 22, 2026 09:51
@unodevops

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 7m 46s —— View job


Claude Review — PR #19083 · iOS SceneDelegate support

Verdict: fix-first (one medium finding remains open)


What was reviewed

All nine changed files read in full:

  • AppleUIKitWindowWrapper.cs (434 lines) — core scene lifecycle
  • UnoUISceneDelegate.cs (171 lines) — UISceneDelegate implementation
  • SceneWindowRegistry.cs (79 lines) — token-based window/scene correlation
  • NativeWindowFactoryExtension.cs (78 lines) — RequestScene / SupportsMultipleWindows
  • UnoUIApplicationDelegate.cs (104 lines) — non-scene-manifest lifecycle
  • DesktopWindow.cs — AttachToWindow ordering
  • WindowChrome.cs — native window guard comment
  • VisualTree.cs / ElementCompositionPreview.cs — null-conditional hardening

Findings

🟡 MEDIUM — OnSceneDisconnected discards MarkHidden() return value

File: AppleUIKitWindowWrapper.cs:228

OnSceneDisconnected is called by UIKit — it can arrive without a preceding DidEnterBackground under memory pressure or a force-quit from the app switcher. When this is the last visible scene, the app has no other path to raise EnteredBackground/Suspending, so it loses the chance to persist state before termination.

OnSceneEnteredBackground (line 216) already does this correctly:

if (MarkHidden())
{
    Application.Current?.RaiseEnteredBackground(() => Application.Current?.RaiseSuspending());
}

The same pattern should be applied at line 228. CloseCore intentionally discards the return (programmer-initiated close ≠ app backgrounding), but here the initiator is the OS — so the same reasoning doesn't apply.

Inline suggestion posted: comment


Resolved from prior rounds ✅

Area Resolution
CloseCore discards MarkHidden() return Intentional by design — closing a window ≠ app entering background
ActivityType = "uno.platform.window" Fixed in 8bf345cc — correct reverse-DNS for platform.uno
WindowChrome.cs misleading comment Fixed in 3d7b391e
DesktopWindow.cs AttachToWindow ordering Fixed in 769954db with explanatory comment
UnoUIApplicationDelegate non-scene lifecycle NativeWindowWrapper.Instance restored; OnNativeActivated calls reinstated
WillConnect graceful fallback (empty registry) Fixed in a0702db7 — logs warning + destroys session
Thread-safe _visibleWindowCount counter MarkVisible/MarkHidden protected by _visibilityGate lock with _isCountedVisible idempotency
Observer lifetime (CompositeDisposable) Both orientation registrations stored; disposed in CloseCore
SceneWindowRegistry FIFO fallback Correct — oldest-pending wrapper matched when token is absent
NSUserActivity.BecomeCurrent() Not needed — activity passed in-process directly to the activation API

Architecture notes (no action required)

The overall design is solid:

  • Token-based scene↔window correlation in SceneWindowRegistry correctly handles the async gap between Window.Create() and WillConnect
  • _isSceneDisconnected guard in CloseCore prevents double-destroy when the OS disconnects a scene we're also programmatically closing
  • HasSceneManifest static cache cleanly bifurcates the single-window (non-scene) and multi-window (scene-manifest) lifecycle paths
  • SupportsMultipleWindows correctly gates on both HasSceneManifest and UIApplication.SupportsMultipleScenes

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229440 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 182

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Examples.png
    • ImageBrush_Stretch.png
    • Image_Margin_Large.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ContentControl_Inheritance.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Attributed_text_FontSize_Changing.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Image_AnimatedWebP.png-dark
  • skia-windows-screenshots: 182 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • Buttons.png-dark
    • Buttons.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ExpanderColorValidationPage.png-dark
    • Focus_FocusState.png-dark
    • Focus_FocusState.png
    • ChatBox.png-dark
    • ChatBox.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • CalendarView_Theming.png-dark
    • EmailManagerTests.png-dark
    • EmailManagerTests.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png

@mergify

mergify Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

1 similar comment
@mergify

mergify Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

AppleUIKitCorePointerInputSource and UnoKeyboardInputSource were
process-wide singletons shared by every window's PointerManager,
so touches from any scene were broadcast to every open window
instead of just the one that was touched. Each RootViewController
now owns its own instances, resolved via the requesting host,
mirroring the pattern Win32WindowWrapper already uses.
@github-actions

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 231152 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 246

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ImageBrush_Stretch.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • DynamicFont.png
    • ContentControl_Inheritance.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • CalendarView_Theming.png-dark
    • ContextRequested.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • DropDownButtonPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 246 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Battery.png
    • Clipping652.png-dark
    • Clipping652.png
    • Examples.png
    • Battery.png-dark
    • Grid_def_MinMaxValues.png-dark
    • Grid_def_MinMaxValues.png
    • ImageAlignment2541.png-dark
    • ImageAlignment2541.png
    • AuthenticationBroker_Demo.png
    • AuthenticationBroker_Demo.png-dark
    • Attributed_text_FontSize_Changing.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • ChatBox.png-dark
    • ChatBox.png
    • ButtonClippingTestsControl.png-dark
    • CameraCaptureUISample.png-dark
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png

@mergify

mergify Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

MartinZikmund added a commit that referenced this pull request Sep 1, 2026
The ms-appdata load intermittently never completes on the Android Skia
runtime-test host: the test starts, then 30 seconds of total silence
follow with no ImageOpened, no ImageFailed and no exception, until the
inner WaitAsync trips. That is the same signature already tracked for
the Linux hosts in #23967, which the existing exclusion covers.

#24215 already excluded SkiaAndroid for this test, but gated behind
RUNTIME_NATIVE_AOT while investigating #24271. The hang is not specific
to NativeAOT -- it reproduces on the plain Android Skia leg -- so the
exclusion is un-gated here rather than duplicated, and #24271 is kept
in the comment.

The test only began running on Android at all once #24003 aligned shard
0's UITEST_RUNTIME_TEST_GROUP_COUNT (4 -> 5, 005db43): selection is
a stable hash modulo that count, so before the fix When_MsAppData was
one of the 14.7% of methods no shard selected. It is not a new failure,
just a newly executed one.

Since that merge it has failed on three unrelated PR builds within
hours of each other -- 231145 (#24186), 231142 (#24194) and 231152
(#19083) -- where the isolated retry only sometimes recovers, so it
reddens whichever PR happens to be unlucky. master still carries the
old count of 4 and therefore never runs it.

Scoped to this test alone: When_MsAppData_StreamDisposed_FileNotLocked
and When_Exif_Rotated_MsAppData use the same ms-appdata path and run
green on Android in every post-fix build checked, so they keep running.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015Lk1RUZfAj6A7xGWzYaoBw
@MartinZikmund
MartinZikmund merged commit 43b608b into feature/breakingchanges Sep 1, 2026
46 of 47 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/scenedelegate branch September 1, 2026 16:12
@github-actions github-actions Bot mentioned this pull request Sep 1, 2026
4 of 5 tasks
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 area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Support for SceneDelegate

5 participants