From ec0dda8050b50cd9dc4eab615281cb1fe808baf5 Mon Sep 17 00:00:00 2001 From: Rehan Date: Tue, 29 Oct 2024 11:40:29 +0500 Subject: [PATCH] chore: update Android native dependencies to Data Pipelines --- android/build.gradle | 5 +-- .../customer/customer_io/CustomerIoPlugin.kt | 39 ++++++++++++++----- .../messagingpush/CustomerIOPushMessaging.kt | 10 ++--- apps/amiapp_flutter/android/app/build.gradle | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 3f52931..c8691f1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -18,7 +18,6 @@ rootProject.allprojects { repositories { google() mavenCentral() - maven { url 'https://maven.gist.build' } } } @@ -59,8 +58,8 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // Customer.io SDK - def cioVersion = "3.11.2" - implementation "io.customer.android:tracking:$cioVersion" + def cioVersion = "4.3.0" + implementation "io.customer.android:datapipelines:$cioVersion" implementation "io.customer.android:messaging-push-fcm:$cioVersion" implementation "io.customer.android:messaging-in-app:$cioVersion" } diff --git a/android/src/main/kotlin/io/customer/customer_io/CustomerIoPlugin.kt b/android/src/main/kotlin/io/customer/customer_io/CustomerIoPlugin.kt index 9d2f950..10a139c 100644 --- a/android/src/main/kotlin/io/customer/customer_io/CustomerIoPlugin.kt +++ b/android/src/main/kotlin/io/customer/customer_io/CustomerIoPlugin.kt @@ -15,14 +15,9 @@ import io.customer.messagingpush.MessagingPushModuleConfig import io.customer.messagingpush.ModuleMessagingPushFCM import io.customer.messagingpush.config.PushClickBehavior import io.customer.sdk.CustomerIO -import io.customer.sdk.CustomerIOConfig -import io.customer.sdk.CustomerIOShared +import io.customer.sdk.core.di.SDKComponent +import io.customer.sdk.core.util.Logger import io.customer.sdk.data.model.Region -import io.customer.sdk.data.request.MetricEvent -import io.customer.sdk.extensions.getProperty -import io.customer.sdk.extensions.getString -import io.customer.sdk.extensions.takeIfNotBlank -import io.customer.sdk.util.Logger import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding @@ -47,8 +42,7 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { private lateinit var modules: List - private val logger: Logger - get() = CustomerIOShared.instance().diStaticGraph.logger + private val logger: Logger = SDKComponent.logger override fun onAttachedToActivity(binding: ActivityPluginBinding) { this.activity = WeakReference(binding.activity) @@ -161,13 +155,18 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { } private fun identify(params: Map) { + // TODO: Fix identify implementation + /* val identifier = params.getString(Keys.Tracking.IDENTIFIER) val attributes = params.getProperty>(Keys.Tracking.ATTRIBUTES) ?: emptyMap() CustomerIO.instance().identify(identifier, attributes) + */ } private fun track(params: Map) { + // TODO: Fix track implementation + /* val name = params.getString(Keys.Tracking.EVENT_NAME) val attributes = params.getProperty>(Keys.Tracking.ATTRIBUTES) ?: emptyMap() @@ -177,14 +176,20 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { } else { CustomerIO.instance().track(name, attributes) } + */ } private fun registerDeviceToken(params: Map) { + // TODO: Fix registerDeviceToken implementation + /* val token = params.getString(Keys.Tracking.TOKEN) CustomerIO.instance().registerDeviceToken(token) + */ } private fun trackMetric(params: Map) { + // TODO: Fix trackMetric implementation + /* val deliveryId = params.getString(Keys.Tracking.DELIVERY_ID) val deliveryToken = params.getString(Keys.Tracking.DELIVERY_TOKEN) val eventName = params.getProperty(Keys.Tracking.METRIC_EVENT) @@ -198,21 +203,30 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { CustomerIO.instance().trackMetric( deliveryID = deliveryId, deviceToken = deliveryToken, event = event ) + */ } private fun setDeviceAttributes(params: Map) { + // TODO: Fix setDeviceAttributes implementation + /* val attributes = params.getProperty>(Keys.Tracking.ATTRIBUTES) ?: return CustomerIO.instance().deviceAttributes = attributes + */ } private fun setProfileAttributes(params: Map) { + // TODO: Fix setProfileAttributes implementation + /* val attributes = params.getProperty>(Keys.Tracking.ATTRIBUTES) ?: return CustomerIO.instance().profileAttributes = attributes + */ } private fun screen(params: Map) { + // TODO: Fix screen implementation + /* val name = params.getString(Keys.Tracking.EVENT_NAME) val attributes = params.getProperty>(Keys.Tracking.ATTRIBUTES) ?: emptyMap() @@ -222,9 +236,12 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { } else { CustomerIO.instance().screen(name, attributes) } + */ } private fun initialize(configData: Map) { + // TODO: Fix initialize implementation + /* val application: Application = context.applicationContext as Application val siteId = configData.getString(Keys.Environment.SITE_ID) val apiKey = configData.getString(Keys.Environment.API_KEY) @@ -272,10 +289,13 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { lifecycleCallbacks.postDelayedEventsForNonNativeActivity(activity) } } + */ } private fun configureModuleMessagingPushFCM(config: Map?): ModuleMessagingPushFCM { return ModuleMessagingPushFCM( + // TODO: Fix push module configuration + /* config = MessagingPushModuleConfig.Builder().apply { config?.getProperty(CustomerIOConfig.Companion.Keys.AUTO_TRACK_PUSH_EVENTS) ?.let { value -> @@ -292,6 +312,7 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { } } }.build(), + */ ) } diff --git a/android/src/main/kotlin/io/customer/customer_io/messagingpush/CustomerIOPushMessaging.kt b/android/src/main/kotlin/io/customer/customer_io/messagingpush/CustomerIOPushMessaging.kt index e32618b..26a0435 100644 --- a/android/src/main/kotlin/io/customer/customer_io/messagingpush/CustomerIOPushMessaging.kt +++ b/android/src/main/kotlin/io/customer/customer_io/messagingpush/CustomerIOPushMessaging.kt @@ -6,9 +6,8 @@ import io.customer.customer_io.constant.Keys import io.customer.customer_io.getAsTypeOrNull import io.customer.customer_io.invokeNative import io.customer.messagingpush.CustomerIOFirebaseMessagingService -import io.customer.sdk.CustomerIOShared -import io.customer.sdk.extensions.takeIfNotBlank -import io.customer.sdk.util.Logger +import io.customer.sdk.core.di.SDKComponent +import io.customer.sdk.core.util.Logger import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel @@ -25,8 +24,7 @@ internal class CustomerIOPushMessaging( private val applicationContext: Context = pluginBinding.applicationContext override val flutterCommunicationChannel: MethodChannel = MethodChannel(pluginBinding.binaryMessenger, "customer_io_messaging_push") - private val logger: Logger - get() = CustomerIOShared.instance().diStaticGraph.logger + private val logger: Logger = SDKComponent.logger override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { when (call.method) { @@ -62,7 +60,7 @@ internal class CustomerIOPushMessaging( } // Generate destination string, see docs on receiver method for more details - val destination = (message["to"] as? String)?.takeIfNotBlank() + val destination = (message["to"] as? String)?.takeIf { it.isNotBlank() } ?: UUID.randomUUID().toString() return CustomerIOFirebaseMessagingService.onMessageReceived( context = applicationContext, diff --git a/apps/amiapp_flutter/android/app/build.gradle b/apps/amiapp_flutter/android/app/build.gradle index 0ec6c3b..3c5fecd 100644 --- a/apps/amiapp_flutter/android/app/build.gradle +++ b/apps/amiapp_flutter/android/app/build.gradle @@ -79,7 +79,7 @@ dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2' // Adding customer.io android sdk dependencies so we can use them in native code // These are not generally needed and should be avoided - implementation "io.customer.android:tracking" + implementation "io.customer.android:datapipelines" implementation "io.customer.android:messaging-push-fcm" implementation "io.customer.android:messaging-in-app" }