Skip to content

Commit 89ff6d3

Browse files
committed
Refactor session initialization checks and clean up unused methods
- Updated the order of conditions in expectDelayedSessionInitialization for clarity. - Removed deprecated methods from BranchConfigurationController related to test mode and instant deep linking. - Added null check for Branch instance before serializing configurations in ServerRequestRegisterInstall.
1 parent de4703e commit 89ff6d3

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

Branch-SDK/src/main/java/io/branch/referral/Branch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ public void disableAdNetworkCallouts(boolean disabled) {
511511
*/
512512
public static void expectDelayedSessionInitialization(boolean expectDelayedInit) {
513513
disableAutoSessionInitialization = expectDelayedInit;
514-
if (expectDelayedInit && Branch.getInstance() != null) {
514+
if (Branch.getInstance() != null && expectDelayedInit) {
515515
Branch.getInstance().branchConfigurationController_.setDelayedSessionInitUsed(true);
516516
}
517517
}

Branch-SDK/src/main/java/io/branch/referral/BranchConfigurationController.kt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ class BranchConfigurationController {
3333
return Branch.getInstance().prefHelper_.delayedSessionInitUsed
3434
}
3535

36-
/**
37-
* Sets whether test mode is enabled.
38-
* This flag is used to track if the app is running in test mode.
39-
*/
40-
fun setTestModeEnabled(enabled: Boolean) {
41-
if (enabled) {
42-
Branch.enableTestMode()
43-
} else {
44-
Branch.disableTestMode()
45-
}
46-
}
47-
4836
/**
4937
* Gets whether test mode is enabled.
5038
*
@@ -71,14 +59,6 @@ class BranchConfigurationController {
7159
return Branch.getInstance().prefHelper_.getBool("bnc_tracking_disabled")
7260
}
7361

74-
/**
75-
* Sets whether instant deep linking is enabled.
76-
* This flag is used to track if the app has enabled instant deep linking.
77-
*/
78-
fun setInstantDeepLinkingEnabled(enabled: Boolean) {
79-
Branch.getInstance().prefHelper_.setBool("bnc_instant_deep_linking_enabled", enabled)
80-
}
81-
8262
/**
8363
* Gets whether instant deep linking is enabled.
8464
*

Branch-SDK/src/main/java/io/branch/referral/ServerRequestRegisterInstall.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@ public void onPreExecute() {
6262
getPost().put(Defines.Jsonkey.InstallBeginServerTimeStamp.getKey(), installReferrerServerTS);
6363
}
6464

65-
JSONObject configurations = Branch.getInstance().getConfigurationController().serializeConfiguration();
66-
getPost().put("operational_metrics", configurations);
65+
if (Branch.getInstance() != null) {
66+
JSONObject configurations = Branch.getInstance().getConfigurationController().serializeConfiguration();
67+
getPost().put("operational_metrics", configurations);
68+
}
69+
6770
} catch (JSONException e) {
6871
BranchLogger.w("Caught JSONException " + e.getMessage());
6972
}

0 commit comments

Comments
 (0)