Enhance SDK Integration: Auto ActivityLifecycleCallback & CI/CD Environment Support
Changelog
1. Automation Enhancements
- Modified
CleverTapApplication.javato automatically registerActivityLifecycleCallback. - Removed the need for manual registration in the developer workflow.
- Updated Android integration documentation to reflect this change.
2. CI/CD Pipeline Support
- Added support for environment variables to enable seamless CI/CD pipeline integration.
- Introduced flexible SDK initialization using the following environment variables:
-
CLEVERTAP_ACCOUNT_ID -
CLEVERTAP_ACCOUNT_TOKEN -
CLEVERTAP_ACCOUNT_REGION(optional) -
CLEVERTAP_HANDSHAKE_DOMAIN(optional)
-
- Updated documentation to include CI/CD-friendly configuration options.
3. Security and Documentation Improvements
- Added a detailed guide on managing environment variables securely.
- Documented best practices for securing credentials in different deployment environments.
- Provided instructions for secure credential management in CI/CD pipelines.
Summary by CodeRabbit
-
New Features
- Introduced a configuration template for setting up CleverTap credentials.
- Enhanced plugin initialization with support for dynamic configuration, including optional parameters.
-
Documentation
- Updated user guides with clearer integration instructions and improved formatting.
- Added a section on security best practices for managing sensitive data.
-
Chores
- Removed outdated configuration entries and cleaned up redundant settings in example files.
Walkthrough
This pull request introduces a new environment configuration file and updates documentation, integration instructions, and sample applications for CleverTap integration. The changes add new environment variables and methods to initialize the CleverTap SDK dynamically across Android, iOS, and Flutter. Additionally, several hard-coded configuration entries have been removed from native manifest and property files. Modifications in the plugin classes include lifecycle callback registration and error handling improvements when initializing CleverTap. Deprecated initialization methods are marked accordingly to encourage use of the new API.
Changes
| File(s) | Change Summary |
|---|---|
.env.example |
New configuration file with keys: CLEVERTAP_ACCOUNT_ID, CLEVERTAP_ACCOUNT_TOKEN, CLEVERTAP_ACCOUNT_REGION (Optional), CLEVERTAP_HANDSHAKE_DOMAIN (Optional). |
README.md, doc/Integrate-Android.md, doc/Integrate-iOS.md |
Updated documentation with formatting improvements, rephrased text, enhanced integration instructions, and added a "Security Measures" section. |
android/src/.../CleverTapApplication.javaandroid/src/.../DartToNativePlatformCommunicator.kt |
Android plugin updates: Lifecycle callback registration added and a new initializeCleverTap method introduced for handling initialization calls. |
example/android/.../AndroidManifest.xmlexample/ios/.../Info.plist |
Removed hard-coded meta-data and key-value pairs for CleverTap credentials from native configuration files. |
example/lib/main.dart, example/pubspec.yaml |
Sample app updates: Added initialization call for CleverTapPlugin and removed commented-out asset lines in pubspec.yaml. |
ios/Classes/CleverTapPlugin.m |
iOS plugin update: New initializeWithConfig:withResult: method added to support dynamic initialization with error handling. |
lib/clevertap_plugin.dart |
Flutter plugin API update: Introduced a new static initialize method for CleverTap SDK setup and marked the old init method as deprecated. |
Sequence Diagram(s)
sequenceDiagram
participant FlutterApp
participant PluginAPI
participant MethodChannel
participant NativePlatform
FlutterApp->>PluginAPI: Call initialize(accountId, token, region, targetDomain)
PluginAPI->>MethodChannel: Send "initialize" method call
MethodChannel-->>NativePlatform: Forward initialization call
alt Android Platform
NativePlatform->>DartToNativePlatformCommunicator: initializeCleverTap()
DartToNativePlatformCommunicator->>CleverTapApplication: Register lifecycle callback & set credentials
else iOS Platform
NativePlatform->>CleverTapPlugin: initializeWithConfig:withResult()
Note over CleverTapPlugin: Configure CleverTap instance with provided settings
end
NativePlatform-->>MethodChannel: Return initialization result
MethodChannel-->>PluginAPI: Forward result
PluginAPI-->>FlutterApp: Initialization complete
Possibly related PRs
- CleverTap/clevertap-flutter#294: The changes in the main PR, which introduce new environment variables for CleverTap integration, are related to the retrieved PR as both involve modifications to the CleverTap SDK's initialization and configuration processes, specifically regarding how credentials are managed and utilized.
Suggested reviewers
- nishant-clevertap
- piyush-kukadiya
- CTLalit
Poem
I'm a little rabbit, hopping through the code,
Leaving footprints on files in a cheerful abode.
New configs and docs, all tidy and bright,
Initializing CleverTap with every leap in flight.
With changes so clear, I dance in delight,
CodeRabbit’s rhythms making my day so light!
🪧 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.