|
| 1 | +<!-- markdownlint-disable MD024 --> |
| 2 | + |
| 3 | +# Migration Guides |
| 4 | + |
| 5 | +This document describes upgrade steps for breaking changes in the mParticle Flutter SDK. It only covers changes that require action on the Flutter side (`ios/Podfile`, Xcode project settings, Dart code, or the `MPRoktEvents` event channel). |
| 6 | + |
| 7 | +For changes in the underlying native iOS SDK (database migration, deprecated `UIApplicationDelegate` methods, removed `AppDelegateProxy`, regional routing / ATS, Rokt event class renames at the Swift/Objective-C level, etc.), refer to the [mParticle Apple SDK 9 migration guide](https://github.com/mParticle/mparticle-apple-sdk/blob/main/MIGRATING.md#migrating-from-versions--900). |
| 8 | + |
| 9 | +## Migrating from versions < 2.0.0 |
| 10 | + |
| 11 | +Version 2.0.0 wraps the mParticle Apple SDK 9 on iOS. No Dart source changes are required for existing `selectPlacements`, `purchaseFinalized`, or `MPRoktEvents` integrations, but the iOS build configuration must be updated. |
| 12 | + |
| 13 | +### iOS deployment target raised to 15.6 |
| 14 | + |
| 15 | +The plugin now requires iOS 15.6+. Update the following in your app: |
| 16 | + |
| 17 | +- `ios/Podfile`: |
| 18 | + |
| 19 | + ```ruby |
| 20 | + platform :ios, '15.6' |
| 21 | + ``` |
| 22 | + |
| 23 | +- `ios/Flutter/AppFrameworkInfo.plist` — set `MinimumOSVersion` to `15.6`. |
| 24 | +- In Xcode, raise the Runner target's **iOS Deployment Target** to `15.6`. |
| 25 | + |
| 26 | +After updating, run: |
| 27 | + |
| 28 | +```sh |
| 29 | +cd ios |
| 30 | +pod deintegrate |
| 31 | +pod install |
| 32 | +cd .. |
| 33 | +``` |
| 34 | + |
| 35 | +### Updated CocoaPods dependencies |
| 36 | + |
| 37 | +The plugin now depends on mParticle Apple SDK 9. In SDK 9 the podspec was restructured and subspecs are gone, so the `/mParticle` suffix is no longer valid: |
| 38 | + |
| 39 | +| Before (1.x) | After (2.0.0) | |
| 40 | +| -------------------------------------- | ---------------------------- | |
| 41 | +| `mParticle-Apple-SDK/mParticle ~> 8.5` | `mParticle-Apple-SDK ~> 9.0` | |
| 42 | + |
| 43 | +If your app's `Podfile` pins a subspec (for example `pod 'mParticle-Apple-SDK/mParticle', ...`), update it to the new form above. |
| 44 | + |
| 45 | +### Rokt event channel — new event types |
| 46 | + |
| 47 | +Consumers of the `EventChannel('MPRoktEvents')` stream will receive four additional `event` values. The string values for **previously existing** event types are unchanged (`FirstPositiveEngagement`, `OfferEngagement`, `PlacementReady`, `PlacementClosed`, `PlacementCompleted`, `PlacementFailure`, `PlacementInteractive`, `PositiveEngagement`, `OpenUrl`, `CartItemInstantPurchase`, `InitComplete`), so existing listeners continue to work. |
| 48 | + |
| 49 | +New event types and their payload keys: |
| 50 | + |
| 51 | +| `event` | Additional keys | |
| 52 | +| ---------------------------------- | ------------------------------------------------ | |
| 53 | +| `CartItemInstantPurchaseInitiated` | `cartItemId`, `catalogItemId` | |
| 54 | +| `CartItemInstantPurchaseFailure` | `cartItemId`, `catalogItemId`, `error` | |
| 55 | +| `InstantPurchaseDismissal` | — | |
| 56 | +| `CartItemDevicePay` | `cartItemId`, `catalogItemId`, `paymentProvider` | |
| 57 | + |
| 58 | +Any `switch (event['event'])` that did not have a `default` branch should be extended to handle (or explicitly ignore) the new types. Example: |
| 59 | + |
| 60 | +```dart |
| 61 | +roktEventChannel.receiveBroadcastStream().listen((dynamic event) { |
| 62 | + final Map<String, dynamic> payload = Map<String, dynamic>.from(event); |
| 63 | + switch (payload['event']) { |
| 64 | + case 'PlacementReady': |
| 65 | + // ... |
| 66 | + break; |
| 67 | + case 'CartItemInstantPurchase': |
| 68 | + // ... |
| 69 | + break; |
| 70 | + case 'CartItemInstantPurchaseInitiated': |
| 71 | + case 'CartItemInstantPurchaseFailure': |
| 72 | + case 'InstantPurchaseDismissal': |
| 73 | + case 'CartItemDevicePay': |
| 74 | + // New in 2.0.0 — handle or ignore as needed. |
| 75 | + break; |
| 76 | + default: |
| 77 | + break; |
| 78 | + } |
| 79 | +}); |
| 80 | +``` |
| 81 | + |
| 82 | +### New Rokt API: `selectShoppableAds` (iOS only) |
| 83 | + |
| 84 | +```dart |
| 85 | +await MparticleFlutterSdk.getInstance().then((mp) => mp?.rokt.selectShoppableAds( |
| 86 | + identifier: 'shoppable-ads-placement', |
| 87 | + attributes: {'email': 'user@example.com'}, |
| 88 | + )); |
| 89 | +``` |
| 90 | + |
| 91 | +- **iOS**: proxies to `MParticle.sharedInstance().rokt.selectShoppableAds(...)`. |
| 92 | +- **Android**: the method is exposed for API parity but is a no-op (logs a warning). |
| 93 | +- **Web**: not implemented — calls will throw `MissingPluginException`. |
| 94 | + |
| 95 | +Events for a shoppable ads placement are delivered on the existing `MPRoktEvents` `EventChannel` once `selectShoppableAds` has been called. |
| 96 | + |
| 97 | +The Rokt Apple Pay payment extension (for example `RoktStripePaymentExtension`) is **not** proxied through Dart. Integrators must register it directly from native Swift/Objective-C in the host app (for example `ios/Runner/AppDelegate.swift`), after `MParticle.sharedInstance().start(with:)`. See the [Apple SDK Rokt integration section](https://github.com/mParticle/mparticle-apple-sdk/blob/main/README.md#rokt-integration) for the exact snippet. |
0 commit comments