Panagiotis Triantafyllou

bug fix inside Warply

...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.4.6rc7' 5 + PUBLISH_VERSION = '4.5.4.6rc8'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -129,13 +129,14 @@ public enum Warply { ...@@ -129,13 +129,14 @@ public enum Warply {
129 129
130 @Override 130 @Override
131 public void onInit(Context context) { 131 public void onInit(Context context) {
132 + INSTANCE.mContext = new WeakReference<>(context.getApplicationContext());
132 initInternal(context); 133 initInternal(context);
133 } 134 }
134 }); 135 });
135 } 136 }
136 137
137 private static void initInternal(Context context) { 138 private static void initInternal(Context context) {
138 - if (isInitialized()) { 139 + if (/*isInitialized()*/ context == null) {
139 INSTANCE.check(); 140 INSTANCE.check();
140 return; 141 return;
141 } 142 }
...@@ -992,9 +993,9 @@ public enum Warply { ...@@ -992,9 +993,9 @@ public enum Warply {
992 } 993 }
993 994
994 private void check() { 995 private void check() {
995 -// if (mContext == null) { 996 + if (mContext == null) {
996 -// return; 997 + return;
997 -// } 998 + }
998 if (!WarpUtils.isRegisteredWarply(mContext.get())) { 999 if (!WarpUtils.isRegisteredWarply(mContext.get())) {
999 registerWarply(); 1000 registerWarply();
1000 return; 1001 return;
......
...@@ -51,7 +51,7 @@ public class PermissionsUtil{ ...@@ -51,7 +51,7 @@ public class PermissionsUtil{
51 private String[] requestedPerms; 51 private String[] requestedPerms;
52 private PermissionCallback callback; 52 private PermissionCallback callback;
53 53
54 - private WarplyPreferences prefs = new WarplyPreferences(Warply.getWarplyContext()); 54 + private WarplyPreferences prefs;
55 private Handler handler; 55 private Handler handler;
56 56
57 // =========================================================== 57 // ===========================================================
...@@ -60,7 +60,7 @@ public class PermissionsUtil{ ...@@ -60,7 +60,7 @@ public class PermissionsUtil{
60 public PermissionsUtil(@NonNull Context context, 60 public PermissionsUtil(@NonNull Context context,
61 @Nullable PermissionCallback callback, 61 @Nullable PermissionCallback callback,
62 @Nullable String... requestedPerms) { 62 @Nullable String... requestedPerms) {
63 - 63 + this.prefs = new WarplyPreferences(context);
64 this.context = new WeakReference<>(context); 64 this.context = new WeakReference<>(context);
65 this.callback = callback; 65 this.callback = callback;
66 this.requestedPerms = requestedPerms; 66 this.requestedPerms = requestedPerms;
......
...@@ -877,6 +877,13 @@ public class WarplyManagerHelper { ...@@ -877,6 +877,13 @@ public class WarplyManagerHelper {
877 WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); 877 WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
878 } 878 }
879 879
880 + public static void clearCCMSLoyaltyCampaigns() {
881 + mCCMSList.clear();
882 +
883 + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build();
884 + WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
885 + }
886 +
880 /** 887 /**
881 * Get the List with CCMS Campaigns 888 * Get the List with CCMS Campaigns
882 */ 889 */
......
...@@ -562,6 +562,7 @@ public class WarplyManager { ...@@ -562,6 +562,7 @@ public class WarplyManager {
562 562
563 WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); 563 WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
564 WarpUtils.setUserTag(Warply.getWarplyContext(), ""); 564 WarpUtils.setUserTag(Warply.getWarplyContext(), "");
565 + WarplyManagerHelper.clearCCMSLoyaltyCampaigns();
565 566
566 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth(); 567 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
567 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient(); 568 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
......