From e176de9b49fb5ca0827f6d99bb3aeabb91a7f8b1 Mon Sep 17 00:00:00 2001 From: Anirudha SM Date: Mon, 27 Jul 2026 17:11:01 +0530 Subject: [PATCH] MOEN-46338: Support MoEngage iOS SDK 11.0.0 (Swift concurrency) Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 7 +++++ Package.swift | 2 +- .../MoEngagePluginBase/MoEngagePlugin.swift | 28 +++++++++++++------ ...ePluginAuthenticationListenerHandler.swift | 1 + .../MoEngagePluginUtils.swift | 16 +++++------ package.json | 2 +- 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80710e7..40eba07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# Release Date + +## Release Version + +- [minor] MOEN-46338: Added support for the MoEngage iOS SDK 11.0.0 major release (Swift concurrency migration) +- [major] Updated MoEngage-iOS-SDK to 11.00.0 + # 01-07-2026 ## 6.10.0 diff --git a/Package.swift b/Package.swift index 99c3114..2488c41 100644 --- a/Package.swift +++ b/Package.swift @@ -15,7 +15,7 @@ let package = Package( ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/moengage/apple-sdk.git", exact: "10.14.0") + .package(url: "https://github.com/moengage/apple-sdk.git", exact: "11.00.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/Sources/MoEngagePluginBase/MoEngagePlugin.swift b/Sources/MoEngagePluginBase/MoEngagePlugin.swift index 082addf..6545e3c 100644 --- a/Sources/MoEngagePluginBase/MoEngagePlugin.swift +++ b/Sources/MoEngagePluginBase/MoEngagePlugin.swift @@ -47,13 +47,13 @@ import MoEngageInApps } guard - let sdkConfig = try? MoEngageInitialization.fetchSDKConfigurationFromInfoPlist(), - !sdkConfig.appId.isEmpty + let sdkConfigData = try? MoEngageConfig.FileBased.fetchSDKConfigurationFromInfoPlist(), + !sdkConfigData.workspaceId.isEmpty else { MoEngageLogger.logDefault(message: "App ID is empty. Please provide a valid App ID to setup the SDK.") return nil } - return sdkConfig + return sdkConfigData.asSdkConfig } // MARK: Initialization of default instance @@ -126,28 +126,40 @@ import MoEngageInApps extension MoEngagePlugin: MoEngageModule.Item { static let context: MoEngageSynchronizationContext = "com.moengage.pluginBase" - public static func getInfo(sdkInstance: MoEngageSDKInstance) -> MoEngageModule.Info { - return .init(name: "pluginBase", version: MoEngagePluginConstants.version) + public static func getInfo(sdkInstance: isolated MoEngageSDKInstance) -> MoEngageModule.Info? { + return MoEngageModule.Info(identity: .init(name: "pluginBase", version: MoEngagePluginConstants.version)) } - public static func process(event: MoEngageModule.Event, sdkInstance: MoEngageSDKInstance) { + public static func process(event: MoEngageModule.Event, sdkInstance: isolated MoEngageSDKInstance) { context.execute { switch event { case .`init`: - Self.setDelegates(identifier: sdkInstance.sdkConfig.appId) + Self.setDelegates(identifier: sdkInstance.config.workspaceId) default: break } } } + public static func process(event: MoEngageModule.AsyncEvent, sdkInstance: isolated MoEngageSDKInstance) async { + // MoEngagePluginBase has no asynchronous lifecycle work. + } + + public static func listensToAdditionalNotifications() -> [Notification.Name] { + return [] + } + private static func setDelegates(identifier: String) { _ = MoEngagePluginInAppDelegateHandler(identifier: identifier) #if os(tvOS) MoEngageLogger.logDefault(message: "MoEngagePluginMessageDelegateHandler is unavailable for tvOS 🛑") #else _ = MoEngagePluginMessageDelegateHandler(identifier: identifier) - _ = MoEngagePluginAuthenticationListenerHandler(identifier: identifier) + // `MoEngageAuthenticationError.Listener` is `@MainActor` isolated in SDK 11, so the + // conforming handler must be instantiated on the main actor. + Task { @MainActor in + _ = MoEngagePluginAuthenticationListenerHandler(identifier: identifier) + } #endif MoEngagePluginBaseHandler.initializePluginBridge(className: MoEngagePluginConstants.ExternalPluginBase.cardsBridge) } diff --git a/Sources/MoEngagePluginBase/MoEngagePluginAuthenticationListenerHandler.swift b/Sources/MoEngagePluginBase/MoEngagePluginAuthenticationListenerHandler.swift index 47adfee..aa1b17f 100644 --- a/Sources/MoEngagePluginBase/MoEngagePluginAuthenticationListenerHandler.swift +++ b/Sources/MoEngagePluginBase/MoEngagePluginAuthenticationListenerHandler.swift @@ -8,6 +8,7 @@ import MoEngageSDK @available(iOSApplicationExtension, unavailable) +@MainActor final class MoEngagePluginAuthenticationListenerHandler: NSObject, MoEngageAuthenticationError.Listener { private let identifier: String diff --git a/Sources/MoEngagePluginBase/MoEngagePluginUtils.swift b/Sources/MoEngagePluginBase/MoEngagePluginUtils.swift index b186b3a..f212a55 100644 --- a/Sources/MoEngagePluginBase/MoEngagePluginUtils.swift +++ b/Sources/MoEngagePluginBase/MoEngagePluginUtils.swift @@ -105,26 +105,26 @@ public class MoEngagePluginUtils { if let dataPayload = payload[MoEngagePluginConstants.General.data] as? [String: Any], let position = dataPayload[MoEngagePluginConstants.InApp.position] as? String { switch position { case MoEngagePluginConstants.InApp.NudgePosition.top.rawValue: - return NudgePositionTop + return .top case MoEngagePluginConstants.InApp.NudgePosition.bottom.rawValue: - return NudgePositionBottom + return .bottom case MoEngagePluginConstants.InApp.NudgePosition.bottomLeft.rawValue: - return NudgePositionBottomLeft + return .bottomLeft case MoEngagePluginConstants.InApp.NudgePosition.bottomRight.rawValue: - return NudgePositionBottomRight + return .bottomRight default: - return NudgePositionAny + return .any } } - return NudgePositionNone + return .none } static func getInAppActionType(inappAction: MoEngageInAppAction) -> String? { var actionType: String? = nil - if inappAction.actionType == CustomAction { + if inappAction.actionType == .customAction { actionType = MoEngagePluginConstants.InApp.customAction - } else if inappAction.actionType == NavigationAction { + } else if inappAction.actionType == .navigationAction { actionType = MoEngagePluginConstants.General.navigation } diff --git a/package.json b/package.json index b536887..583d219 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "MoEngagePluginBase", "postBuild": "Utilities/post_build.rb", - "sdkVerMin": "10.14.0", + "sdkVerMin": "11.00.0", "packages": [ { "name": "MoEngagePluginBase",