Repository navigation
Conversation
freakboy3742
left a comment
There was a problem hiding this comment.
Thanks for the PR; the general structure of this is definitely on the right track.
I've left one comment inline about testing; while I understand why you've added them, I suspect that we don't need any of the tests you've added here.
The other detail that needs a tweak is related to the split between Application and Scene notifications. You might notice that all the Scene events are effectively invoked on current_window... which leads to a bigger architectural question: should the details about the Scene lifecycle be tied to the Window that created them?
This came up when we added support for UISceneDelegate. Historically, we've said that iOS apps can only ever have one window; however, on iPads and the new iPhone Duo, you can have multiple windows in an app - each of which is a Scene. If a Scene and a Window are closely bound, then UISceneDelegate events should be attached to the Toga iOS Window implementation, not the App implementation.
However, that's a much bigger design decision. In the interest of constraining the scope of this PR, I'd suggest leave the SceneDelegate unchanged, and stick to just the non-deprecated UIApplicationDelegate methods.
We also don't need to get the full UIApplicationDelegate interface in this pass - there's a lot of methods there (including methods for WatchKit and Siri integration); we can treat those as future additions if someone wants them.
Revert the UISceneDelegate changes.Remove the delegate-invocation tests and mark the hooks that can't be triggered in the testbed as no cover.
On iOS, the app and scene delegates handled native lifecycle events directly, so there was no way for an app to override and add its own behavior to them. The changes follow the approach implemented for macOS in #4599: each
UIApplicationDelegatelifecycle method forwards to auikit_-prefixed method on thetoga_iOSApp class, which can now be overridden by subclassing it and returning it fromtoga.App.create().uikit_application_didFinishLaunchingWithOptions.# pragma: no cover; no new tests were added.Tested on the iOS 27.2 simulator (iPhone Duo): full testbed suite passes with 100% iOS backend coverage. Four layout tests (
test_activityindicator::test_stop_no_shift,test_base::test_visibility,test_display,test_parenting) fail because widgets are placed 24 points lower than the tests expect. They also fail onmain, so they're unrelated to this change.Refs #4478
PR Checklist:
Assisted-by: Claude Opus 5.5