Skip to content

Commit 36c5adc

Browse files
author
Aaron Lopez
authored
Merge pull request #614 from BranchMetrics/Staging
RC 2.19.4
2 parents dbb8d8e + 720a4f8 commit 36c5adc

12 files changed

+63
-20
lines changed
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fabric-identifier=io.branch.sdk.android.library
2-
fabric-version=2.19.3
2+
fabric-version=2.19.4
33
fabric-build-type=source

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,21 +1413,35 @@ private boolean readAndStripParam(Uri data, Activity activity) {
14131413
e.printStackTrace();
14141414
}
14151415
}
1416-
} else { // if not check the intent data to see if there is deep link params
1417-
if (!TextUtils.isEmpty(intent.getStringExtra(Defines.Jsonkey.BranchData.getKey()))) {
1418-
try {
1419-
String rawBranchData = intent.getStringExtra(Defines.Jsonkey.BranchData.getKey());
1420-
// Make sure the data received is complete and in correct format
1421-
JSONObject branchDataJson = new JSONObject(rawBranchData);
1422-
branchDataJson.put(Defines.Jsonkey.Clicked_Branch_Link.getKey(), true);
1423-
prefHelper_.setSessionParams(branchDataJson.toString());
1424-
isInstantDeepLinkPossible = true;
1425-
} catch (JSONException e) {
1426-
e.printStackTrace();
1416+
}
1417+
// If not check the intent data to see if there is deep link params
1418+
else if (!TextUtils.isEmpty(intent.getStringExtra(Defines.Jsonkey.BranchData.getKey()))) {
1419+
try {
1420+
String rawBranchData = intent.getStringExtra(Defines.Jsonkey.BranchData.getKey());
1421+
// Make sure the data received is complete and in correct format
1422+
JSONObject branchDataJson = new JSONObject(rawBranchData);
1423+
branchDataJson.put(Defines.Jsonkey.Clicked_Branch_Link.getKey(), true);
1424+
prefHelper_.setSessionParams(branchDataJson.toString());
1425+
isInstantDeepLinkPossible = true;
1426+
} catch (JSONException e) {
1427+
e.printStackTrace();
1428+
}
1429+
// Remove Branch data from the intent once used
1430+
intent.removeExtra(Defines.Jsonkey.BranchData.getKey());
1431+
activity.setIntent(intent);
1432+
}
1433+
// If instant key is true in query params, use them for instant deep linking
1434+
else if (data.getQueryParameterNames() != null && Boolean.valueOf(data.getQueryParameter(Defines.Jsonkey.Instant.getKey()))) {
1435+
try {
1436+
JSONObject branchDataJson = new JSONObject();
1437+
for (String key : data.getQueryParameterNames()) {
1438+
branchDataJson.put(key, data.getQueryParameter(key));
14271439
}
1428-
// Remove Branch data from the intent once used
1429-
intent.removeExtra(Defines.Jsonkey.BranchData.getKey());
1430-
activity.setIntent(intent);
1440+
branchDataJson.put(Defines.Jsonkey.Clicked_Branch_Link.getKey(), true);
1441+
prefHelper_.setSessionParams(branchDataJson.toString());
1442+
isInstantDeepLinkPossible = true;
1443+
} catch (JSONException e) {
1444+
e.printStackTrace();
14311445
}
14321446
}
14331447
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ public enum Jsonkey {
183183
ImageCaptions("$image_captions"),
184184
Condition("$condition"),
185185
CreationTimestamp("$creation_timestamp"),
186-
TrackingDisabled("tracking_disabled");
186+
TrackingDisabled("tracking_disabled"),
187+
Instant("instant");
187188

188189
private String key = "";
189190

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public JSONObject getPost() {
213213
* By default update GAds params update is turned off. Override this on request which need to have GAds params
214214
* </p>
215215
*
216-
* @return A {@link Boolean} with value true if this reuest need GAds params
216+
* @return A {@link Boolean} with value true if this request need GAds params
217217
*/
218218
public boolean isGAdsParamsRequired() {
219219
return false;
@@ -396,7 +396,7 @@ private void updateGAdsParams() {
396396
} catch (JSONException e) {
397397
e.printStackTrace();
398398
}
399-
} else { // Add unidentified_device when neither aaid nor AndoridID present
399+
} else { // Add unidentified_device when neither GAID nor AndroidID are present
400400
if (version == BRANCH_API_VERSION.V2) {
401401
try {
402402
if (version == BRANCH_API_VERSION.V2) {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ public void onRequestSucceeded(ServerResponse resp, Branch branch) {
8585
}
8686
}
8787

88+
@Override
89+
public boolean isGAdsParamsRequired() {
90+
return true;
91+
}
92+
8893
@Override
8994
public void handleFailure(int statusCode, String causeMsg) {
9095
//No implementation on purpose

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public void onRequestSucceeded(ServerResponse resp, Branch branch) {
8686
}
8787
}
8888

89+
@Override
90+
public boolean isGAdsParamsRequired() {
91+
return true;
92+
}
93+
8994
@Override
9095
public void handleFailure(int statusCode, String causeMsg) {
9196
//No implementation on purpose

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ class ServerRequestRegisterOpen extends ServerRequestInitSession {
4242
ServerRequestRegisterOpen(String requestPath, JSONObject post, Context context) {
4343
super(requestPath, post, context);
4444
}
45+
46+
@Override
47+
public void onPreExecute() {
48+
super.onPreExecute();
49+
// Instant Deep Link if possible
50+
if (Branch.getInstance().isInstantDeepLinkPossible) {
51+
callback_.onInitFinished(Branch.getInstance().getLatestReferringParams(), null);
52+
Branch.getInstance().addExtraInstrumentationData(Defines.Jsonkey.InstantDeepLinkSession.getKey(), "true");
53+
Branch.getInstance().isInstantDeepLinkPossible = false;
54+
Branch.getInstance().isInitReportedThroughCallBack = true;
55+
}
56+
}
4557

4658
@Override
4759
public void onRequestSucceeded(ServerResponse resp, Branch branch) {

Branch-SDK/src/io/branch/referral/util/BranchEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private class ServerRequestLogEvent extends ServerRequest {
226226
if (standardProperties.length() > 0) {
227227
reqBody.put(Defines.Jsonkey.EventData.getKey(), standardProperties);
228228
}
229-
if (isStandardEvent && buoList.size() > 0) {
229+
if (buoList.size() > 0) {
230230
JSONArray contentItemsArray = new JSONArray();
231231
reqBody.put(Defines.Jsonkey.ContentItems.getKey(), contentItemsArray);
232232
for (BranchUniversalObject buo : buoList) {

0 commit comments

Comments
 (0)