Panagiotis Triantafyllou

revert session impl, crash fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc40'
PUBLISH_VERSION = '4.5.4.6rc41'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -119,7 +119,7 @@ public class DiskBasedCache implements Cache {
byte[] data = streamToBytes(cis, (int) Math.abs((int)(file.length() - cis.bytesRead)));
// byte[] data = readAllBytes(cis);
return entry.toCacheEntry(data);
} catch (IOException e) {
} catch (IOException | NegativeArraySizeException e) {
VolleyLog.d("%s: %s", file.getAbsolutePath(), e.toString());
remove(key);
return null;
......@@ -315,11 +315,11 @@ public class DiskBasedCache implements Cache {
/**
* Reads the contents of an InputStream into a byte[].
* */
private static byte[] streamToBytes(InputStream in, int length) throws IOException {
private static byte[] streamToBytes(InputStream in, int length) throws IOException, NegativeArraySizeException {
byte[] bytes = new byte[1];
try {
bytes = IOUtils.toByteArray(in);
} catch (OutOfMemoryError e) {
} catch (OutOfMemoryError | NegativeArraySizeException e) {
e.printStackTrace();
}
int count;
......
......@@ -63,7 +63,7 @@ public class WarplyProperty {
Properties properties = new Properties();
properties.load(context.getResources().getAssets().open(PROPERTIES_FILE));
return properties.getProperty(propertyKey);
} catch (IOException e) {
} catch (IOException | NullPointerException e) {
WarpUtils.log(e.getMessage());
return "";
}
......
......@@ -87,7 +87,6 @@ import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.CouponsetsList;
import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantCategoriesList;
import ly.warp.sdk.io.models.MerchantList;
......@@ -544,31 +543,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getConsumer(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_profile_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getConsumer(request, receiver);
else
receiver.onFailure(status);
}
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_profile_loyalty");
......@@ -592,19 +581,6 @@ public class WarplyManager {
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
try {
WarpUtils.log("=================== TOKEN DELETED =========================");
WarpUtils.log("Auth Table Not Empty: " + String.valueOf(WarplyDBHelper.getInstance(Warply.getWarplyContext()).isTableNotEmpty("auth")));
WarpUtils.log("Bearer: " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
WarpUtils.log("=================== TOKEN DELETED =========================");
} catch (Exception e) {
e.printStackTrace();
WarpUtils.log("=================== TOKEN DELETED =========================");
WarpUtils.log("Auth Table Not Empty: false");
WarpUtils.log("Bearer: ");
WarpUtils.log("=================== TOKEN DELETED =========================");
}
JSONObject newResult = new JSONObject();
try {
newResult.putOpt("status", 1);
......@@ -999,30 +975,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getUserCoupons(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getUserCoupons(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
......@@ -1454,30 +1421,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// redeemCoupon(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
redeemCoupon(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_coupon_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_coupon_loyalty");
......@@ -1652,30 +1610,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getCampaignsPersonalized(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getCampaignsPersonalized(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_personalized_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_campaigns_personalized_loyalty");
......@@ -1712,30 +1661,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// consumerIntegration(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
consumerIntegration(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_customer_state_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_customer_state_loyalty");
......@@ -1771,30 +1711,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// cosmoteSharing(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
cosmoteSharing(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_loyalty");
......@@ -1830,30 +1761,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// cosmoteRetrieveSharing(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
cosmoteRetrieveSharing(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_sharing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_retrieve_sharing_loyalty");
......@@ -1894,30 +1816,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getPacingDetails(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getPacingDetails(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_pacing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_pacing_loyalty");
......@@ -1954,30 +1867,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// cosmoteCouponSharing(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
cosmoteCouponSharing(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_coupon_sharing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_coupon_sharing_loyalty");
......@@ -2050,30 +1954,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getUserCoupons(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getUserCoupons(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else
receiver.onFailure(errorCode);
}
......@@ -2246,15 +2141,6 @@ public class WarplyManager {
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else if (responseCoupons.code() == 401) {
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(responseCoupons.code());
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_user_coupons_loyalty");
......@@ -2437,23 +2323,21 @@ public class WarplyManager {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
if (response.code() == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getUserCouponsRetro(service, callback);
// else
// callback.onFailure(call, new Throwable());
// }
//
// @Override
// public void onFailure(int errorCode) {
// callback.onFailure(call, new Throwable());
// }
// });
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getUserCouponsRetro(service, callback);
else
callback.onFailure(call, new Throwable());
}
callback.onResponse(call, response);
@Override
public void onFailure(int errorCode) {
callback.onFailure(call, new Throwable());
}
});
} else {
callback.onResponse(call, response);
}
......@@ -2584,30 +2468,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// submitOrder(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
submitOrder(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_submit_order_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_submit_order_loyalty");
......@@ -2635,30 +2510,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// getSharingHistory(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getSharingHistory(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_history_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_sharing_history_loyalty");
......@@ -2695,30 +2561,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// postEvent(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
postEvent(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_post_event_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_post_event_loyalty");
......@@ -2754,30 +2611,21 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
if (errorCode == 401) {
// refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1)
// setPacingDetails(request, receiver);
// else
// receiver.onFailure(status);
// }
//
// @Override
// public void onFailure(int errorCode) {
// receiver.onFailure(errorCode);
// }
// });
LoyaltySDKSessionExpiredEventModel sessionExpired = new LoyaltySDKSessionExpiredEventModel();
sessionExpired.setLoyaltySessionExpired(true);
EventBus.getDefault().post(new WarplyEventBusManager(sessionExpired));
refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
setPacingDetails(request, receiver);
else
receiver.onFailure(status);
}
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_save_pacing_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_save_pacing_loyalty");
......