clevertap-android-sdk icon indicating copy to clipboard operation
clevertap-android-sdk copied to clipboard

CTInAppHtmlBannerOverlay

Open simonbullen opened this issue 6 months ago • 2 comments

This PR adds CTInAppHtmlBannerOverlay to handle custom-html header and footer CTInAppNotification banners when the current activity is not a FragmentActivity.

This allows CTInAppTypeFooterHTML and CTInAppTypeHeaderHTML notifications to work on Unreal, which can't easily provide a FragmentActivity.

Summary by CodeRabbit

  • New Features

    • Introduced a new in-app notification system with enhanced support for various notification types, including HTML, native, and custom templates.
    • Added new UI components for in-app notifications, including banners, headers, footers, interstitials, and media-rich notifications.
    • Improved support for push notification permission prompts and system event management.
    • Enhanced encryption for network communication and content fetch requests.
  • Bug Fixes

    • Improved error handling and resource cleanup for in-app notifications and media assets.
  • Refactor

    • Migrated in-app notification logic and UI components to Kotlin for better maintainability and modularity.
    • Simplified and unified the handling of notification actions, layouts, and media.
    • Streamlined network, storage, and event management for improved performance and reliability.
  • Chores

    • Updated and consolidated test coverage exclusions for in-app notification components.
    • Improved internal state and dependency management throughout the SDK.
  • Documentation

    • Updated documentation to reflect new and refactored in-app notification APIs and behaviors.

simonbullen avatar Jun 27 '25 05:06 simonbullen

:tada: Snyk checks have passed. No issues have been found so far.

:white_check_mark: security/snyk check is complete. No issues have been found. (View Details)

:white_check_mark: license/snyk check is complete. No issues have been found. (View Details)

:white_check_mark: code/snyk check is complete. No issues have been found. (View Details)

francispereira avatar Jun 27 '25 05:06 francispereira

[!CAUTION]

Review failed

Failed to post review comments.

Walkthrough

This change completely rewrites the in-app notification system, removing all legacy Java-based in-app notification classes and fragments and replacing them with a new Kotlin-based architecture. The new implementation introduces redesigned models, controllers, fragments, overlays, and supporting infrastructure for queuing, inflating, displaying, and handling user interactions with in-app notifications.

Changes

Files / Groups Change Summary
clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInApp*, InAppController.java, fragment/CTInApp*, InAppWebViewClient.kt All legacy Java in-app notification classes, fragments, and webview clients removed.
clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInApp*, InAppController.kt, fragment/CTInApp*, InAppWebViewClient.kt, PartialHtmlInAppGestureListener.kt, StoreRegistryInAppQueue.kt, InAppNotificationInflater.kt New Kotlin-based in-app notification models, controller, fragments, overlays, queue, gesture listener, and inflater added.
clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppNotification.kt, CTInAppNotificationButton.kt, CTInAppNotificationMedia.kt, CTInAppType.kt, CTInAppAction.kt, InAppQueue.kt In-app notification model, button, media, type enum, action, and queue interface rewritten in Kotlin.
clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/CTInAppHost.kt New host class for in-app notification event delegation and listener management.
clevertap-core/src/main/java/com/clevertap/android/sdk/ActivityLifeCycleManager.java Method updated to use new in-app controller API.
.run/All Tests.run.xml Test exclusion patterns updated for new/removed in-app classes.
clevertap-core/src/main/java/com/clevertap/android/sdk/CTWebInterface.java Refactored to use new in-app host abstraction.
clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/customtemplates/CustomTemplateContext.kt, CustomTemplateInAppData.kt Visibility modifiers and JSON copying updated for new model structure.
clevertap-core/src/main/java/com/clevertap/android/sdk/inapp/data/InAppResponseAdapter.kt Media instantiation updated for new Kotlin model.
Other supporting files (CTXtensions.kt, etc.) Utility and extension functions added or updated for new models.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application/Activity
    participant InAppController
    participant InAppQueue
    participant InAppNotificationInflater
    participant Fragment/Overlay
    participant InAppHost
    participant Listener

    App->>InAppController: onAppLaunch / onEvent / onProfileChange
    InAppController->>InAppQueue: Enqueue eligible in-app notifications
    App->>InAppController: showNotificationIfAvailable()
    InAppController->>InAppQueue: Dequeue next notification
    InAppController->>InAppNotificationInflater: Inflate notification (async)
    InAppNotificationInflater-->>InAppController: Notification ready
    InAppController->>Fragment/Overlay: Show notification UI
    Fragment/Overlay->>InAppHost: User interacts (click, dismiss, etc.)
    InAppHost->>Listener: Notify action/click/dismiss
    InAppHost->>InAppController: Trigger next notification if needed

Possibly related PRs

  • #790: Refactored CTWebInterface and webview cleanup; related as both PRs overhaul in-app webview handling and lifecycle.
  • #831: Kotlin conversion of in-app package, including InAppController; directly connected as both represent the same migration.
  • #785: Introduces system in-app functions and InAppActionHandler, which the new InAppController depends on for action handling.

Suggested labels

eaa

Suggested reviewers

  • darshanclevertap
  • piyush-kukadiya
✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

coderabbitai[bot] avatar Jun 27 '25 05:06 coderabbitai[bot]