Skip to content

Commit

Permalink
chore: update Android native dependencies to Data Pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Oct 29, 2024
1 parent 3225029 commit ec0dda8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
5 changes: 2 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rootProject.allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://maven.gist.build' }
}
}

Expand Down Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,8 +42,7 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {

private lateinit var modules: List<CustomerIOPluginModule>

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)
Expand Down Expand Up @@ -161,13 +155,18 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
}

private fun identify(params: Map<String, Any>) {
// TODO: Fix identify implementation
/*
val identifier = params.getString(Keys.Tracking.IDENTIFIER)
val attributes =
params.getProperty<Map<String, Any>>(Keys.Tracking.ATTRIBUTES) ?: emptyMap()
CustomerIO.instance().identify(identifier, attributes)
*/
}

private fun track(params: Map<String, Any>) {
// TODO: Fix track implementation
/*
val name = params.getString(Keys.Tracking.EVENT_NAME)
val attributes =
params.getProperty<Map<String, Any>>(Keys.Tracking.ATTRIBUTES) ?: emptyMap()
Expand All @@ -177,14 +176,20 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
} else {
CustomerIO.instance().track(name, attributes)
}
*/
}

private fun registerDeviceToken(params: Map<String, Any>) {
// TODO: Fix registerDeviceToken implementation
/*
val token = params.getString(Keys.Tracking.TOKEN)
CustomerIO.instance().registerDeviceToken(token)
*/
}

private fun trackMetric(params: Map<String, Any>) {
// TODO: Fix trackMetric implementation
/*
val deliveryId = params.getString(Keys.Tracking.DELIVERY_ID)
val deliveryToken = params.getString(Keys.Tracking.DELIVERY_TOKEN)
val eventName = params.getProperty<String>(Keys.Tracking.METRIC_EVENT)
Expand All @@ -198,21 +203,30 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
CustomerIO.instance().trackMetric(
deliveryID = deliveryId, deviceToken = deliveryToken, event = event
)
*/
}

private fun setDeviceAttributes(params: Map<String, Any>) {
// TODO: Fix setDeviceAttributes implementation
/*
val attributes = params.getProperty<Map<String, Any>>(Keys.Tracking.ATTRIBUTES) ?: return
CustomerIO.instance().deviceAttributes = attributes
*/
}

private fun setProfileAttributes(params: Map<String, Any>) {
// TODO: Fix setProfileAttributes implementation
/*
val attributes = params.getProperty<Map<String, Any>>(Keys.Tracking.ATTRIBUTES) ?: return
CustomerIO.instance().profileAttributes = attributes
*/
}

private fun screen(params: Map<String, Any>) {
// TODO: Fix screen implementation
/*
val name = params.getString(Keys.Tracking.EVENT_NAME)
val attributes =
params.getProperty<Map<String, Any>>(Keys.Tracking.ATTRIBUTES) ?: emptyMap()
Expand All @@ -222,9 +236,12 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
} else {
CustomerIO.instance().screen(name, attributes)
}
*/
}

private fun initialize(configData: Map<String, Any>) {
// 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)
Expand Down Expand Up @@ -272,10 +289,13 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
lifecycleCallbacks.postDelayedEventsForNonNativeActivity(activity)
}
}
*/
}

private fun configureModuleMessagingPushFCM(config: Map<String, Any?>?): ModuleMessagingPushFCM {
return ModuleMessagingPushFCM(
// TODO: Fix push module configuration
/*
config = MessagingPushModuleConfig.Builder().apply {
config?.getProperty<Boolean>(CustomerIOConfig.Companion.Keys.AUTO_TRACK_PUSH_EVENTS)
?.let { value ->
Expand All @@ -292,6 +312,7 @@ class CustomerIoPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
}
}
}.build(),
*/
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/amiapp_flutter/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit ec0dda8

Please sign in to comment.