Skip to content

Commit

Permalink
chore: update iOS native dependencies to Data Pipelines (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 authored Oct 29, 2024
1 parent a783266 commit 581f039
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import CioMessagingPushFCM
import CioTracking

class NotificationService: UNNotificationServiceExtension {

Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions apps/amiapp_flutter/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions apps/amiapp_flutter/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
8 changes: 3 additions & 5 deletions apps/amiapp_flutter/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import UIKit
import Flutter
import CioMessagingPushFCM
import CioTracking
import FirebaseMessaging
import FirebaseCore

Expand All @@ -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.
Expand Down
29 changes: 27 additions & 2 deletions ios/Classes/SwiftCustomerIoPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Flutter
import UIKit
import CioTracking
import CioInternalCommon
import CioMessagingInApp

Expand Down Expand Up @@ -68,6 +67,8 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
}

private func identify(params : Dictionary<String, AnyHashable>){
// TODO: Fix identify implementation
/*
guard let identifier = params[Keys.Tracking.identifier] as? String
else {
return
Expand All @@ -79,13 +80,16 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
}

CustomerIO.shared.identify(identifier: identifier, body: attributes)
*/
}

private func clearIdentify() {
CustomerIO.shared.clearIdentify()
}

private func track(params : Dictionary<String, AnyHashable>) {
// TODO: Fix track implementation
/*
guard let name = params[Keys.Tracking.eventName] as? String
else {
return
Expand All @@ -97,10 +101,13 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
}

CustomerIO.shared.track(name: name, data: attributes)
*/

}

func screen(params : Dictionary<String, AnyHashable>) {
// TODO: Fix screen implementation
/*
guard let name = params[Keys.Tracking.eventName] as? String
else {
return
Expand All @@ -112,35 +119,47 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
}

CustomerIO.shared.screen(name: name, data: attributes)
*/
}


private func setDeviceAttributes(params : Dictionary<String, AnyHashable>){
// TODO: Fix setDeviceAttributes implementation
/*
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable>
else {
return
}
CustomerIO.shared.deviceAttributes = attributes
*/
}

private func setProfileAttributes(params : Dictionary<String, AnyHashable>){
// TODO: Fix setProfileAttributes implementation
/*
guard let attributes = params[Keys.Tracking.attributes] as? Dictionary<String, AnyHashable>
else {
return
}
CustomerIO.shared.profileAttributes = attributes
*/
}

private func registerDeviceToken(params : Dictionary<String, AnyHashable>){
// TODO: Fix registerDeviceToken implementation
/*
guard let token = params[Keys.Tracking.token] as? String
else {
return
}

CustomerIO.shared.registerDeviceToken(token)
*/
}

private func trackMetric(params : Dictionary<String, AnyHashable>){
// 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,
Expand All @@ -152,9 +171,12 @@ public class SwiftCustomerIoPlugin: NSObject, FlutterPlugin {
CustomerIO.shared.trackMetric(deliveryID: deliveryId,
event: event,
deviceToken: deviceToken)
*/
}

private func initialize(params : Dictionary<String, AnyHashable>){
// 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
Expand All @@ -175,20 +197,23 @@ 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
self.invokeMethod(method, args)
})
)
}
*/
}

func invokeMethod(_ method: String, _ args: Any?) {
Expand Down
4 changes: 2 additions & 2 deletions ios/customer_io.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down

0 comments on commit 581f039

Please sign in to comment.