Panagiotis Triantafyllou

bug fix inside Warply

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc7'
PUBLISH_VERSION = '4.5.4.6rc8'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -129,13 +129,14 @@ public enum Warply {
@Override
public void onInit(Context context) {
INSTANCE.mContext = new WeakReference<>(context.getApplicationContext());
initInternal(context);
}
});
}
private static void initInternal(Context context) {
if (isInitialized()) {
if (/*isInitialized()*/ context == null) {
INSTANCE.check();
return;
}
......@@ -992,9 +993,9 @@ public enum Warply {
}
private void check() {
// if (mContext == null) {
// return;
// }
if (mContext == null) {
return;
}
if (!WarpUtils.isRegisteredWarply(mContext.get())) {
registerWarply();
return;
......
......@@ -51,7 +51,7 @@ public class PermissionsUtil{
private String[] requestedPerms;
private PermissionCallback callback;
private WarplyPreferences prefs = new WarplyPreferences(Warply.getWarplyContext());
private WarplyPreferences prefs;
private Handler handler;
// ===========================================================
......@@ -60,7 +60,7 @@ public class PermissionsUtil{
public PermissionsUtil(@NonNull Context context,
@Nullable PermissionCallback callback,
@Nullable String... requestedPerms) {
this.prefs = new WarplyPreferences(context);
this.context = new WeakReference<>(context);
this.callback = callback;
this.requestedPerms = requestedPerms;
......
......@@ -877,6 +877,13 @@ public class WarplyManagerHelper {
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
}
public static void clearCCMSLoyaltyCampaigns() {
mCCMSList.clear();
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
}
/**
* Get the List with CCMS Campaigns
*/
......
......@@ -562,6 +562,7 @@ public class WarplyManager {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
WarpUtils.setUserTag(Warply.getWarplyContext(), "");
WarplyManagerHelper.clearCCMSLoyaltyCampaigns();
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
......