Skip to content

Commit 7c89744

Browse files
committed
MOBILE-171: Document UISceneDelegate migration for integrators
Apps that declare `UIApplicationSceneManifest` in `Info.plist` no longer receive `application(_:didFinishLaunchingWithOptions:)` with a populated `launchOptions`, and `application(_:continue:restorationHandler:)` is not invoked at all — universal-link arrivals land in `scene(_:continue:)` on the scene delegate. Without forwarding those events Mindbox loses launch and universal-link tracking. `UISCENE_MIGRATION.md` (at the repo root for discoverability) describes only the Mindbox-side glue: where to call `Mindbox.shared.track(.launchScene(_:))` and `Mindbox.shared.track(.universalLink(_:))` from the customer's `SceneDelegate`, and confirms that the rest (APNS token, push handlers, BG tasks, notification extensions, `MindboxFlutterAppDelegate`) needs no changes under scene mode. Anything that is not Mindbox-specific points at the official Flutter UISceneDelegate guide instead of duplicating it. The repo `README.md` is the single entry point linking to the guide — the per-package READMEs (`mindbox`, `mindbox_ios`) are not the right place for scene-mode integration guidance, since UISceneDelegate is an app-side migration with no implications for the SDK packages themselves.
1 parent 5ff4a82 commit 7c89744

2 files changed

Lines changed: 120 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ Learn how to send events to Mindbox. Create a new Operation class object and set
3232

3333
Mindbox SDK helps handle push notifications. Configuration and usage instructions can be found in the SDK documentation [here](https://developers.mindbox.ru/docs/firebase-send-push-notifications-flutter), [here](https://developers.mindbox.ru/docs/huawei-send-push-notifications-flutter) and [here](https://developers.mindbox.ru/docs/ios-send-push-notifications-flutter).
3434

35+
### iOS UISceneDelegate migration
36+
37+
If your iOS app declares `UIApplicationSceneManifest` in `Info.plist`
38+
(Flutter's [recommended iOS lifecycle][flutter-uiscene] since 3.41), follow
39+
[UISCENE_MIGRATION.md](UISCENE_MIGRATION.md) to update your `AppDelegate`
40+
and add a `SceneDelegate`. Apps that keep the legacy `AppDelegate`-only
41+
flow don't need any code changes.
42+
43+
[flutter-uiscene]: https://docs.flutter.dev/release/breaking-changes/uiscenedelegate
44+
3545
## Troubleshooting
3646

3747
Refer to the [Example of integration(IOS)](https://github.com/mindbox-cloud/flutter-sdk/tree/develop/mindbox_ios/example) or [Example of integration(Android)](https://github.com/mindbox-cloud/flutter-sdk/tree/develop/mindbox_android/example) in case of any issues.

UISCENE_MIGRATION.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Migrating a Mindbox Flutter SDK integration to UISceneDelegate
2+
3+
Starting with Flutter 3.35 the iOS engine ships `FlutterSceneDelegate`, and
4+
since Flutter 3.41 `UISceneDelegate`-based lifecycle is the recommended path
5+
for new iOS Flutter apps. The official Flutter migration guide is the
6+
authoritative source for everything not Mindbox-specific:
7+
8+
- [Flutter UISceneDelegate migration guide][flutter-uiscene]
9+
10+
This document only describes the Mindbox-side glue you need on top of the
11+
Flutter migration: where to forward `.launchScene` and `.universalLink`
12+
events, and what stays in your `AppDelegate`. It does **not** repeat the
13+
Flutter-side steps already covered in the link above (`Info.plist` scene
14+
manifest, `FlutterImplicitEngineDelegate` boilerplate, etc.) — follow them
15+
there and use this page for the Mindbox-specific bits.
16+
17+
If your `Info.plist` does **not** contain `UIApplicationSceneManifest`,
18+
nothing changes for you. The Mindbox iOS SDK pod itself does not depend on
19+
any scene-specific Flutter API, so it keeps building and running on every
20+
Flutter version we supported before. You can update to the latest Mindbox
21+
SDK without touching your code.
22+
23+
## Why this matters for Mindbox integrators
24+
25+
Under `UIApplicationSceneManifest` two `AppDelegate` callbacks Mindbox
26+
previously relied on stop working as before:
27+
28+
- `application(_:didFinishLaunchingWithOptions:)` still fires, but
29+
`launchOptions` is `nil`, so `Mindbox.shared.track(.launch(launchOptions))`
30+
tracks nothing useful.
31+
- `application(_:continue:restorationHandler:)` is never invoked — universal
32+
links arrive in `scene(_:continue:)` instead.
33+
34+
To keep Mindbox receiving launch and universal-link events you need to
35+
forward them from your scene delegate.
36+
37+
## Prerequisites
38+
39+
- **Flutter ≥ 3.41** — required for `FlutterImplicitEngineDelegate` on the
40+
app side (see the Flutter guide above).
41+
- iOS deployment target ≥ 13.0.
42+
43+
## What to add in your scene delegate
44+
45+
Copy
46+
[`example/flutter_example/ios/Runner/SceneDelegate.swift`](../example/flutter_example/ios/Runner/SceneDelegate.swift)
47+
into your `Runner` target. The two relevant calls:
48+
49+
```swift
50+
override func scene(
51+
_ scene: UIScene,
52+
willConnectTo session: UISceneSession,
53+
options connectionOptions: UIScene.ConnectionOptions
54+
) {
55+
Mindbox.shared.track(.launchScene(connectionOptions))
56+
super.scene(scene, willConnectTo: session, options: connectionOptions)
57+
}
58+
59+
override func scene(
60+
_ scene: UIScene,
61+
continue userActivity: NSUserActivity
62+
) {
63+
Mindbox.shared.track(.universalLink(userActivity))
64+
super.scene(scene, continue: userActivity)
65+
}
66+
```
67+
68+
That replaces, respectively, `Mindbox.shared.track(.launch(launchOptions))`
69+
in `application(_:didFinishLaunchingWithOptions:)` and
70+
`Mindbox.shared.track(.universalLink(userActivity))` in
71+
`application(_:continue:restorationHandler:)`.
72+
73+
You may keep both AppDelegate-side and SceneDelegate-side calls — in scene
74+
mode the AppDelegate-side `.launch(nil)` and `application(_:continue:)` are
75+
inert (`launchOptions == nil`, the method is not invoked), so the two paths
76+
do not produce duplicate events.
77+
78+
## What stays unchanged in your AppDelegate
79+
80+
Even after the scene migration you keep all of the following on your
81+
`AppDelegate` (typically a subclass of `MindboxFlutterAppDelegate`):
82+
83+
- `Mindbox.shared.apnsTokenUpdate(deviceToken:)` in
84+
`application(_:didRegisterForRemoteNotificationsWithDeviceToken:)`.
85+
- `Mindbox.shared.pushClicked(response:)` and
86+
`Mindbox.shared.track(.push(response))` in your
87+
`UNUserNotificationCenterDelegate` methods.
88+
- `Mindbox.shared.registerBGTasks()`.
89+
- Notification permission requests.
90+
91+
`UNUserNotificationCenterDelegate` is a process-global API and is not
92+
affected by scene mode, so push handling needs no changes.
93+
94+
`MindboxFlutterAppDelegate` itself is scene-safe — it does not touch
95+
`window` or `rootViewController` — and continues to work as a base class
96+
unchanged.
97+
98+
## Notification Service / Content Extensions
99+
100+
`MindboxNotificationServiceExtension` and
101+
`MindboxNotificationContentExtension` are extension processes and have
102+
nothing to do with the host app's scene flow. They need no changes.
103+
104+
## Reference implementation
105+
106+
[`example/flutter_example/ios/Runner`](../example/flutter_example/ios/Runner)
107+
is fully migrated and serves as a working reference for both the
108+
Flutter-side and Mindbox-side parts of the migration.
109+
110+
[flutter-uiscene]: https://docs.flutter.dev/release/breaking-changes/uiscenedelegate

0 commit comments

Comments
 (0)