Skip to content

Commit 291d941

Browse files
Check and clear invalid cached link click ids (#1315)
* Check and clear invalid cached link click ids * Update ServerRequestInitSession.java * Update ServerRequestInitSession.java * Update ServerRequestInitSession.java * Update ServerRequestInitSession.java
1 parent 7e2e65e commit 291d941

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ public String getExternalIntentExtra() {
680680
* link.
681681
*/
682682
public void setLinkClickIdentifier(String identifier) {
683+
BranchLogger.v("setLinkClickIdentifier: " + identifier);
683684
setString(KEY_LINK_CLICK_IDENTIFIER, identifier);
684685
}
685686

@@ -1336,6 +1337,7 @@ public void setBool(String key, Boolean value) {
13361337
* Should be called before setting a new Branch-Key. </p>
13371338
*/
13381339
private void clearPrefOnBranchKeyChange() {
1340+
BranchLogger.v("clearPrefOnBranchKeyChange");
13391341
// If stored key isn't the same as the current key, we need to clean up
13401342
// Note: Link Click Identifier is not cleared because of the potential for that to mess up a deep link
13411343
String linkClickID = getLinkClickID();

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ void onInitSessionCompleted(ServerResponse response, Branch branch) {
106106
*/
107107
void updateLinkReferrerParams() {
108108
// Add link identifier if present
109+
BranchLogger.v("updateLinkReferrerParams retrieved " + prefHelper_.getLinkClickIdentifier());
110+
111+
// If there is corrupted link click id info locally stored we need to reset it
112+
// to allow for a successful response
113+
if(prefHelper_.getLinkClickIdentifier() == null || TextUtils.isEmpty(prefHelper_.getLinkClickIdentifier().trim())){
114+
BranchLogger.v("linkIdentifier is null or empty, resetting to bnc_no_value");
115+
prefHelper_.setLinkClickIdentifier(NO_STRING_VALUE);
116+
prefHelper_.setLinkClickID(NO_STRING_VALUE);
117+
}
118+
109119
String linkIdentifier = prefHelper_.getLinkClickIdentifier();
110120
if (!linkIdentifier.equals(NO_STRING_VALUE)) {
111121
try {

0 commit comments

Comments
 (0)