Skip to content

Commit ceae29e

Browse files
fix signatures for cpid and latd
1 parent 6dfa497 commit ceae29e

File tree

1 file changed

+58
-57
lines changed

1 file changed

+58
-57
lines changed

src/android/io/branch/BranchSDK.java

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
import io.branch.referral.util.ProductCategory;
3434
import io.branch.referral.util.ShareSheetStyle;
3535

36-
//import io.branch.referral.util.BranchCrossPlatformId;
37-
//import io.branch.referral.util.BranchLastAttributedTouchData;
36+
import io.branch.referral.ServerRequestGetLATD.BranchLastAttributedTouchDataListener;
37+
import io.branch.referral.ServerRequestGetCPID.BranchCrossPlatformIdListener;
38+
import io.branch.referral.util.BranchCPID;
3839

3940
public class BranchSDK extends CordovaPlugin {
4041

@@ -265,11 +266,11 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
265266
}
266267

267268
public void crossPlatformIds(CallbackContext callbackContext) {
268-
// this.instance.getCrossPlatformIds(new BranchCPIDListener(callbackContext));
269+
this.instance.getCrossPlatformIds(new BranchCPIDListener(callbackContext));
269270
}
270271

271272
public void lastAttributedTouchData(CallbackContext callbackContext) {
272-
// this.instance.getLastAttributedTouchData(new BranchLATDListener(callbackContext), 30);
273+
this.instance.getLastAttributedTouchData(new BranchLATDListener(callbackContext), 30);
273274
}
274275

275276
//////////////////////////////////////////////////
@@ -893,59 +894,59 @@ public BranchUniversalObjectWrapper(BranchUniversalObject branchUniversalObj) {
893894
//----------- INNER CLASS LISTENERS ------------//
894895
//////////////////////////////////////////////////
895896

896-
// protected class BranchCPIDListener implements BranchCrossPlatformId.BranchCrossPlatformIdListener {
897-
// private CallbackContext _callbackContext;
898-
//
899-
// public BranchCPIDListener(CallbackContext callbackContext) {
900-
// this._callbackContext = callbackContext;
901-
// }
902-
//
903-
// @Override
904-
// public void onDataFetched(BranchCrossPlatformId.BranchCPID branchCPID, BranchError error) {
905-
// if (error != null) {
906-
// Log.d(LCAT, "CPID unavailable");
907-
// this._callbackContext.error("CPID unavailable");
908-
// } else {
909-
//
910-
// JSONObject jsonObject = new JSONObject();
911-
// try {
912-
// jsonObject.put("developer_identity", branchCPID.getDeveloperIdentity());
913-
// jsonObject.put("cross_platform_id", branchCPID.getCrossPlatformID());
914-
// jsonObject.put("past_cross_platform_ids", branchCPID.getPastCrossPlatformIds());
915-
// jsonObject.put("prob_cross_platform_ids", branchCPID.getProbabilisticCrossPlatformIds());
916-
// } catch (JSONException e) {
917-
// // just send back and empty object on json error
918-
// jsonObject = new JSONObject();
919-
// }
920-
//
921-
// Log.d(LCAT, jsonObject.toString());
922-
//
923-
// PluginResult result = new PluginResult(PluginResult.Status.OK, jsonObject);
924-
// this._callbackContext.sendPluginResult(result);
925-
// }
926-
// }
927-
// }
928-
//
929-
// protected class BranchLATDListener implements BranchLastAttributedTouchData.BranchLastAttributedTouchDataListener {
930-
// private CallbackContext _callbackContext;
931-
//
932-
// public BranchLATDListener(CallbackContext callbackContext) {
933-
// this._callbackContext = callbackContext;
934-
// }
935-
//
936-
// @Override
937-
// public void onDataFetched(JSONObject jsonObject, BranchError error) {
938-
// if (error != null) {
939-
// Log.d(LCAT, "LATD unavailable");
940-
// this._callbackContext.error("LATD unavailable");
941-
// } else {
942-
// Log.d(LCAT, jsonObject.toString());
943-
//
944-
// PluginResult result = new PluginResult(PluginResult.Status.OK, jsonObject);
945-
// this._callbackContext.sendPluginResult(result);
946-
// }
947-
// }
948-
// }
897+
protected class BranchCPIDListener implements BranchCrossPlatformIdListener {
898+
private CallbackContext _callbackContext;
899+
900+
public BranchCPIDListener(CallbackContext callbackContext) {
901+
this._callbackContext = callbackContext;
902+
}
903+
904+
@Override
905+
public void onDataFetched(BranchCPID branchCPID, BranchError error) {
906+
if (error != null) {
907+
Log.d(LCAT, "CPID unavailable");
908+
this._callbackContext.error("CPID unavailable");
909+
} else {
910+
911+
JSONObject jsonObject = new JSONObject();
912+
try {
913+
jsonObject.put("developer_identity", branchCPID.getDeveloperIdentity());
914+
jsonObject.put("cross_platform_id", branchCPID.getCrossPlatformID());
915+
jsonObject.put("past_cross_platform_ids", branchCPID.getPastCrossPlatformIds());
916+
jsonObject.put("prob_cross_platform_ids", branchCPID.getProbabilisticCrossPlatformIds());
917+
} catch (JSONException e) {
918+
// just send back and empty object on json error
919+
jsonObject = new JSONObject();
920+
}
921+
922+
Log.d(LCAT, jsonObject.toString());
923+
924+
PluginResult result = new PluginResult(PluginResult.Status.OK, jsonObject);
925+
this._callbackContext.sendPluginResult(result);
926+
}
927+
}
928+
}
929+
930+
protected class BranchLATDListener implements BranchLastAttributedTouchDataListener {
931+
private CallbackContext _callbackContext;
932+
933+
public BranchLATDListener(CallbackContext callbackContext) {
934+
this._callbackContext = callbackContext;
935+
}
936+
937+
@Override
938+
public void onDataFetched(JSONObject jsonObject, BranchError error) {
939+
if (error != null) {
940+
Log.d(LCAT, "LATD unavailable");
941+
this._callbackContext.error("LATD unavailable");
942+
} else {
943+
Log.d(LCAT, jsonObject.toString());
944+
945+
PluginResult result = new PluginResult(PluginResult.Status.OK, jsonObject);
946+
this._callbackContext.sendPluginResult(result);
947+
}
948+
}
949+
}
949950

950951
protected class BranchViewEventsListener implements BranchViewHandler.IBranchViewEvents {
951952

0 commit comments

Comments
 (0)