-
Notifications
You must be signed in to change notification settings - Fork 5
Update CleverTapUnityPlugin.java - String Json parsing added in binding. #228
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
Update CleverTapUnityPlugin.java - String Json parsing added in binding. #228
Conversation
* String Json parsing added in binding.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this 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 (1)
CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/src/main/java/com/clevertap/unity/CleverTapUnityPlugin.java (1)
1253-1267: tryParseJson implementation looks correct; consider minor robustness improvementsThe helper is straightforward and does what you need: trims the string, parses
{...}asJSONObjectand[...]asJSONArray, and safely falls back tonullon failure. Two optional refinements you might consider:
- Log at debug/verbose level when parsing fails, if you ever need to diagnose malformed JSON arriving over the bridge.
- If you ever need to support JSON primitives (e.g.,
123,"foo",trueas top‑level JSON), extend this method to handle those as well; right now only objects/arrays are recognized.Not blockers, just future‑proofing ideas.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/src/main/java/com/clevertap/unity/CleverTapUnityPlugin.java(2 hunks)
🔇 Additional comments (1)
CleverTap/Plugins/Android/clevertap-android-wrapper.androidlib/src/main/java/com/clevertap/unity/CleverTapUnityPlugin.java (1)
690-696: Behavior change for string variables that contain JSONThe new logic correctly treats string values that are valid JSON objects/arrays as JSON and returns them unquoted, falling back to the old
"\"...\""behavior otherwise. However, this is a breaking behavior change for any existing string variable whose value happens to start with{or[and is valid JSON: Unity will now see a JSON object/array instead of a JSON string literal.Please double‑check with SDK consumers (and/or add tests) to confirm that:
- This change is intentional for all string variables, not just newly introduced “JSON variables”.
- No existing integrations rely on always receiving a quoted string even when the content looks like JSON.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.