Skip to content

Commit

Permalink
added native support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Sep 26, 2023
1 parent 1c109e0 commit 5cdcf61
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ customerio.reactnative.kotlinVersion=1.7.21
customerio.reactnative.compileSdkVersion=30
customerio.reactnative.targetSdkVersion=30
customerio.reactnative.minSdkVersion=21
customerio.reactnative.cioSDKVersionAndroid=3.6.5
customerio.reactnative.cioSDKVersionAndroid=rehan-push-click-behavior-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import io.customer.messaginginapp.ModuleMessagingInApp
import io.customer.messaginginapp.type.InAppEventListener
import io.customer.messagingpush.MessagingPushModuleConfig
import io.customer.messagingpush.ModuleMessagingPushFCM
import io.customer.messagingpush.config.NotificationClickBehavior
import io.customer.reactnative.sdk.constant.Keys
import io.customer.reactnative.sdk.extension.*
import io.customer.sdk.CustomerIO
Expand Down Expand Up @@ -64,6 +65,7 @@ object CustomerIOReactNativeInstance {
sourceSDK?.equals(
other = "expo", ignoreCase = true,
) == true -> Client.Expo(sdkVersion = sourceSDKVersion)

else -> Client.ReactNative(sdkVersion = sourceSDKVersion)
}
}
Expand Down Expand Up @@ -94,6 +96,16 @@ object CustomerIOReactNativeInstance {
config?.getProperty<Boolean>(Keys.Config.AUTO_TRACK_PUSH_EVENTS)?.let { value ->
setAutoTrackPushEvents(autoTrackPushEvents = value)
}
config?.getProperty<String>(Keys.Config.PUSH_CLICK_BEHAVIOR)
?.takeIfNotBlank()
?.let { value ->
val behavior = kotlin.runCatching {
enumValueOf<NotificationClickBehavior>(value)
}.getOrNull()
if (behavior != null) {
setNotificationClickBehavior(notificationOnClickBehavior = behavior)
}
}
}.build(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal object Keys {
const val AUTO_TRACK_PUSH_EVENTS = "autoTrackPushEvents"
const val BACKGROUND_QUEUE_MIN_NUMBER_OF_TASKS = "backgroundQueueMinNumberOfTasks"
const val BACKGROUND_QUEUE_SECONDS_DELAY = "backgroundQueueSecondsDelay"
const val PUSH_CLICK_BEHAVIOR = "androidPushClickBehavior"
}

object PackageConfig {
Expand Down
2 changes: 1 addition & 1 deletion src/CustomerioConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ class PackageConfig {
source: string = '';
}

export { CustomerioConfig, CustomerIOEnv, PackageConfig };
export { CustomerIOEnv, CustomerioConfig, PackageConfig };

0 comments on commit 5cdcf61

Please sign in to comment.