Skip to content

Commit

Permalink
Fix null parse
Browse files Browse the repository at this point in the history
  • Loading branch information
gdeluna-branch committed Jan 31, 2025
1 parent 3812f8b commit 9515354
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public final class CustomBranchApp extends Application {
public void onCreate() {
super.onCreate();

IBranchLoggingCallbacks loggingCallbacks = (message, tag) -> {
Log.d("BranchTestbed", message);
saveLogToFile(message);
};
Branch.enableLogging(loggingCallbacks);
// IBranchLoggingCallbacks loggingCallbacks = (message, tag) -> {
// Log.d("BranchTestbed", message);
// saveLogToFile(message);
// };
Branch.enableLogging(BranchLogger.BranchLogLevel.VERBOSE);

Branch.getAutoInstance(this);
}
Expand All @@ -44,6 +44,4 @@ private void saveLogToFile(String logMessage) {
Log.e("BranchTestbed", "Error writing to log file", e);
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ protected void onStart() {
// Please look for "BranchSDK_Doctor" in the logcat to see the results.
// IMP : Do not make this call in your production app

IntegrationValidator.validate(MainActivity.this);
//IntegrationValidator.validate(MainActivity.this);
}


Expand Down
4 changes: 2 additions & 2 deletions Branch-SDK/src/main/java/io/branch/referral/Branch.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ synchronized public static Branch getAutoInstance(@NonNull Context context) {

BranchUtil.setFbAppIdFromConfig(context);

BranchUtil.setCPPLevel(context);
BranchUtil.setCPPLevelFromConfig(context);

BranchUtil.setTestMode(BranchUtil.checkTestMode(context));
branchReferral_ = initBranchSDK(context, BranchUtil.readBranchKey(context));
Expand Down Expand Up @@ -412,7 +412,7 @@ public static Branch getAutoInstance(@NonNull Context context, @NonNull String b

BranchUtil.setAPIBaseUrlFromConfig(context);
BranchUtil.setFbAppIdFromConfig(context);
BranchUtil.setCPPLevel(context);
BranchUtil.setCPPLevelFromConfig(context);
BranchUtil.setTestMode(BranchUtil.checkTestMode(context));
// If a Branch key is passed already use it. Else read the key
if (!isValidBranchKey(branchKey)) {
Expand Down
12 changes: 8 additions & 4 deletions Branch-SDK/src/main/java/io/branch/referral/BranchUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Objects;
import java.util.jar.JarFile;

/**
Expand Down Expand Up @@ -156,10 +155,15 @@ public static void setFbAppIdFromConfig(Context context) {
}
}

public static void setCPPLevel(Context context) {
public static void setCPPLevelFromConfig(Context context) {
BranchJsonConfig jsonConfig = BranchJsonConfig.getInstance(context);
Defines.BranchAttributionLevel cppLevel = Defines.BranchAttributionLevel.valueOf(jsonConfig.getConsumerProtectionAttributionLevel());
Branch.getInstance().setConsumerProtectionAttributionLevel(cppLevel);
String jsonString = jsonConfig.getConsumerProtectionAttributionLevel();

// If there is no entry, do not change the setting or any default behavior.
if(!TextUtils.isEmpty(jsonString)) {
Defines.BranchAttributionLevel cppLevel = Defines.BranchAttributionLevel.valueOf(jsonString);
Branch.getInstance().setConsumerProtectionAttributionLevel(cppLevel);
}
}

/**
Expand Down

0 comments on commit 9515354

Please sign in to comment.