From 581f039c7bc893f7a490ce49d25cb816bec7fb4b Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Date: Tue, 29 Oct 2024 14:45:00 +0500 Subject: [PATCH] chore: update iOS native dependencies to Data Pipelines (#153) --- .../NotificationService.swift | 6 ++-- apps/amiapp_flutter/ios/Podfile | 4 +-- .../ios/Runner.xcodeproj/project.pbxproj | 3 ++ .../ios/Runner/AppDelegate.swift | 8 ++--- ios/Classes/SwiftCustomerIoPlugin.swift | 29 +++++++++++++++++-- ios/customer_io.podspec | 4 +-- 6 files changed, 41 insertions(+), 13 deletions(-) diff --git a/apps/amiapp_flutter/ios/NotificationServiceExtension/NotificationService.swift b/apps/amiapp_flutter/ios/NotificationServiceExtension/NotificationService.swift index 40dcda7..fc7aaca 100644 --- a/apps/amiapp_flutter/ios/NotificationServiceExtension/NotificationService.swift +++ b/apps/amiapp_flutter/ios/NotificationServiceExtension/NotificationService.swift @@ -4,7 +4,6 @@ // import CioMessagingPushFCM -import CioTracking class NotificationService: UNNotificationServiceExtension { @@ -13,11 +12,14 @@ class NotificationService: UNNotificationServiceExtension { override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { print("NotificationService didReceive called") - + + // TODO: Fix SDK initialization + /* CustomerIO.initialize(siteId: Env.siteId, apiKey: Env.apiKey, region: .US) { config in config.autoTrackDeviceAttributes = true config.logLevel = .debug } + */ MessagingPush.shared.didReceive(request, withContentHandler: contentHandler) } diff --git a/apps/amiapp_flutter/ios/Podfile b/apps/amiapp_flutter/ios/Podfile index 1595e27..8412114 100644 --- a/apps/amiapp_flutter/ios/Podfile +++ b/apps/amiapp_flutter/ios/Podfile @@ -43,7 +43,7 @@ target 'Runner' do use_modular_headers! # Uncomment only 1 of the lines below to install a version of the iOS SDK - pod 'CustomerIO/MessagingPushFCM', '~> 2.14' # install production build + pod 'CustomerIO/MessagingPushFCM', '~> 3.5' # install production build # install_non_production_ios_sdk_local_path(local_path: '~/code/customerio-ios/', is_app_extension: false, push_service: "fcm") # install_non_production_ios_sdk_git_branch(branch_name: 'levi/v2-multiple-push-handlers', is_app_extension: false, push_service: "fcm") @@ -53,7 +53,7 @@ end target 'NotificationServiceExtension' do use_frameworks! # Uncomment only 1 of the lines below to install a version of the iOS SDK - pod 'CustomerIO/MessagingPushFCM', '~> 2.14' # install production build + pod 'CustomerIO/MessagingPushFCM', '~> 3.5' # install production build # install_non_production_ios_sdk_local_path(local_path: '~/code/customerio-ios/', is_app_extension: true, push_service: "fcm") # install_non_production_ios_sdk_git_branch(branch_name: 'levi/v2-multiple-push-handlers', is_app_extension: true, push_service: "fcm") end diff --git a/apps/amiapp_flutter/ios/Runner.xcodeproj/project.pbxproj b/apps/amiapp_flutter/ios/Runner.xcodeproj/project.pbxproj index dd67a68..18dfe0e 100644 --- a/apps/amiapp_flutter/ios/Runner.xcodeproj/project.pbxproj +++ b/apps/amiapp_flutter/ios/Runner.xcodeproj/project.pbxproj @@ -513,6 +513,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_STYLE = Manual; @@ -767,6 +768,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_STYLE = Manual; @@ -796,6 +798,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; diff --git a/apps/amiapp_flutter/ios/Runner/AppDelegate.swift b/apps/amiapp_flutter/ios/Runner/AppDelegate.swift index 71909e2..b3f6bfe 100644 --- a/apps/amiapp_flutter/ios/Runner/AppDelegate.swift +++ b/apps/amiapp_flutter/ios/Runner/AppDelegate.swift @@ -1,7 +1,6 @@ import UIKit import Flutter import CioMessagingPushFCM -import CioTracking import FirebaseMessaging import FirebaseCore @@ -21,11 +20,10 @@ import FirebaseCore Messaging.messaging().delegate = self - CustomerIO.initialize(siteId: Env.siteId, apiKey: Env.apiKey, region: .US) { config in - config.autoTrackDeviceAttributes = true - config.logLevel = .debug - } + // TODO: Fix MessagingPush initialization + /* MessagingPushFCM.initialize(configOptions: nil) + */ // Sets a 3rd party push event handler for the app besides the Customer.io SDK and FlutterFire. // Setting the AppDelegate to be the handler will internally use `flutter_local_notifications` to handle the push event. diff --git a/ios/Classes/SwiftCustomerIoPlugin.swift b/ios/Classes/SwiftCustomerIoPlugin.swift index 107a56d..dc98f14 100644 --- a/ios/Classes/SwiftCustomerIoPlugin.swift +++ b/ios/Classes/SwiftCustomerIoPlugin.swift @@ -1,6 +1,5 @@ import Flutter import UIKit -import CioTracking import CioInternalCommon import CioMessagingInApp @@ -68,6 +67,8 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { } private func identify(params : Dictionary){ + // TODO: Fix identify implementation + /* guard let identifier = params[Keys.Tracking.identifier] as? String else { return @@ -79,6 +80,7 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { } CustomerIO.shared.identify(identifier: identifier, body: attributes) + */ } private func clearIdentify() { @@ -86,6 +88,8 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { } private func track(params : Dictionary) { + // TODO: Fix track implementation + /* guard let name = params[Keys.Tracking.eventName] as? String else { return @@ -97,10 +101,13 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { } CustomerIO.shared.track(name: name, data: attributes) + */ } func screen(params : Dictionary) { + // TODO: Fix screen implementation + /* guard let name = params[Keys.Tracking.eventName] as? String else { return @@ -112,35 +119,47 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { } CustomerIO.shared.screen(name: name, data: attributes) + */ } private func setDeviceAttributes(params : Dictionary){ + // TODO: Fix setDeviceAttributes implementation + /* guard let attributes = params[Keys.Tracking.attributes] as? Dictionary else { return } CustomerIO.shared.deviceAttributes = attributes + */ } private func setProfileAttributes(params : Dictionary){ + // TODO: Fix setProfileAttributes implementation + /* guard let attributes = params[Keys.Tracking.attributes] as? Dictionary else { return } CustomerIO.shared.profileAttributes = attributes + */ } private func registerDeviceToken(params : Dictionary){ + // TODO: Fix registerDeviceToken implementation + /* guard let token = params[Keys.Tracking.token] as? String else { return } CustomerIO.shared.registerDeviceToken(token) + */ } private func trackMetric(params : Dictionary){ + // TODO: Fix trackMetric implementation + /* guard let deliveryId = params[Keys.Tracking.deliveryId] as? String, let deviceToken = params[Keys.Tracking.deliveryToken] as? String, let metricEvent = params[Keys.Tracking.metricEvent] as? String, @@ -152,9 +171,12 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { CustomerIO.shared.trackMetric(deliveryID: deliveryId, event: event, deviceToken: deviceToken) + */ } private func initialize(params : Dictionary){ + // TODO: Fix initialize implementation + /* guard let siteId = params[Keys.Environment.siteId] as? String, let apiKey = params[Keys.Environment.apiKey] as? String, let regionStr = params[Keys.Environment.region] as? String @@ -175,13 +197,15 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { initializeInApp() } } - + */ } /** Initialize in-app using customerio plugin */ private func initializeInApp(){ + // TODO: Fix initializeInApp implementation + /* DispatchQueue.main.async { MessagingInApp.shared.initialize(eventListener: CustomerIOInAppEventListener( invokeMethod: {method,args in @@ -189,6 +213,7 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin { }) ) } + */ } func invokeMethod(_ method: String, _ args: Any?) { diff --git a/ios/customer_io.podspec b/ios/customer_io.podspec index fff69ec..735d515 100755 --- a/ios/customer_io.podspec +++ b/ios/customer_io.podspec @@ -17,8 +17,8 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'Flutter' s.platform = :ios, '13.0' - s.dependency "CustomerIO/Tracking", '~> 2' - s.dependency "CustomerIO/MessagingInApp", '~> 2' + s.dependency "CustomerIO/DataPipelines", '~> 3' + s.dependency "CustomerIO/MessagingInApp", '~> 3' # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }