From 2d0182d262794d45f4c543aa735a99e5714b2172 Mon Sep 17 00:00:00 2001 From: Rehan Date: Tue, 26 Sep 2023 13:08:36 +0500 Subject: [PATCH 1/6] fix: added AndroidNotificationClickBehavior enum --- src/types/AndroidNotificationClickBehavior.tsx | 5 +++++ src/types/index.tsx | 1 + 2 files changed, 6 insertions(+) create mode 100644 src/types/AndroidNotificationClickBehavior.tsx diff --git a/src/types/AndroidNotificationClickBehavior.tsx b/src/types/AndroidNotificationClickBehavior.tsx new file mode 100644 index 00000000..ef34085a --- /dev/null +++ b/src/types/AndroidNotificationClickBehavior.tsx @@ -0,0 +1,5 @@ +export enum AndroidNotificationClickBehavior { + ResetTaskStack = 'RESET_TASK_STACK', + ActivityPreventRestart = 'ACTIVITY_PREVENT_RESTART', + ActivityNoFlags = 'ACTIVITY_NO_FLAGS', +} diff --git a/src/types/index.tsx b/src/types/index.tsx index 7d557d9f..6e7bb3d9 100644 --- a/src/types/index.tsx +++ b/src/types/index.tsx @@ -1,2 +1,3 @@ +export * from './AndroidNotificationClickBehavior'; export * from './PushPermissionOptions'; export * from './PushPermissionStatus'; From 847deca2eb294edc62cc1aefbdba7cee075e98cd Mon Sep 17 00:00:00 2001 From: Rehan Date: Tue, 26 Sep 2023 13:09:42 +0500 Subject: [PATCH 2/6] updated config --- src/CustomerioConfig.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CustomerioConfig.tsx b/src/CustomerioConfig.tsx index 812ae06c..f2ed4c99 100644 --- a/src/CustomerioConfig.tsx +++ b/src/CustomerioConfig.tsx @@ -1,4 +1,5 @@ import { CioLogLevel, Region } from './CustomerioEnum'; +import { AndroidNotificationClickBehavior } from './types'; /** * Configure package using CustomerioConfig @@ -18,6 +19,8 @@ class CustomerioConfig { autoTrackPushEvents: boolean = true; backgroundQueueMinNumberOfTasks: number = 10; backgroundQueueSecondsDelay: number = 30; + androidNotificationClickBehavior: AndroidNotificationClickBehavior = + AndroidNotificationClickBehavior.ActivityPreventRestart; } class CustomerIOEnv { From 1c109e0019919d112b02dc826e221bdf5f8bbceb Mon Sep 17 00:00:00 2001 From: Rehan Date: Tue, 26 Sep 2023 13:13:40 +0500 Subject: [PATCH 3/6] renamed to AndroidPushClickBehavior --- src/CustomerioConfig.tsx | 6 +++--- ...cationClickBehavior.tsx => AndroidPushClickBehavior.tsx} | 2 +- src/types/index.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/types/{AndroidNotificationClickBehavior.tsx => AndroidPushClickBehavior.tsx} (74%) diff --git a/src/CustomerioConfig.tsx b/src/CustomerioConfig.tsx index f2ed4c99..420fb582 100644 --- a/src/CustomerioConfig.tsx +++ b/src/CustomerioConfig.tsx @@ -1,5 +1,5 @@ import { CioLogLevel, Region } from './CustomerioEnum'; -import { AndroidNotificationClickBehavior } from './types'; +import { AndroidPushClickBehavior } from './types'; /** * Configure package using CustomerioConfig @@ -19,8 +19,8 @@ class CustomerioConfig { autoTrackPushEvents: boolean = true; backgroundQueueMinNumberOfTasks: number = 10; backgroundQueueSecondsDelay: number = 30; - androidNotificationClickBehavior: AndroidNotificationClickBehavior = - AndroidNotificationClickBehavior.ActivityPreventRestart; + androidPushClickBehavior: AndroidPushClickBehavior = + AndroidPushClickBehavior.ActivityPreventRestart; } class CustomerIOEnv { diff --git a/src/types/AndroidNotificationClickBehavior.tsx b/src/types/AndroidPushClickBehavior.tsx similarity index 74% rename from src/types/AndroidNotificationClickBehavior.tsx rename to src/types/AndroidPushClickBehavior.tsx index ef34085a..791ad451 100644 --- a/src/types/AndroidNotificationClickBehavior.tsx +++ b/src/types/AndroidPushClickBehavior.tsx @@ -1,4 +1,4 @@ -export enum AndroidNotificationClickBehavior { +export enum AndroidPushClickBehavior { ResetTaskStack = 'RESET_TASK_STACK', ActivityPreventRestart = 'ACTIVITY_PREVENT_RESTART', ActivityNoFlags = 'ACTIVITY_NO_FLAGS', diff --git a/src/types/index.tsx b/src/types/index.tsx index 6e7bb3d9..a8c14ee0 100644 --- a/src/types/index.tsx +++ b/src/types/index.tsx @@ -1,3 +1,3 @@ -export * from './AndroidNotificationClickBehavior'; +export * from './AndroidPushClickBehavior'; export * from './PushPermissionOptions'; export * from './PushPermissionStatus'; From 5cdcf617a17b9762b263da834dca4faf6cf711e8 Mon Sep 17 00:00:00 2001 From: Rehan Date: Tue, 26 Sep 2023 14:39:13 +0500 Subject: [PATCH 4/6] added native support --- android/gradle.properties | 2 +- .../reactnative/sdk/CustomerIOReactNativeInstance.kt | 12 ++++++++++++ .../io/customer/reactnative/sdk/constant/Keys.kt | 1 + src/CustomerioConfig.tsx | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/android/gradle.properties b/android/gradle.properties index ea94999e..12593945 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -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 \ No newline at end of file +customerio.reactnative.cioSDKVersionAndroid=rehan-push-click-behavior-SNAPSHOT \ No newline at end of file diff --git a/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt b/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt index d77dde9f..9f51967d 100644 --- a/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt +++ b/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt @@ -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 @@ -64,6 +65,7 @@ object CustomerIOReactNativeInstance { sourceSDK?.equals( other = "expo", ignoreCase = true, ) == true -> Client.Expo(sdkVersion = sourceSDKVersion) + else -> Client.ReactNative(sdkVersion = sourceSDKVersion) } } @@ -94,6 +96,16 @@ object CustomerIOReactNativeInstance { config?.getProperty(Keys.Config.AUTO_TRACK_PUSH_EVENTS)?.let { value -> setAutoTrackPushEvents(autoTrackPushEvents = value) } + config?.getProperty(Keys.Config.PUSH_CLICK_BEHAVIOR) + ?.takeIfNotBlank() + ?.let { value -> + val behavior = kotlin.runCatching { + enumValueOf(value) + }.getOrNull() + if (behavior != null) { + setNotificationClickBehavior(notificationOnClickBehavior = behavior) + } + } }.build(), ) } diff --git a/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt b/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt index b229bae6..f7e38b31 100644 --- a/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt +++ b/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt @@ -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 { diff --git a/src/CustomerioConfig.tsx b/src/CustomerioConfig.tsx index 420fb582..8e139ae7 100644 --- a/src/CustomerioConfig.tsx +++ b/src/CustomerioConfig.tsx @@ -41,4 +41,4 @@ class PackageConfig { source: string = ''; } -export { CustomerioConfig, CustomerIOEnv, PackageConfig }; +export { CustomerIOEnv, CustomerioConfig, PackageConfig }; From 15c75339f47c9cb7de9aace45a5e4e3b88b42799 Mon Sep 17 00:00:00 2001 From: Rehan Date: Thu, 28 Sep 2023 14:18:07 +0500 Subject: [PATCH 5/6] rename fixes --- .../reactnative/sdk/CustomerIOReactNativeInstance.kt | 6 +++--- .../main/java/io/customer/reactnative/sdk/constant/Keys.kt | 2 +- src/CustomerioConfig.tsx | 6 +++--- ...idPushClickBehavior.tsx => PushClickBehaviorAndroid.tsx} | 2 +- src/types/index.tsx | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) rename src/types/{AndroidPushClickBehavior.tsx => PushClickBehaviorAndroid.tsx} (77%) diff --git a/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt b/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt index 9f51967d..451e4bfc 100644 --- a/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt +++ b/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativeInstance.kt @@ -7,7 +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.messagingpush.config.PushClickBehavior import io.customer.reactnative.sdk.constant.Keys import io.customer.reactnative.sdk.extension.* import io.customer.sdk.CustomerIO @@ -100,10 +100,10 @@ object CustomerIOReactNativeInstance { ?.takeIfNotBlank() ?.let { value -> val behavior = kotlin.runCatching { - enumValueOf(value) + enumValueOf(value) }.getOrNull() if (behavior != null) { - setNotificationClickBehavior(notificationOnClickBehavior = behavior) + setPushClickBehavior(pushClickBehavior = behavior) } } }.build(), diff --git a/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt b/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt index f7e38b31..fe9850e4 100644 --- a/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt +++ b/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt @@ -15,7 +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" + const val PUSH_CLICK_BEHAVIOR = "pushClickBehaviorAndroid" } object PackageConfig { diff --git a/src/CustomerioConfig.tsx b/src/CustomerioConfig.tsx index 8e139ae7..8d444a33 100644 --- a/src/CustomerioConfig.tsx +++ b/src/CustomerioConfig.tsx @@ -1,5 +1,5 @@ import { CioLogLevel, Region } from './CustomerioEnum'; -import { AndroidPushClickBehavior } from './types'; +import { PushClickBehaviorAndroid } from './types'; /** * Configure package using CustomerioConfig @@ -19,8 +19,8 @@ class CustomerioConfig { autoTrackPushEvents: boolean = true; backgroundQueueMinNumberOfTasks: number = 10; backgroundQueueSecondsDelay: number = 30; - androidPushClickBehavior: AndroidPushClickBehavior = - AndroidPushClickBehavior.ActivityPreventRestart; + pushClickBehaviorAndroid: PushClickBehaviorAndroid = + PushClickBehaviorAndroid.ActivityPreventRestart; } class CustomerIOEnv { diff --git a/src/types/AndroidPushClickBehavior.tsx b/src/types/PushClickBehaviorAndroid.tsx similarity index 77% rename from src/types/AndroidPushClickBehavior.tsx rename to src/types/PushClickBehaviorAndroid.tsx index 791ad451..24dd7615 100644 --- a/src/types/AndroidPushClickBehavior.tsx +++ b/src/types/PushClickBehaviorAndroid.tsx @@ -1,4 +1,4 @@ -export enum AndroidPushClickBehavior { +export enum PushClickBehaviorAndroid { ResetTaskStack = 'RESET_TASK_STACK', ActivityPreventRestart = 'ACTIVITY_PREVENT_RESTART', ActivityNoFlags = 'ACTIVITY_NO_FLAGS', diff --git a/src/types/index.tsx b/src/types/index.tsx index a8c14ee0..bbe796e5 100644 --- a/src/types/index.tsx +++ b/src/types/index.tsx @@ -1,3 +1,3 @@ -export * from './AndroidPushClickBehavior'; +export * from './PushClickBehaviorAndroid'; export * from './PushPermissionOptions'; export * from './PushPermissionStatus'; From 99f74f9916db568ac9440c825949200fc3270fd0 Mon Sep 17 00:00:00 2001 From: Rehan Date: Tue, 14 Nov 2023 14:58:08 +0500 Subject: [PATCH 6/6] updated android sdk version --- android/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/gradle.properties b/android/gradle.properties index baecae22..cf081608 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -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.7.0 +customerio.reactnative.cioSDKVersionAndroid=3.8.0