@@ -170,19 +170,6 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
170
170
} else if (action .equals ("logout" )) {
171
171
cordova .getActivity ().runOnUiThread (r );
172
172
return true ;
173
- } else if (action .equals ("loadRewards" )) {
174
- cordova .getActivity ().runOnUiThread (r );
175
- return true ;
176
- } else if (action .equals ("redeemRewards" )) {
177
- if (args .length () < 1 && args .length () > 2 ) {
178
- callbackContext .error (String .format ("Parameter mismatched. 1-2 is required but %d is given" , args .length ()));
179
- return false ;
180
- }
181
- cordova .getActivity ().runOnUiThread (r );
182
- return true ;
183
- } else if (action .equals ("getCreditHistory" )) {
184
- cordova .getActivity ().runOnUiThread (r );
185
- return true ;
186
173
} else if (action .equals ("createBranchUniversalObject" )) {
187
174
if (args .length () != 1 ) {
188
175
callbackContext .error (String .format ("Parameter mismatched. 1 is required but %d is given" , args .length ()));
@@ -305,64 +292,6 @@ private void logout(CallbackContext callbackContext) {
305
292
306
293
}
307
294
308
- /**
309
- * <p>Redeems the specified number of credits from the "default" bucket, if there are sufficient
310
- * credits within it. If the number to redeem exceeds the number available in the bucket, all of
311
- * the available credits will be redeemed instead.</p>
312
- *
313
- * @param value An {@link Integer} specifying the number of credits to attempt to redeem from
314
- * the bucket.
315
- * @param callbackContext A callback to execute at the end of this method
316
- */
317
- private void redeemRewards (final int value , CallbackContext callbackContext ) {
318
-
319
- this .instance .redeemRewards (value , new RedeemRewardsListener (callbackContext ));
320
-
321
- }
322
-
323
- /**
324
- * <p>Redeems the specified number of credits from the "default" bucket, if there are sufficient
325
- * credits within it. If the number to redeem exceeds the number available in the bucket, all of
326
- * the available credits will be redeemed instead.</p>
327
- *
328
- * @param value An {@link Integer} specifying the number of credits to attempt to redeem from
329
- * the bucket.
330
- * @param bucket The name of the bucket to remove the credits from.
331
- * @param callbackContext A callback to execute at the end of this method
332
- */
333
- private void redeemRewards (int value , String bucket , CallbackContext callbackContext ) {
334
-
335
- this .instance .redeemRewards (bucket , value , new RedeemRewardsListener (callbackContext ));
336
-
337
- }
338
-
339
- /**
340
- * <p>Retrieves rewards for the current session, with a callback to perform a predefined
341
- * action following successful report of state change. You'll then need to call getCredits
342
- * in the callback to update the credit totals in your UX.</p>
343
- *
344
- * @param callbackContext A callback to execute at the end of this method
345
- * @param bucket Load reward of a specific bucket
346
- */
347
- private void loadRewards (String bucket , CallbackContext callbackContext ) {
348
-
349
- this .instance .loadRewards (new LoadRewardsListener (bucket , callbackContext , this .instance ));
350
-
351
- }
352
-
353
- /**
354
- * <p>Retrieves rewards for the current session, with a callback to perform a predefined
355
- * action following successful report of state change. You'll then need to call getCredits
356
- * in the callback to update the credit totals in your UX.</p>
357
- *
358
- * @param callbackContext A callback to execute at the end of this method
359
- */
360
- private void loadRewards (CallbackContext callbackContext ) {
361
-
362
- this .instance .loadRewards (new LoadRewardsListener (callbackContext , this .instance ));
363
-
364
- }
365
-
366
295
/**
367
296
* <p>Returns the parameters associated with the link that referred the session. If a user
368
297
* clicks a link, and then opens the app, initSession will return the paramters of the link
@@ -852,18 +781,6 @@ public void sendBranchEvent(String eventName, JSONObject metaData, CallbackConte
852
781
//callbackContext.success();
853
782
}
854
783
855
- /**
856
- * <p>Gets the credit history of the specified bucket and triggers a callback to handle the
857
- * response.</p>
858
- *
859
- * @param callbackContext A callback to execute at the end of this method
860
- */
861
- private void getCreditHistory (CallbackContext callbackContext ) {
862
-
863
- this .instance .getCreditHistory (new CreditHistoryListener (callbackContext ));
864
-
865
- }
866
-
867
784
/**
868
785
* @access protected
869
786
* @class BranchUniversalObjectWrapper
@@ -1097,78 +1014,6 @@ public void onRegisterViewFinished(boolean registered, BranchError error) {
1097
1014
}
1098
1015
}
1099
1016
1100
- protected class LoadRewardsListener implements Branch .BranchReferralStateChangedListener {
1101
- private CallbackContext _callbackContext ;
1102
- private Branch _instance ;
1103
- private String _bucket ;
1104
-
1105
- public LoadRewardsListener (String bucket , CallbackContext callbackContext , Branch instance ) {
1106
- this ._callbackContext = callbackContext ;
1107
- this ._instance = instance ;
1108
- this ._bucket = bucket ;
1109
- }
1110
-
1111
- public LoadRewardsListener (CallbackContext callbackContext , Branch instance ) {
1112
- this ._callbackContext = callbackContext ;
1113
- this ._instance = instance ;
1114
- this ._bucket = "" ;
1115
- }
1116
-
1117
- // Listener that implements BranchReferralStateChangedListener for loadRewards
1118
- @ Override
1119
- public void onStateChanged (boolean changed , BranchError error ) {
1120
- if (error == null ) {
1121
-
1122
- int credits = 0 ;
1123
-
1124
- if (this ._bucket .length () > 0 ) {
1125
- credits = this ._instance .getCreditsForBucket (this ._bucket );
1126
- } else {
1127
- credits = this ._instance .getCredits ();
1128
- }
1129
-
1130
- this ._callbackContext .success (credits );
1131
-
1132
- } else {
1133
-
1134
- String errorMessage = error .getMessage ();
1135
-
1136
- Log .d (LCAT , errorMessage );
1137
-
1138
- this ._callbackContext .error (errorMessage );
1139
-
1140
- }
1141
-
1142
- }
1143
- }
1144
-
1145
- protected class RedeemRewardsListener implements Branch .BranchReferralStateChangedListener {
1146
- private CallbackContext _callbackContext ;
1147
-
1148
- // Constructor that takes in a required callbackContext object
1149
- public RedeemRewardsListener (CallbackContext callbackContext ) {
1150
- this ._callbackContext = callbackContext ;
1151
- }
1152
-
1153
- // Listener that implements BranchReferralStateChangedListener for redeemRewards
1154
- @ Override
1155
- public void onStateChanged (boolean changed , BranchError error ) {
1156
-
1157
- if (error == null ) {
1158
-
1159
- this ._callbackContext .sendPluginResult (new PluginResult (PluginResult .Status .OK , /* send boolean: is changed */ changed ));
1160
-
1161
- } else {
1162
-
1163
- String errorMessage = error .getMessage ();
1164
-
1165
- Log .d (LCAT , errorMessage );
1166
-
1167
- this ._callbackContext .error (errorMessage );
1168
- }
1169
- }
1170
- }
1171
-
1172
1017
protected class GenerateShortUrlListener implements Branch .BranchLinkCreateListener {
1173
1018
private CallbackContext _callbackContext ;
1174
1019
@@ -1342,64 +1187,6 @@ public void onChannelSelected(String channelName) {
1342
1187
}
1343
1188
}
1344
1189
1345
- protected class CreditHistoryListener implements Branch .BranchListResponseListener {
1346
- private CallbackContext _callbackContext ;
1347
-
1348
- // Constructor that takes in a required callbackContext object
1349
- public CreditHistoryListener (CallbackContext callbackContext ) {
1350
- this ._callbackContext = callbackContext ;
1351
- }
1352
-
1353
- // Listener that implements BranchListResponseListener for getCreditHistory()
1354
- @ Override
1355
- public void onReceivingResponse (JSONArray list , BranchError error ) {
1356
-
1357
- ArrayList <String > errors = new ArrayList <String >();
1358
-
1359
- if (error == null ) {
1360
-
1361
- JSONArray data = new JSONArray ();
1362
-
1363
- if (list != null ) {
1364
-
1365
- for (int i = 0 , limit = list .length (); i < limit ; ++i ) {
1366
-
1367
- JSONObject entry ;
1368
-
1369
- try {
1370
- entry = list .getJSONObject (i );
1371
- data .put (entry );
1372
- } catch (JSONException e ) {
1373
- e .printStackTrace ();
1374
- errors .add (e .getMessage ());
1375
- }
1376
-
1377
- }
1378
-
1379
- }
1380
-
1381
- if (errors .size () > 0 ) {
1382
- StringBuilder sb = new StringBuilder ();
1383
- for (String s : errors ) {
1384
- sb .append (s );
1385
- sb .append ("\n " );
1386
- }
1387
- this ._callbackContext .error (sb .toString ());
1388
- } else {
1389
- this ._callbackContext .success (data );
1390
- }
1391
- } else {
1392
-
1393
- String errorMessage = error .getMessage ();
1394
-
1395
- Log .d (LCAT , errorMessage );
1396
-
1397
- this ._callbackContext .error (errorMessage );
1398
-
1399
- }
1400
- }
1401
- }
1402
-
1403
1190
protected class RunnableThread implements Runnable {
1404
1191
1405
1192
private String action ;
@@ -1449,20 +1236,6 @@ public void run() {
1449
1236
getLatestReferringParams (this .callbackContext );
1450
1237
} else if (this .action .equals ("logout" )) {
1451
1238
logout (this .callbackContext );
1452
- } else if (this .action .equals ("loadRewards" )) {
1453
- if (this .args .length () == 1 ) {
1454
- loadRewards (this .args .getString (0 ), this .callbackContext );
1455
- } else {
1456
- loadRewards (this .callbackContext );
1457
- }
1458
- } else if (this .action .equals ("redeemRewards" )) {
1459
- if (this .args .length () == 1 ) {
1460
- redeemRewards (this .args .getInt (0 ), this .callbackContext );
1461
- } else if (this .args .length () == 2 ) {
1462
- redeemRewards (this .args .getInt (0 ), this .args .getString (1 ), this .callbackContext );
1463
- }
1464
- } else if (this .action .equals ("getCreditHistory" )) {
1465
- getCreditHistory (this .callbackContext );
1466
1239
} else if (this .action .equals ("createBranchUniversalObject" )) {
1467
1240
createBranchUniversalObject (this .args .getJSONObject (0 ), this .callbackContext );
1468
1241
} else if (this .action .equals ("crossPlatformIds" )) {
0 commit comments