11package io.branch.referral
22
3+ import org.json.JSONException
34import org.json.JSONObject
45
56/* *
@@ -12,7 +13,7 @@ class BranchConfigurationController {
1213 * Sets whether delayed session initialization was used.
1314 * This flag is used to track if the app has used delayed session initialization,
1415 * which is important for analytics and debugging purposes.
15- *
16+ *
1617 * @param used Boolean indicating if delayed session initialization was used
1718 * @see Branch.expectDelayedSessionInitialization
1819 */
@@ -25,7 +26,7 @@ class BranchConfigurationController {
2526 /* *
2627 * Gets whether delayed session initialization was used.
2728 * This can be used to check if the app has previously used delayed session initialization.
28- *
29+ *
2930 * @return Boolean indicating if delayed session initialization was used
3031 * @see Branch.expectDelayedSessionInitialization
3132 */
@@ -35,7 +36,7 @@ class BranchConfigurationController {
3536
3637 /* *
3738 * Gets whether test mode is enabled.
38- *
39+ *
3940 * @return Boolean indicating if test mode is enabled
4041 */
4142 fun isTestModeEnabled (): Boolean {
@@ -44,7 +45,7 @@ class BranchConfigurationController {
4445
4546 /* *
4647 * Gets whether tracking is disabled.
47- *
48+ *
4849 * @return Boolean indicating if tracking is disabled
4950 */
5051 fun isTrackingDisabled (): Boolean {
@@ -55,7 +56,7 @@ class BranchConfigurationController {
5556 * Sets whether tracking should be disabled.
5657 * When tracking is disabled, the SDK will not track any user data or state,
5758 * and it will not initiate any network calls except for deep linking operations.
58- *
59+ *
5960 * @param disabled Boolean indicating if tracking should be disabled
6061 */
6162 fun setTrackingDisabled (disabled : Boolean ) {
@@ -66,7 +67,7 @@ class BranchConfigurationController {
6667 * Sets whether test mode should be enabled.
6768 * When test mode is enabled, the SDK will use test keys and endpoints.
6869 * This is useful for development and testing purposes.
69- *
70+ *
7071 * @param enabled Boolean indicating if test mode should be enabled
7172 */
7273 fun setTestModeEnabled (enabled : Boolean ) {
@@ -76,7 +77,7 @@ class BranchConfigurationController {
7677 /* *
7778 * Sets whether instant deep linking is enabled.
7879 * This flag controls whether the SDK should attempt to perform instant deep linking.
79- *
80+ *
8081 * @param enabled Boolean indicating if instant deep linking should be enabled
8182 */
8283 fun setInstantDeepLinkingEnabled (enabled : Boolean ) {
@@ -85,18 +86,19 @@ class BranchConfigurationController {
8586
8687 /* *
8788 * Gets whether instant deep linking is enabled.
88- *
89+ *
8990 * @return Boolean indicating if instant deep linking is enabled
9091 */
9192 fun isInstantDeepLinkingEnabled (): Boolean {
92- return Branch .getInstance()?.prefHelper_?.getBool(" bnc_instant_deep_linking_enabled" ) ? : false
93+ return Branch .getInstance()?.prefHelper_?.getBool(" bnc_instant_deep_linking_enabled" )
94+ ? : false
9395 }
9496
9597 /* *
9698 * Sets whether plugin runtime initialization should be deferred.
9799 * This is used for cross-process communication scenarios like React Native,
98100 * where we need to wait for the plugin to signal when it's ready before initializing.
99- *
101+ *
100102 * @param deferred Boolean indicating if plugin runtime initialization should be deferred
101103 */
102104 fun setDeferInitForPluginRuntime (deferred : Boolean ) {
@@ -105,38 +107,38 @@ class BranchConfigurationController {
105107
106108 /* *
107109 * Gets whether plugin runtime initialization is deferred.
108- *
110+ *
109111 * @return Boolean indicating if plugin runtime initialization is deferred
110112 */
111113 private fun isDeferInitForPluginRuntime (): Boolean {
112- return Branch .getInstance()?.prefHelper_?.getBool(" bnc_defer_init_for_plugin_runtime" ) ? : false
114+ return Branch .getInstance()?.prefHelper_?.getBool(" bnc_defer_init_for_plugin_runtime" )
115+ ? : false
113116 }
114117
115118 /* *
116119 * Serializes the current configuration state into a JSONObject.
117120 * This is used to send configuration data to the server.
118- *
121+ *
119122 * @return JSONObject containing the current configuration state
120123 */
121124 fun serializeConfiguration (): JSONObject {
122125 return try {
123126 JSONObject ().apply {
124- put(\ " expectDelayedSessionInitialization\ " , getDelayedSessionInitUsed())
125- put(\ " testMode\ " , isTestModeEnabled())
126- put(\ " trackingDisabled\ " , isTrackingDisabled())
127- put(\ " instantDeepLinkingEnabled\ " , isInstantDeepLinkingEnabled())
128- put(\ " deferInitForPluginRuntime\ " , isDeferInitForPluginRuntime())
127+ put(" expectDelayedSessionInitialization" , getDelayedSessionInitUsed())
128+ put(" testMode" , isTestModeEnabled())
129+ put(" trackingDisabled" , isTrackingDisabled())
130+ put(" instantDeepLinkingEnabled" , isInstantDeepLinkingEnabled())
131+ put(" deferInitForPluginRuntime" , isDeferInitForPluginRuntime())
129132 }
130133 } catch (e: NullPointerException ) {
131- BranchLogger.w(\ " Error serializing configuration - null reference: ${e.message} \ " )
134+ BranchLogger .w(" Error serializing configuration - null reference: ${e.message} " )
132135 JSONObject ()
133136 } catch (e: JSONException ) {
134- BranchLogger.w(\ " Error serializing configuration - JSON error: ${e.message} \ " )
137+ BranchLogger .w(" Error serializing configuration - JSON error: ${e.message} " )
135138 JSONObject ()
136139 } catch (e: Exception ) {
137- BranchLogger.w(\ " Error serializing configuration - unexpected error: ${e.message} \ " )
140+ BranchLogger .w(" Error serializing configuration - unexpected error: ${e.message} " )
138141 JSONObject ()
139142 }
140143 }
141- }
142- }
144+ }
0 commit comments