Skip to content

Conversation

@longvantruong
Copy link

@longvantruong longvantruong commented May 22, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a callback interface to receive survey lifecycle events, error notifications, and success events.
    • Added support for passing hidden fields to surveys for more flexible data collection.
    • Added configuration option to control automatic dismissal of error dialogs.
  • Enhancements

    • Improved error and success reporting throughout the SDK, providing more detailed feedback via callbacks.
    • Expanded ProGuard and consumer rules to better preserve required classes and suppress unnecessary warnings.
  • Bug Fixes

    • Enhanced error handling to notify clients of issues such as missing user IDs or survey IDs.
  • Chores

    • Downgraded several dependencies and build tools for broader compatibility.
    • Updated build configurations including SDK versions, plugin versions, and Gradle wrapper for stability.

@coderabbitai
Copy link

coderabbitai bot commented May 22, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change introduces a callback-based event and error reporting system throughout the Android SDK, adding a new FormbricksCallback interface and integrating callback invocations for survey lifecycle, success, and error events. Several method signatures are updated to support additional parameters such as hiddenFields and user ID override. ProGuard and build configuration files are updated, with dependency versions and plugin declarations downgraded, and additional resource and code shrinking rules added.

Changes

File(s) Change Summary
android/build.gradle.kts, gradle/libs.versions.toml, gradle/wrapper/gradle-wrapper.properties Downgraded Gradle, Android Gradle Plugin, Kotlin, and related dependency versions; switched plugin declaration styles; updated Maven publishing config; changed Android compile SDK version and build type options; expanded packaging options and resource excludes.
android/consumer-rules.pro, android/proguard-rules.pro Added ProGuard keep rules for additional classes and interfaces; introduced warning suppressions for specific classes; ensured new callback interface and related packages are preserved during code shrinking.
android/src/main/java/com/formbricks/android/Formbricks.kt Introduced FormbricksCallback interface for survey lifecycle, success, and error events; added callback property to Formbricks; updated multiple methods to invoke callbacks on error or success; changed method signatures to support user ID override and hidden fields.
android/src/main/java/com/formbricks/android/helper/FormbricksConfig.kt Added autoDismissErrors property and builder method to configuration; updated constructor signature.
android/src/main/java/com/formbricks/android/manager/SurveyManager.kt Integrated callback invocations for success and error reporting; updated track method to accept optional hiddenFields parameter.
android/src/main/java/com/formbricks/android/manager/UserManager.kt Added callback invocations for user sync and logout success or error events.
android/src/main/java/com/formbricks/android/network/queue/UpdateQueue.kt Added callback invocation for missing user ID error in commit() method.
android/src/main/java/com/formbricks/android/webview/FormbricksFragment.kt Updated constructor and static show method to accept hiddenFields; enhanced error and lifecycle event callback invocations; improved error handling and dismissal logic.
android/src/main/java/com/formbricks/android/webview/FormbricksViewModel.kt Updated loadHtml and getJson methods to accept and serialize optional hiddenFields parameter into survey JSON.
android/src/main/java/com/formbricks/android/webview/WebAppInterface.kt Added callback error reporting in all exception handlers within the message function.

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.

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: 1

🧹 Nitpick comments (3)
android/src/main/java/com/formbricks/android/helper/FormbricksConfig.kt (1)

53-56: New builder method for error handling configuration

The setAutoDismissErrors method follows the existing builder pattern consistently. Consider adding a brief comment to explain what this setting controls, similar to other methods in the class.

+/**
+ * Controls whether survey fragments automatically dismiss on error conditions
+ */
 fun setAutoDismissErrors(autoDismissErrors: Boolean): Builder {
     this.autoDismissErrors = autoDismissErrors
     return this
 }
android/proguard-rules.pro (1)

53-55: Duplicated StringConcatFactory rule with clarifying comment.

This rule is already defined at line 45, but the comment indicates it was auto-generated by the Android Gradle plugin, which explains the duplication.

Consider consolidating these duplicate rules to avoid confusion, although keeping it as is won't cause any functional issues.

android/src/main/java/com/formbricks/android/Formbricks.kt (1)

217-217: Inconsistent success callback implementation.

Success callback is only implemented for logout operations. Consider adding success callbacks for other operations like setUserId, setAttribute, etc., to maintain API consistency.

For example, add success callbacks after successful operations:

fun setUserId(userId: String, allowOverrideUserId: Boolean) {
    // existing checks...
    
    UserManager.set(userId)
+   callback?.onSuccess(SuccessType.USER_ID_SET_SUCCESS)
}

This would require adding corresponding enum values to the SuccessType enum.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cbccd85 and 5731ee5.

📒 Files selected for processing (13)
  • android/build.gradle.kts (4 hunks)
  • android/consumer-rules.pro (1 hunks)
  • android/proguard-rules.pro (2 hunks)
  • android/src/main/java/com/formbricks/android/Formbricks.kt (11 hunks)
  • android/src/main/java/com/formbricks/android/helper/FormbricksConfig.kt (2 hunks)
  • android/src/main/java/com/formbricks/android/manager/SurveyManager.kt (10 hunks)
  • android/src/main/java/com/formbricks/android/manager/UserManager.kt (3 hunks)
  • android/src/main/java/com/formbricks/android/network/queue/UpdateQueue.kt (2 hunks)
  • android/src/main/java/com/formbricks/android/webview/FormbricksFragment.kt (7 hunks)
  • android/src/main/java/com/formbricks/android/webview/FormbricksViewModel.kt (3 hunks)
  • android/src/main/java/com/formbricks/android/webview/WebAppInterface.kt (2 hunks)
  • gradle/libs.versions.toml (1 hunks)
  • gradle/wrapper/gradle-wrapper.properties (1 hunks)
🔇 Additional comments (42)
android/src/main/java/com/formbricks/android/helper/FormbricksConfig.kt (3)

18-19: New parameter added for error handling control

The addition of autoDismissErrors with a default value of true maintains backward compatibility while adding configurable behavior for error handling.


26-26: Private variable for new configuration property

This matches the pattern used for other configuration properties in the builder.


65-66: Configuration property passed to constructor

The builder correctly passes the new autoDismissErrors parameter to the FormbricksConfig constructor.

gradle/wrapper/gradle-wrapper.properties (1)

1-1: Significant Gradle version downgrade

Downgrading from Gradle 8.11.1 to 7.5 is a substantial change that may affect build performance and available features. While this appears to be intentional to align with other dependency downgrades in the project, please verify this is necessary.

Can you confirm if this downgrade is required for compatibility with other build dependencies? Newer Gradle versions typically offer better performance and more features.

Also applies to: 4-4

android/src/main/java/com/formbricks/android/network/queue/UpdateQueue.kt (2)

3-3: Added import for callback support

The new import supports the error reporting enhancement.


72-72: Enhanced error reporting with callback

Good improvement to not only log errors but also report them through the callback system, which aligns with the broader error handling enhancements in this PR.

android/consumer-rules.pro (1)

5-11: ProGuard rules for callback interface and required libraries

The added ProGuard rules correctly preserve the new FormbricksCallback interface and necessary dependencies from code shrinking and obfuscation.

The warning suppression for StringConcatFactory is a standard practice for handling warnings related to Java 9+ features.

android/src/main/java/com/formbricks/android/webview/WebAppInterface.kt (2)

4-4: Good addition of Formbricks import for callback access.

The import is necessary to access the global callback mechanism that's being integrated throughout the SDK.


39-40: Consistent error reporting through callback mechanism.

Good implementation of the callback-based error reporting system across all exception handling blocks. This provides a centralized way to notify consumers of the SDK about errors, in addition to the existing logging mechanism.

Also applies to: 42-43, 45-46, 48-49

android/proguard-rules.pro (2)

38-38: Properly kept FormbricksCallback interface from obfuscation.

Good addition of the ProGuard rule to preserve the FormbricksCallback interface, which is necessary for the newly introduced callback system to work correctly.


48-52: Additional ProGuard rules for external dependencies.

These rules ensure that necessary classes from external dependencies are preserved during code shrinking and obfuscation.

android/src/main/java/com/formbricks/android/manager/UserManager.kt (4)

11-11: Added SuccessType import for callback integration.

The import is necessary for the success callback integration being added to the user manager.


150-150: User sync success callback notification.

Good addition of the success callback after user synchronization, providing feedback to SDK consumers about successful operations.


153-153: Error reporting through callback in exception handling.

Appropriate integration of the error callback in the exception handler, allowing SDK consumers to be notified of user sync failures.


167-168: Error reporting during logout operation.

Good addition of the error callback when attempting to logout without a user ID set, providing clear feedback to SDK consumers.

android/src/main/java/com/formbricks/android/webview/FormbricksViewModel.kt (5)

15-15: Added Gson import for JSON serialization.

The import is necessary for serializing the new hiddenFields parameter into JSON.


115-115: Extended loadHtml method to support hiddenFields.

Good addition of an optional hiddenFields parameter with a default value of null, ensuring backward compatibility.


117-121: Updated getJson invocation with hiddenFields parameter.

Properly passing the hiddenFields parameter to the getJson method.


126-130: Updated getJson method signature with hiddenFields parameter.

The method signature is appropriately updated to accept the new optional parameter.


148-148: Added hiddenFields to JSON payload.

Good implementation of conditional adding of hiddenFields to the JSON payload using Gson for serialization. The null check ensures backward compatibility.

android/src/main/java/com/formbricks/android/manager/SurveyManager.kt (4)

76-76: Good error handling improvement.

Adding callback error reporting during environment data deserialization provides better visibility for SDK consumers into what's happening behind the scenes.


134-134: Proper callback integration for environment refresh.

Adding success and error callbacks for the environment refresh operation provides useful feedback to SDK consumers about the operation's outcome.

Also applies to: 138-138


149-149: Feature enhancement: Hidden fields support.

The addition of an optional hiddenFields parameter to the track method and passing it to showSurvey allows for more contextual data to be sent with surveys. This is a valuable enhancement for capturing additional information without modifying the survey structure.

Also applies to: 191-191


163-164: Comprehensive error reporting across survey lifecycle.

Adding callback error reporting for various failure scenarios (survey not found, language unavailability, display issues, missing IDs) provides consistent error handling throughout the SDK. This significantly improves the debugging experience for SDK consumers.

Also applies to: 174-175, 198-200, 214-215, 228-230, 296-298

gradle/libs.versions.toml (1)

2-4:

Details

❓ Verification inconclusive

Verify compatibility with downgraded dependency versions.

Multiple dependencies have been significantly downgraded (e.g., AGP from 8.x to 7.2.2, Kotlin from 2.1.0 to 1.7.20). While this may improve compatibility with older Android environments, it could introduce compatibility issues or lose access to newer features.

Also applies to: 6-26


🏁 Script executed:

#!/bin/bash
# Check if any of the dependency versions are too old or have known vulnerabilities

# Check AGP compatibility with Gradle version
cat gradle/wrapper/gradle-wrapper.properties

# Check for any deprecation warnings in build logs
grep -i "deprecat" android/build/outputs/logs/build-info.xml 2>/dev/null || echo "No build logs available"

# Look for any commented migrations or TODOs related to version changes
grep -r "TODO.*upgrad" --include="*.kt" --include="*.gradle*" .

Length of output: 460


Verify compatibility with downgraded dependencies

We’ve rolled back:

  • AGP from 8.x → 7.2.2
  • Kotlin from 2.1.0 → 1.7.20
  • core-ktx to 1.8.0

Preliminary checks show your Gradle wrapper is on 7.5 (acceptable for AGP 7.2.2), but we couldn’t locate any deprecation warnings or TODOs in the logs. Please:

• Confirm AGP 7.2.2 officially supports Gradle 7.5 (see Android Gradle Plugin release notes).
• Run a full clean build (./gradlew clean assembleDebug) and address any missing-feature or deprecation errors.
• Verify that Kotlin 1.7.20 covers all language/API usages in your codebase.

Key files for review:

  • gradle/libs.versions.toml (lines 2–4)
  • gradle/wrapper/gradle-wrapper.properties
android/build.gradle.kts (5)

5-7: Style change: Using plugin ID syntax instead of Kotlin DSL syntax.

The switch from Kotlin DSL plugin application to ID-based plugin application is consistent with the overall downgrading pattern. Ensure this doesn't affect build functionality.


28-28: SDK version alignment with Kotlin version.

Downgrading the compileSdk from 35 to 34 and adding a Kotlin BOM enforcement aligns with the dependency downgrades in the versions.toml file. This ensures consistent versioning across the build.

Also applies to: 110-110


52-71: Enhanced packaging configuration using sets.

The updated packagingOptions block with explicit sets for excludes and pickFirsts is more maintainable and clearer. Good improvement to handle potential packaging conflicts.


114-115: Maven publishing configuration update.

The changes to the Maven publishing configuration (removing the CENTRAL_PORTAL parameter and using property setters) match the downgraded maven-publish plugin version. This ensures proper artifact publishing with the older plugin version.

Also applies to: 122-142


43-43:

Details

❓ Verification inconclusive

Disabling minification for release builds.

Turning off minification for release builds might increase the SDK size, but can help avoid potential ProGuard-related issues with the callback implementation. Consider if this trade-off is acceptable.


🏁 Script executed:

#!/bin/bash
# Check the impact of disabling minification on the AAR size

# Find previous release AAR size if available
find . -name "*.aar" -type f -exec ls -lh {} \;

# See if there are any ProGuard-related files that might explain this change
grep -r "Formbricks.*keep" --include="*.pro" .

Length of output: 101


Verify impact of disabling minification (android/build.gradle.kts:43)

Disabling isMinifyEnabled for release builds can prevent ProGuard-related callback issues but will increase your AAR size. We weren’t able to locate any existing AAR artifacts or ProGuard keep rules for Formbricks in the repo—please double-check the following before merging:

  • Compare the size of a pre-minified release AAR against the new build to quantify the increase.
  • Confirm whether any custom ProGuard rules (e.g., -keep for callback implementations) are required once minification is off.
  • Decide if the larger SDK footprint is acceptable for your distribution targets.
android/src/main/java/com/formbricks/android/webview/FormbricksFragment.kt (5)

42-42: Feature enhancement: Hidden fields support in FormbricksFragment.

Adding hiddenFields parameter to the constructor and show method allows for passing contextual data through to the survey, which aligns with the changes in SurveyManager. This is a valuable enhancement.

Also applies to: 248-253


51-51: Comprehensive lifecycle event reporting.

Adding callback reporting for survey lifecycle events (started, closed, page visible) provides valuable feedback to SDK consumers about the survey's state, improving the integration experience.

Also applies to: 57-58, 194-195


150-154: Improved error handling for missing surveyId.

Adding an explicit check for null or empty surveyId with appropriate error callback and early return prevents potential issues later in the code. This is a good defensive programming practice.


163-166: Configurable error handling behavior.

The addition of Formbricks.autoDismissErrors flag allows SDK consumers to control whether surveys should be automatically dismissed on errors. This provides flexibility in error handling strategies.


210-210: Proper propagation of hidden fields to the view model.

Forwarding the hiddenFields parameter to the view model's loadHtml method ensures that the data flows correctly through the entire survey display pipeline.

android/src/main/java/com/formbricks/android/Formbricks.kt (7)

18-26: Well-structured callback interface design.

The new FormbricksCallback interface is well-designed with clear method signatures for survey lifecycle events, error reporting, and success notifications. This allows client applications to better integrate with the SDK and respond appropriately to various events.


40-40: Good addition of callback property.

Making the callback property publicly accessible allows client applications to set and update the callback implementation as needed. The nullability ensures flexibility when no callback handling is required.


105-110: Good implementation of user ID override protection.

The check for existing user ID and the allowOverrideUserId parameter prevents accidental user ID overrides, which is a good security practice to maintain user data integrity.


182-182: Beneficial addition of hiddenFields parameter.

The addition of the optional hiddenFields parameter to track and showSurvey methods allows for passing additional data through the survey flow, which enhances flexibility and customization options.

Also applies to: 197-197, 236-236, 245-245


65-65: Consistent error reporting through callbacks.

The addition of error callbacks throughout the code provides a consistent mechanism for error reporting across the SDK, making errors more visible to client applications and allowing them to handle errors appropriately.

Also applies to: 100-100, 107-107, 127-127, 146-146, 165-165, 185-185, 192-192, 212-212, 239-239


36-36:

Details

✅ Verification successful

Verify usage of autoDismissErrors property.

The autoDismissErrors property is added and initialized from the configuration, but its actual usage is not apparent in this file. Please ensure this property is correctly used in the error handling flow.

Also applies to: 76-76


🏁 Script executed:

#!/bin/bash
# Search for usage of autoDismissErrors property in the codebase
rg "autoDismissErrors" --type kotlin

Length of output: 1026


autoDismissErrors property usage confirmed

The autoDismissErrors flag is correctly applied in the error handling flow:

  • In Formbricks.kt:
    autoDismissErrors = config.autoDismissErrors
  • In FormbricksFragment.kt:
    if (Formbricks.autoDismissErrors) {
        // dismiss errors
    }

No further changes needed.


13-13:

Details

✅ Verification successful

Ensure SuccessType enum is properly defined.

The code imports and uses SuccessType enum. Make sure this enum has all the necessary values for different success scenarios in the SDK.


🏁 Script executed:

#!/bin/bash
# Check the definition of SuccessType enum
rg -A 10 "enum class SuccessType"

Length of output: 492


🏁 Script executed:

#!/bin/bash
# List all public methods in Formbricks.kt and show where SuccessType is used
echo "== Methods in Formbricks.kt =="
rg -n "fun " android/src/main/java/com/formbricks/android/Formbricks.kt

echo
echo "== SuccessType usages in Formbricks.kt =="
rg -n "SuccessType" -C2 android/src/main/java/com/formbricks/android/Formbricks.kt

Length of output: 1737


SuccessType enum is complete for current SDK use cases

The SuccessType enum in android/src/main/java/com/formbricks/android/model/enums/SuccessType.kt defines exactly three values:

  • SET_USER_SUCCESS
  • GET_ENVIRONMENT_SUCCESS
  • LOGOUT_SUCCESS

These match the only three places where onSuccess(successType: SuccessType) is invoked in Formbricks.kt (user setup, environment fetch, logout). No additional enum entries are needed at this time.

@CLAassistant
Copy link

CLAassistant commented May 22, 2025

CLA assistant check
All committers have signed the CLA.

@mattinannt mattinannt changed the title chore: custom sdk tcb chore: custom sdk updates May 22, 2025
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

♻️ Duplicate comments (1)
android/src/main/java/com/formbricks/android/Formbricks.kt (1)

97-97: ⚠️ Potential issue

Breaking change in method signature without backward compatibility.

The setUserId method now requires a new parameter allowOverrideUserId, which could break existing client code. Consider providing an overloaded method with the original signature for backward compatibility.

// Add an overloaded method for backward compatibility
+ /**
+  * Sets the user id for the current user with the given [String].
+  * The SDK must be initialized before calling this method.
+  *
+  * ```
+  * Formbricks.setUserId("my_user_id")
+  * ```
+  *
+  */
+ fun setUserId(userId: String) {
+     setUserId(userId, false)
+ }
🧹 Nitpick comments (5)
android/src/main/java/com/formbricks/android/Formbricks.kt (5)

40-40: Consider adding a setter method for the callback property.

While the callback property is public and can be set directly, it would be more consistent with the SDK's design to provide a dedicated setter method with appropriate documentation, similar to other configuration methods in this class.

+ /**
+  * Sets the callback for receiving survey lifecycle events, errors, and success notifications.
+  * 
+  * ```
+  * Formbricks.setCallback(object : FormbricksCallback {
+  *     override fun onSurveyStarted() { /* ... */ }
+  *     override fun onSurveyFinished() { /* ... */ }
+  *     override fun onSurveyClosed() { /* ... */ }
+  *     override fun onPageCommitVisible() { /* ... */ }
+  *     override fun onError(error: Exception) { /* ... */ }
+  *     override fun onSuccess(successType: SuccessType) { /* ... */ }
+  * })
+  * ```
+  */
+ fun setCallback(callback: FormbricksCallback?) {
+     this.callback = callback
+ }

36-36: Add documentation for the autoDismissErrors property.

The autoDismissErrors property is introduced and initialized from the config, but there's no documentation explaining its purpose or behavior. Consider adding KDoc to explain how this property affects error handling in the SDK.

Also applies to: 76-76


182-182: Add documentation for the hiddenFields parameter in track method.

The track method now accepts an optional hiddenFields parameter that's passed to SurveyManager.track, but there's no documentation explaining what hidden fields are or how they're used. Consider updating the KDoc to clarify the purpose and usage of this parameter.

/**
 * Tracks an action with the given [String]. The SDK will process the action and it will present the survey if any of them can be triggered.
 * The SDK must be initialized before calling this method.
 *
+* @param action The action to track
+* @param hiddenFields Optional map of key-value pairs that will be passed to the survey but not visible to the end user
 *
 * ```
 * Formbricks.track("button_clicked")
+* // With hidden fields
+* Formbricks.track("purchase_completed", mapOf("order_id" to "12345", "amount" to 99.99))
 * ```
 *
 */

Also applies to: 197-197


236-236: Add documentation for the hiddenFields parameter in showSurvey method.

Similar to the track method, the showSurvey method now accepts an optional hiddenFields parameter, but there's no documentation explaining its purpose. Although this is an internal method, it would be helpful to add documentation for maintainers.

/// Assembles the survey fragment and presents it
+/// @param id The ID of the survey to show
+/// @param hiddenFields Optional map of key-value pairs that will be passed to the survey but not visible to the end user
internal fun showSurvey(id: String, hiddenFields: Map<String, Any>? = null) {

Also applies to: 245-245


217-217: Consider implementing consistent success callbacks across all methods.

The logout method now calls callback?.onSuccess(SuccessType.LOGOUT_SUCCESS) to notify successful logout, which is a good improvement. Consider implementing similar success notifications for other methods like setUserId, setAttribute, setAttributes, etc., to provide a consistent notification pattern.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3670964 and 4f8ce2e.

📒 Files selected for processing (1)
  • android/src/main/java/com/formbricks/android/Formbricks.kt (11 hunks)
🔇 Additional comments (2)
android/src/main/java/com/formbricks/android/Formbricks.kt (2)

18-26: Good addition of FormbricksCallback interface.

The introduction of this callback interface provides a structured way for client applications to handle survey lifecycle events, errors, and success notifications. The interface methods are well-named and clearly indicate their purpose.


65-65: Good error reporting through callbacks.

The consistent addition of error callbacks throughout the SDK methods provides a uniform way for client applications to handle errors. This is a significant improvement to the error handling mechanism.

Also applies to: 100-100, 107-107, 127-127, 146-146, 165-165, 185-185, 192-192, 212-212, 239-239

@mattinannt mattinannt enabled auto-merge May 22, 2025 10:35
@mattinannt mattinannt disabled auto-merge May 22, 2025 10:35
@mattinannt
Copy link
Member

@longvantruong The merge target for this PR is the main branch. Please update the PR to use the mobile-sdk-custom branch as target :-)

@longvantruong longvantruong force-pushed the longtv/mobile-sdk-custom branch from 4f8ce2e to 67b1528 Compare May 23, 2025 09:45
@longvantruong longvantruong changed the base branch from main to mobile-sdk-custom May 23, 2025 10:01
@longvantruong longvantruong changed the base branch from mobile-sdk-custom to main May 24, 2025 04:28
@mattinannt mattinannt changed the base branch from main to mobile-sdk-custom May 24, 2025 08:08
@mattinannt mattinannt merged commit 574d159 into formbricks:mobile-sdk-custom May 24, 2025
2 checks passed
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