Skip to content

Commit

Permalink
Merge pull request #736 from CleverTap/task/SDK-4303/notification_cli…
Browse files Browse the repository at this point in the history
…cked_not_raised

task(SDK-4303) - Fixes notification clicked event not getting raised
  • Loading branch information
CTLalit authored Jan 21, 2025
2 parents 35a13ed + 16d23e4 commit 3aa7fc3
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 31 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## CHANGE LOG.

### January 21, 2025
* [CleverTap Android SDK v7.2.2](docs/CTCORECHANGELOG.md)

### January 16, 2025
* [CleverTap Android SDK v7.2.1](docs/CTCORECHANGELOG.md)

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ We publish the SDK to `mavenCentral` as an `AAR` file. Just declare it as depend

```groovy
dependencies {
implementation "com.clevertap.android:clevertap-android-sdk:7.2.1"
implementation "com.clevertap.android:clevertap-android-sdk:7.2.2"
}
```

Alternatively, you can download and add the AAR file included in this repo in your Module libs directory and tell gradle to install it like this:

```groovy
dependencies {
implementation (name: "clevertap-android-sdk-7.2.1", ext: 'aar')
implementation (name: "clevertap-android-sdk-7.2.2", ext: 'aar')
}
```

Expand All @@ -46,7 +46,7 @@ Add the Firebase Messaging library and Android Support Library v4 as dependencie

```groovy
dependencies {
implementation "com.clevertap.android:clevertap-android-sdk:7.2.1"
implementation "com.clevertap.android:clevertap-android-sdk:7.2.2"
implementation "androidx.core:core:1.13.0"
implementation "com.google.firebase:firebase-messaging:24.0.0"
implementation "com.google.android.gms:play-services-ads:23.6.0" // Required only if you enable Google ADID collection in the SDK (turned off by default).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import org.json.JSONException;
import org.json.JSONObject;

import kotlin.jvm.functions.Function0;

public class AnalyticsManager extends BaseAnalyticsManager {

private final CTLockManager ctLockManager;
Expand Down Expand Up @@ -496,14 +494,14 @@ public void pushNotificationClickedEvent(final Bundle extras) {
);
if (isDuplicate) {
config.getLogger().debug(config.getAccountId(),
"Already processed Notification Clicked event for " + extras.toString()
"Already processed Notification Clicked event for " + extras
+ ", dropping duplicate.");
return;
}

try {
// convert bundle to json
JSONObject event = AnalyticsManagerBundler.notificationViewedJson(extras);
JSONObject event = AnalyticsManagerBundler.notificationClickedJson(extras);

baseEventQueueManager.queueEvent(context, event, Constants.RAISED_EVENT);
coreMetaData.setWzrkParams(AnalyticsManagerBundler.wzrkBundleToJson(extras));
Expand Down Expand Up @@ -1075,7 +1073,7 @@ private void _push(Map<String, Object> profile) {
}

config.getLogger()
.verbose(config.getAccountId(), "Constructed custom profile: " + customProfile.toString());
.verbose(config.getAccountId(), "Constructed custom profile: " + customProfile);

baseEventQueueManager.pushBasicProfile(customProfile, false);

Expand Down Expand Up @@ -1142,7 +1140,7 @@ private void _pushMultiValue(ArrayList<String> originalValues, String key, Strin
baseEventQueueManager.pushBasicProfile(fields, false);

config.getLogger()
.verbose(config.getAccountId(), "Constructed multi-value profile push: " + fields.toString());
.verbose(config.getAccountId(), "Constructed multi-value profile push: " + fields);

} catch (Throwable t) {
config.getLogger().verbose(config.getAccountId(), "Error pushing multiValue for key " + key, t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,17 @@ object AnalyticsManagerBundler {
}
return event
}

@JvmStatic
fun notificationClickedJson(root: Bundle): JSONObject {
val event = JSONObject()
try {
val notif = wzrkBundleToJson(root)
event.put("evtName", Constants.NOTIFICATION_CLICKED_EVENT_NAME)
event.put("evtData", notif)
} catch (ignored: Throwable) {
//no-op
}
return event
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.clevertap.android.sdk

import android.content.Context
import android.os.Bundle
import com.clevertap.android.sdk.AnalyticsManagerBundler.notificationClickedJson
import com.clevertap.android.sdk.AnalyticsManagerBundler.notificationViewedJson
import com.clevertap.android.sdk.events.BaseEventQueueManager
import com.clevertap.android.sdk.response.InAppResponse
Expand Down Expand Up @@ -173,7 +174,7 @@ class AnalyticsManagerTest {
@Test
fun `clevertap processes PN viewed for same wzrk_id if separated by a span of greater than 2 seconds`() {

val json = notificationViewedJson(bundleIdCheck);
val json = notificationViewedJson(bundleIdCheck)

every { timeProvider.currentTimeMillis() } returns 10000

Expand Down Expand Up @@ -225,7 +226,7 @@ class AnalyticsManagerTest {
@Test
fun `clevertap does not process duplicate (same wzrk_id) PN clicked within 2 seconds - case 2nd click happens in 200ms`() {

val json = notificationViewedJson(bundleIdCheck)
val json = notificationClickedJson(bundleIdCheck)
every { timeProvider.currentTimeMillis() } returns 0

// send PN first time
Expand Down Expand Up @@ -263,7 +264,7 @@ class AnalyticsManagerTest {
@Test
fun `clevertap processes PN clicked for same wzrk_id if separated by a span of greater than 5 seconds`() {

val json = notificationViewedJson(bundleIdCheck);
val json = notificationClickedJson(bundleIdCheck)
every { timeProvider.currentTimeMillis() } returns 10000

// send PN first time
Expand Down Expand Up @@ -354,8 +355,7 @@ class AnalyticsManagerTest {
putString("wzrk_pid", "same_pid")
}

val json1 = notificationViewedJson(notif1)
val json2 = notificationViewedJson(notif1)
val json1 = notificationClickedJson(notif1)

every { timeProvider.currentTimeMillis() } returns 0

Expand Down
15 changes: 13 additions & 2 deletions docs/CTCORECHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
## CleverTap Android SDK CHANGE LOG

### Version 7.2.2 (January 21, 2025)

This hotfix release addresses a critical issue from `v7.1.0` onwards:

#### Bug Fixes
* Fixes an issue where `Notification Clicked` event was not being raised.


### Version 7.2.1 (January 16, 2025)
This hotfix release addresses the following issue in `v7.2.0`:
> ‼️ **NOTE**
A critical issue was identified in 7.2.1, please update to 7.2.2 and above

#### Bug Fixes
* Fixes `ClassCastException` from `Integer` to `Long` for server side in-apps delivery. A bug occurs when the network is turned off, and the following steps are performed:
Expand All @@ -11,7 +20,7 @@ This hotfix release addresses the following issue in `v7.2.0`:

### Version 7.2.0 (January 7, 2025)
> ‼️ **NOTE**
If you are using server side in-apps please use `7.2.1` instead. `7.2.0` has a bug related to server side in-apps.
A critical issue was identified in 7.2.0, please update to 7.2.2 and above

#### New Features

Expand All @@ -23,6 +32,8 @@ If you are using server side in-apps please use `7.2.1` instead. `7.2.0` has a b
After upgrading the SDK to v7.2.0, don't downgrade in subsequent app releases. If you encounter any issues, please contact the CleverTap support team for assistance.

### Version 7.1.0 (December 24, 2024)
> ‼️ **NOTE**
A critical issue was identified in 7.1.0, please update to 7.2.2 and above

#### New Features

Expand Down
2 changes: 1 addition & 1 deletion docs/CTGEOFENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add the following dependencies to the `build.gradle`

```Groovy
implementation "com.clevertap.android:clevertap-geofence-sdk:1.4.0"
implementation "com.clevertap.android:clevertap-android-sdk:7.2.1" // 3.9.0 and above
implementation "com.clevertap.android:clevertap-android-sdk:7.2.2" // 3.9.0 and above
implementation "com.google.android.gms:play-services-location:21.3.0"
implementation "androidx.work:work-runtime:2.9.1" // required for FETCH_LAST_LOCATION_PERIODIC
implementation "androidx.concurrent:concurrent-futures:1.2.0" // required for FETCH_LAST_LOCATION_PERIODIC
Expand Down
2 changes: 1 addition & 1 deletion docs/CTPUSHTEMPLATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CleverTap Push Templates SDK helps you engage with your users using fancy push n

```groovy
implementation "com.clevertap.android:push-templates:1.3.0"
implementation "com.clevertap.android:clevertap-android-sdk:7.2.1" // 4.4.0 and above
implementation "com.clevertap.android:clevertap-android-sdk:7.2.2" // 4.4.0 and above
```

2. Add the following line to your Application class before the `onCreate()`
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ coroutines_test = "1.7.3"
installreferrer = "2.2"

#SDK Versions
clevertap_android_sdk = "7.2.1"
clevertap_android_sdk = "7.2.2"
clevertap_rendermax_sdk = "1.0.3"
clevertap_geofence_sdk = "1.4.0"
clevertap_hms_sdk = "1.4.0"
Expand Down
20 changes: 10 additions & 10 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId "com.clevertap.demo"
minSdkVersion 21
targetSdkVersion 35
versionCode 7000021
versionName "7.2.1"
versionCode 7020200
versionName "7.2.2"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -159,15 +159,15 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
implementation "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.1.1"*/

remoteImplementation("com.clevertap.android:clevertap-android-sdk:7.2.1")
remoteImplementation("com.clevertap.android:clevertap-geofence-sdk:1.3.0")
remoteImplementation("com.clevertap.android:push-templates:1.2.4")
remoteImplementation("com.clevertap.android:clevertap-hms-sdk:1.3.4")
remoteImplementation("com.clevertap.android:clevertap-android-sdk:7.2.2")
remoteImplementation("com.clevertap.android:clevertap-geofence-sdk:1.4.0")
remoteImplementation("com.clevertap.android:push-templates:1.3.0")
remoteImplementation("com.clevertap.android:clevertap-hms-sdk:1.4.0")

stagingImplementation("com.clevertap.android:clevertap-android-sdk:7.2.1")
stagingImplementation("com.clevertap.android:clevertap-geofence-sdk:1.3.0")
stagingImplementation("com.clevertap.android:push-templates:1.2.4")
stagingImplementation("com.clevertap.android:clevertap-hms-sdk:1.3.4")
stagingImplementation("com.clevertap.android:clevertap-android-sdk:7.2.2")
stagingImplementation("com.clevertap.android:clevertap-geofence-sdk:1.4.0")
stagingImplementation("com.clevertap.android:push-templates:1.3.0")
stagingImplementation("com.clevertap.android:clevertap-hms-sdk:1.4.0")
}

Properties loadLocalProperties() {
Expand Down
15 changes: 13 additions & 2 deletions templates/CTCORECHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
## CleverTap Android SDK CHANGE LOG

### Version 7.2.2 (January 21, 2025)

This hotfix release addresses a critical issue from `v7.1.0` onwards:

#### Bug Fixes
* Fixes an issue where `Notification Clicked` event was not being raised.


### Version 7.2.1 (January 16, 2025)
This hotfix release addresses the following issue in `v7.2.0`:
> ‼️ **NOTE**
A critical issue was identified in 7.2.1, please update to 7.2.2 and above

#### Bug Fixes
* Fixes `ClassCastException` from `Integer` to `Long` for server side in-apps delivery. A bug occurs when the network is turned off, and the following steps are performed:
Expand All @@ -11,7 +20,7 @@ This hotfix release addresses the following issue in `v7.2.0`:

### Version 7.2.0 (January 7, 2025)
> ‼️ **NOTE**
If you are using server side in-apps please use `7.2.1` instead. `7.2.0` has a bug related to server side in-apps.
A critical issue was identified in 7.2.0, please update to 7.2.2 and above

#### New Features

Expand All @@ -23,6 +32,8 @@ If you are using server side in-apps please use `7.2.1` instead. `7.2.0` has a b
After upgrading the SDK to v7.2.0, don't downgrade in subsequent app releases. If you encounter any issues, please contact the CleverTap support team for assistance.

### Version 7.1.0 (December 24, 2024)
> ‼️ **NOTE**
A critical issue was identified in 7.1.0, please update to 7.2.2 and above

#### New Features

Expand Down

0 comments on commit 3aa7fc3

Please sign in to comment.