Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android SDK release 7.2.2 #739

Merged
merged 8 commits into from
Jan 21, 2025
Merged

Android SDK release 7.2.2 #739

merged 8 commits into from
Jan 21, 2025

Conversation

CTLalit
Copy link
Collaborator

@CTLalit CTLalit commented Jan 21, 2025

https://wizrocket.atlassian.net/browse/SDK-4303

Summary by CodeRabbit

  • New Features

    • No new user-facing features in this release
  • Bug Fixes

    • Fixed a critical issue where the Notification Clicked event was not being raised
    • Resolved potential issues in notification handling and event processing
  • Chores

    • Updated CleverTap Android SDK to version 7.2.2
    • Updated related SDK dependencies to their latest versions
  • Documentation

    • Updated changelog and documentation to reflect the latest version and bug fixes

Copy link

coderabbitai bot commented Jan 21, 2025

Walkthrough

The pull request introduces version 7.2.2 of the CleverTap Android SDK, addressing a critical issue with notification clicked events. The changes span multiple files, including the changelog, documentation, and core SDK components. The update involves modifying version numbers, improving notification event handling, and adding a new test class for encryption migration. The primary focus is on fixing a bug where notification clicked events were not being raised correctly.

Changes

File Change Summary
CHANGELOG.md Added new entry for CleverTap Android SDK v7.2.2
README.md, docs/CTGEOFENCE.md, docs/CTPUSHTEMPLATES.md Updated SDK dependency version from 7.2.1 to 7.2.2
gradle/libs.versions.toml Updated clevertap_android_sdk version to 7.2.2
sample/build.gradle Updated version code, name, and multiple SDK dependencies
clevertap-core/src/main/java/com/clevertap/android/sdk/AnalyticsManager.java Modified notification event logging and handling
clevertap-core/src/main/java/com/clevertap/android/sdk/AnalyticsManagerBundler.kt Added notificationClickedJson method
clevertap-core/src/main/java/com/clevertap/android/sdk/InAppNotificationActivity.java Added invokedCallbacks flag and modified dismissal logic
docs/CTCORECHANGELOG.md, templates/CTCORECHANGELOG.md Added version 7.2.2 entry with critical issue notes
clevertap-core/src/test/java/com/clevertap/android/sdk/AnalyticsManagerTest.kt Updated test cases for notification clicked events
clevertap-core/src/test/java/com/clevertap/android/sdk/cryption/CryptMigratorTest.kt Added new test class for encryption migration

Sequence Diagram

sequenceDiagram
    participant App
    participant AnalyticsManager
    participant AnalyticsManagerBundler
    
    App->>AnalyticsManager: pushNotificationClickedEvent
    AnalyticsManager->>AnalyticsManagerBundler: notificationClickedJson
    AnalyticsManagerBundler-->>AnalyticsManager: JSONObject
    AnalyticsManager->>App: Process Notification Clicked Event
Loading

Poem

🐰 A Rabbit's Ode to SDK Update 🚀

Hop, hop, version seven-point-two-two,
Notifications clicked, now working true!
Bugs scurry away, events shine bright,
CleverTap's magic takes playful flight!
Code leaps forward with joyous might! 🎉

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
clevertap-core/src/main/java/com/clevertap/android/sdk/InAppNotificationActivity.java (1)

269-285: Consider adding synchronization for thread safety.

While the invokedCallbacks flag prevents duplicate callbacks, the check-then-set operation is not atomic. In a multi-threaded environment, this could lead to race conditions where multiple threads might execute the callback block simultaneously.

Consider adding synchronization:

-    void didDismiss(Bundle data, boolean killActivity) {
+    synchronized void didDismiss(Bundle data, boolean killActivity) {
         if (isAlertVisible) {
             isAlertVisible = false;
         }
clevertap-core/src/main/java/com/clevertap/android/sdk/AnalyticsManagerBundler.kt (1)

43-54: LGTM! Consider refactoring to reduce code duplication.

The implementation looks correct. However, since notificationClickedJson and notificationViewedJson share the same structure, consider extracting the common logic into a private method to reduce duplication.

@JvmStatic
private fun createNotificationJson(root: Bundle, eventName: String): JSONObject {
    val event = JSONObject()
    try {
        val notif = wzrkBundleToJson(root)
        event.put("evtName", eventName)
        event.put("evtData", notif)
    } catch (ignored: Throwable) {
        //no-op
    }
    return event
}

@JvmStatic
fun notificationViewedJson(root: Bundle): JSONObject =
    createNotificationJson(root, Constants.NOTIFICATION_VIEWED_EVENT_NAME)

@JvmStatic
fun notificationClickedJson(root: Bundle): JSONObject =
    createNotificationJson(root, Constants.NOTIFICATION_CLICKED_EVENT_NAME)
clevertap-core/src/test/java/com/clevertap/android/sdk/cryption/CryptMigratorTest.kt (1)

52-90: Consider adding edge cases for encryption level validation.

The migration tests cover the basic scenarios well. Consider adding test cases for:

  • Invalid/unsupported encryption levels
  • Null encryption levels
  • Migration with empty/corrupted data
clevertap-core/src/main/java/com/clevertap/android/sdk/AnalyticsManager.java (1)

1076-1076: Consider using structured logging.

The verbose logging messages could benefit from using structured logging with key-value pairs for better parsing and analysis.

-config.getLogger().verbose(config.getAccountId(), "Constructed custom profile: " + customProfile);
+config.getLogger().verbose(config.getAccountId(), "Constructed custom profile - profile={}", customProfile);

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

Also applies to: 1143-1143

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ff4f5f and 3aa7fc3.

📒 Files selected for processing (13)
  • CHANGELOG.md (1 hunks)
  • README.md (2 hunks)
  • clevertap-core/src/main/java/com/clevertap/android/sdk/AnalyticsManager.java (3 hunks)
  • clevertap-core/src/main/java/com/clevertap/android/sdk/AnalyticsManagerBundler.kt (1 hunks)
  • clevertap-core/src/main/java/com/clevertap/android/sdk/InAppNotificationActivity.java (3 hunks)
  • clevertap-core/src/test/java/com/clevertap/android/sdk/AnalyticsManagerTest.kt (5 hunks)
  • clevertap-core/src/test/java/com/clevertap/android/sdk/cryption/CryptMigratorTest.kt (1 hunks)
  • docs/CTCORECHANGELOG.md (3 hunks)
  • docs/CTGEOFENCE.md (1 hunks)
  • docs/CTPUSHTEMPLATES.md (1 hunks)
  • gradle/libs.versions.toml (1 hunks)
  • sample/build.gradle (2 hunks)
  • templates/CTCORECHANGELOG.md (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/CTPUSHTEMPLATES.md
🧰 Additional context used
🪛 LanguageTool
docs/CTCORECHANGELOG.md

[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... issue from v7.1.0 onwards: #### Bug Fixes * Fixes an issue where Notification Clicked e...

(ENGLISH_WORD_REPEAT_RULE)

templates/CTCORECHANGELOG.md

[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... issue from v7.1.0 onwards: #### Bug Fixes * Fixes an issue where Notification Clicked e...

(ENGLISH_WORD_REPEAT_RULE)

CHANGELOG.md

[style] ~3-~3: Some style guides suggest that commas should set off the year in a month-day-year date.
Context: ## CHANGE LOG. ### January 21, 2025 * [CleverTap Android SDK v7.2.2](docs/C...

(MISSING_COMMA_AFTER_YEAR)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint-static_checks-test-build
🔇 Additional comments (19)
clevertap-core/src/main/java/com/clevertap/android/sdk/InAppNotificationActivity.java (3)

57-58: LGTM! Good addition to prevent duplicate callbacks.

The invokedCallbacks flag is a good practice to ensure dismissal callbacks are only invoked once.


465-471: LGTM! Good cleanup in onDestroy.

The implementation properly handles configuration changes and ensures cleanup. The super.onDestroy() call is correctly placed at the beginning of the method.


269-285: Verify impact on notification dismissal behavior.

The changes to didDismiss modify when the activity is finished. Let's verify that all callers handle this correctly.

✅ Verification successful

Changes to didDismiss are safely implemented

The new behavior maintains compatibility with existing callers while adding flexibility for activity lifecycle control. All current usages either rely on the default finishing behavior or explicitly manage the activity lifecycle.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for direct calls to didDismiss to ensure they're updated
rg -l "didDismiss\(" | while read -r file; do
  echo "=== $file ==="
  rg -A 2 "didDismiss\(" "$file"
done

# Search for potential custom implementations that might expect the old behavior
ast-grep --pattern 'class $_ extends InAppNotificationActivity {
  $$$
}'

Length of output: 8217

clevertap-core/src/test/java/com/clevertap/android/sdk/cryption/CryptMigratorTest.kt (3)

11-54: LGTM! Well-structured test setup with comprehensive mocking.

The test class is well-organized with proper initialization of mocks and test subjects. The setup creates two instances of CryptMigrator with different encryption levels, which is good for testing various migration scenarios.


106-232: LGTM! Thorough testing of cached GUID migration.

The test cases for cached GUID migration are comprehensive, covering:

  • Encryption level changes (none to medium, medium to none)
  • Encryption/decryption failures
  • Data format validation

287-492: LGTM! Comprehensive testing of database profile migration.

The test cases for database profile migration are thorough, covering:

  • Encryption level changes
  • Field-level encryption
  • Error handling
  • Data integrity validation
clevertap-core/src/test/java/com/clevertap/android/sdk/AnalyticsManagerTest.kt (1)

229-229: LGTM! Test cases updated correctly for notification clicked events.

The test cases have been properly updated to use notificationClickedJson instead of notificationViewedJson, maintaining consistency with the changes in AnalyticsManagerBundler.

Also applies to: 267-267, 358-358

clevertap-core/src/main/java/com/clevertap/android/sdk/AnalyticsManager.java (2)

497-498: LGTM! Improved logging clarity.

The logging message now uses the actual extras object instead of toString(), providing better visibility into the notification data.


504-504: LGTM! Correct event type for notification clicks.

The implementation now correctly uses notificationClickedJson for clicked events instead of notificationViewedJson.

sample/build.gradle (2)

21-22: Version updates look good

Version code and name are updated consistently following semantic versioning.


162-165: Dependency versions are updated consistently

All CleverTap SDK dependencies are updated to their latest compatible versions:

  • clevertap-android-sdk: 7.2.2
  • clevertap-geofence-sdk: 1.4.0
  • push-templates: 1.3.0
  • clevertap-hms-sdk: 1.4.0

Also applies to: 167-170

gradle/libs.versions.toml (1)

57-57: Version catalog update looks good

The CleverTap Android SDK version is updated consistently in the version catalog.

docs/CTGEOFENCE.md (1)

20-20: Documentation version update looks good

The CleverTap Android SDK version reference is updated consistently in the documentation.

README.md (1)

29-29: README version updates look good

All references to the CleverTap Android SDK version are updated consistently throughout the README.

Also applies to: 37-37, 49-49

docs/CTCORECHANGELOG.md (2)

3-9: Changelog entry is well documented

The changelog entry for version 7.2.2 clearly describes the critical bug fix for the notification clicked event issue.

🧰 Tools
🪛 LanguageTool

[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... issue from v7.1.0 onwards: #### Bug Fixes * Fixes an issue where Notification Clicked e...

(ENGLISH_WORD_REPEAT_RULE)


12-13: Advisory notes are helpful

The advisory notes for previous versions (7.2.1, 7.2.0, 7.1.0) appropriately guide users to upgrade to version 7.2.2 to address the critical issue.

Also applies to: 23-23, 35-36

templates/CTCORECHANGELOG.md (2)

3-9: LGTM! Clear version entry with proper documentation.

The version entry follows the changelog format consistently and clearly documents the critical fix.

🧰 Tools
🪛 LanguageTool

[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... issue from v7.1.0 onwards: #### Bug Fixes * Fixes an issue where Notification Clicked e...

(ENGLISH_WORD_REPEAT_RULE)


12-13: LGTM! Appropriate warning notes for previous versions.

The warning notes are properly added to alert users about the critical issue and provide clear upgrade guidance.

Also applies to: 23-23

CHANGELOG.md (1)

3-5: LGTM! Consistent changelog entry.

The entry maintains the established format and properly links to the detailed changelog.

🧰 Tools
🪛 LanguageTool

[style] ~3-~3: Some style guides suggest that commas should set off the year in a month-day-year date.
Context: ## CHANGE LOG. ### January 21, 2025 * [CleverTap Android SDK v7.2.2](docs/C...

(MISSING_COMMA_AFTER_YEAR)

Copy link
Contributor

@piyush-kukadiya piyush-kukadiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@piyush-kukadiya piyush-kukadiya merged commit f7ce78c into master Jan 21, 2025
5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants