|
33 | 33 | import io.branch.referral.util.ProductCategory;
|
34 | 34 | import io.branch.referral.util.ShareSheetStyle;
|
35 | 35 |
|
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; |
38 | 39 |
|
39 | 40 | public class BranchSDK extends CordovaPlugin {
|
40 | 41 |
|
@@ -265,11 +266,11 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
|
265 | 266 | }
|
266 | 267 |
|
267 | 268 | public void crossPlatformIds(CallbackContext callbackContext) {
|
268 |
| -// this.instance.getCrossPlatformIds(new BranchCPIDListener(callbackContext)); |
| 269 | + this.instance.getCrossPlatformIds(new BranchCPIDListener(callbackContext)); |
269 | 270 | }
|
270 | 271 |
|
271 | 272 | public void lastAttributedTouchData(CallbackContext callbackContext) {
|
272 |
| -// this.instance.getLastAttributedTouchData(new BranchLATDListener(callbackContext), 30); |
| 273 | + this.instance.getLastAttributedTouchData(new BranchLATDListener(callbackContext), 30); |
273 | 274 | }
|
274 | 275 |
|
275 | 276 | //////////////////////////////////////////////////
|
@@ -893,59 +894,59 @@ public BranchUniversalObjectWrapper(BranchUniversalObject branchUniversalObj) {
|
893 | 894 | //----------- INNER CLASS LISTENERS ------------//
|
894 | 895 | //////////////////////////////////////////////////
|
895 | 896 |
|
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 | + } |
949 | 950 |
|
950 | 951 | protected class BranchViewEventsListener implements BranchViewHandler.IBranchViewEvents {
|
951 | 952 |
|
|
0 commit comments