Panagiotis Triantafyllou

new keys

...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 # The app uuid the warply sdk need to connect to the engage server 3 # The app uuid the warply sdk need to connect to the engage server
4 # dev f83dfde1145e4c2da69793abb2f579af 4 # dev f83dfde1145e4c2da69793abb2f579af
5 # prod 0086a2088301440792091b9f814c2267 5 # prod 0086a2088301440792091b9f814c2267
6 -Uuid=f83dfde1145e4c2da69793abb2f579af 6 +Uuid=0086a2088301440792091b9f814c2267
7 7
8 # If we need to see logs in Logcat 8 # If we need to see logs in Logcat
9 Debug=true 9 Debug=true
...@@ -11,7 +11,7 @@ Debug=true ...@@ -11,7 +11,7 @@ Debug=true
11 # Production or Development environment of the engage server 11 # Production or Development environment of the engage server
12 # Production: https://engage.warp.ly 12 # Production: https://engage.warp.ly
13 # Development: https://engage-stage.warp.ly 13 # Development: https://engage-stage.warp.ly
14 -BaseURL=https://engage-stage.warp.ly 14 +BaseURL=https://engage.warp.ly
15 15
16 # For Verify Ticket request 16 # For Verify Ticket request
17 VerifyURL=/partners/cosmote/verify 17 VerifyURL=/partners/cosmote/verify
......
...@@ -27,19 +27,16 @@ public abstract class BaseActivity extends FragmentActivity { ...@@ -27,19 +27,16 @@ public abstract class BaseActivity extends FragmentActivity {
27 @Override 27 @Override
28 protected void onCreate(Bundle savedInstanceState) { 28 protected void onCreate(Bundle savedInstanceState) {
29 super.onCreate(savedInstanceState); 29 super.onCreate(savedInstanceState);
30 - WarplySessionManager.onCreateActivity(this);
31 } 30 }
32 31
33 @Override 32 @Override
34 protected void onStart() { 33 protected void onStart() {
35 super.onStart(); 34 super.onStart();
36 - WarplySessionManager.onStartActivity(this);
37 } 35 }
38 36
39 @Override 37 @Override
40 protected void onStop() { 38 protected void onStop() {
41 super.onStop(); 39 super.onStop();
42 - WarplySessionManager.onStopActivity(this);
43 } 40 }
44 41
45 // =========================================================== 42 // ===========================================================
......
...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { ...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
36 public void onWarplyReady() { 36 public void onWarplyReady() {
37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
39 - .setGuid("7000000826"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990 39 + .setGuid("6006552990"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -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-cosbeta87' 5 + PUBLISH_VERSION = '4.5.4-cosbeta88'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -156,20 +156,20 @@ public enum Warply { ...@@ -156,20 +156,20 @@ public enum Warply {
156 private void isInitializedOrThrow() { 156 private void isInitializedOrThrow() {
157 if (mContext == null) { 157 if (mContext == null) {
158 WarpUtils.log("Warply has not been initialized, call init(Context) first"); 158 WarpUtils.log("Warply has not been initialized, call init(Context) first");
159 - return; 159 +// return;
160 } 160 }
161 if (mContext.get() == null) { 161 if (mContext.get() == null) {
162 WarpUtils.log("Warply has not been initialized, call init(Context) first"); 162 WarpUtils.log("Warply has not been initialized, call init(Context) first");
163 - return; 163 +// return;
164 } 164 }
165 String apiKey = WarplyProperty.getAppUuid(mContext.get()); 165 String apiKey = WarplyProperty.getAppUuid(mContext.get());
166 if (apiKey == null) { 166 if (apiKey == null) {
167 WarpUtils.log("Warply application UUID has not been set in the Manifest"); 167 WarpUtils.log("Warply application UUID has not been set in the Manifest");
168 - return; 168 +// return;
169 } 169 }
170 if ((apiKey.length() != 32) && (apiKey.length() != 36)) { 170 if ((apiKey.length() != 32) && (apiKey.length() != 36)) {
171 WarpUtils.log("Warply application UUID has not been set correclty in the Manifest, key got: " + apiKey); 171 WarpUtils.log("Warply application UUID has not been set correclty in the Manifest, key got: " + apiKey);
172 - return; 172 +// return;
173 } 173 }
174 } 174 }
175 175
...@@ -985,6 +985,9 @@ public enum Warply { ...@@ -985,6 +985,9 @@ public enum Warply {
985 } 985 }
986 986
987 private void check() { 987 private void check() {
988 +// if (mContext == null) {
989 +// return;
990 +// }
988 if (!WarpUtils.isRegisteredWarply(mContext.get())) { 991 if (!WarpUtils.isRegisteredWarply(mContext.get())) {
989 registerWarply(); 992 registerWarply();
990 return; 993 return;
......
...@@ -54,7 +54,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -54,7 +54,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
54 @Override 54 @Override
55 public void onCreate(Bundle savedInstanceState) { 55 public void onCreate(Bundle savedInstanceState) {
56 super.onCreate(savedInstanceState); 56 super.onCreate(savedInstanceState);
57 - WarplySessionManager.onCreateActivity(this);
58 setContentView(R.layout.activity_base_fragment); 57 setContentView(R.layout.activity_base_fragment);
59 58
60 mBottomNavigationView = findViewById(R.id.bt_tabs); 59 mBottomNavigationView = findViewById(R.id.bt_tabs);
...@@ -71,13 +70,11 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -71,13 +70,11 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
71 @Override 70 @Override
72 protected void onStart() { 71 protected void onStart() {
73 super.onStart(); 72 super.onStart();
74 - WarplySessionManager.onStartActivity(this);
75 } 73 }
76 74
77 @Override 75 @Override
78 protected void onStop() { 76 protected void onStop() {
79 super.onStop(); 77 super.onStop();
80 - WarplySessionManager.onStopActivity(this);
81 } 78 }
82 79
83 @Override 80 @Override
......
...@@ -23,7 +23,6 @@ import org.json.JSONObject; ...@@ -23,7 +23,6 @@ import org.json.JSONObject;
23 23
24 import java.io.Serializable; 24 import java.io.Serializable;
25 import java.util.ArrayList; 25 import java.util.ArrayList;
26 -import java.util.HashMap;
27 import java.util.HashSet; 26 import java.util.HashSet;
28 import java.util.LinkedHashSet; 27 import java.util.LinkedHashSet;
29 import java.util.Set; 28 import java.util.Set;
...@@ -31,7 +30,6 @@ import java.util.Set; ...@@ -31,7 +30,6 @@ import java.util.Set;
31 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 30 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
32 import ly.warp.sdk.R; 31 import ly.warp.sdk.R;
33 import ly.warp.sdk.io.models.Campaign; 32 import ly.warp.sdk.io.models.Campaign;
34 -import ly.warp.sdk.io.models.CampaignList;
35 import ly.warp.sdk.io.models.Couponset; 33 import ly.warp.sdk.io.models.Couponset;
36 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; 34 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
37 import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; 35 import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent;
...@@ -60,13 +58,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -60,13 +58,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
60 58
61 private ImageView mIvBack, mIvPopupClose; 59 private ImageView mIvBack, mIvPopupClose;
62 private TextView mTvTitle; 60 private TextView mTvTitle;
63 - private HashMap<String, CampaignList> mUniqueGiftsList = new HashMap<String, CampaignList>();
64 private LinearLayout mLlGiftsPopup; 61 private LinearLayout mLlGiftsPopup;
65 - private ArrayList<MergedGifts> mData = new ArrayList(); 62 + private ArrayList<MergedGifts> mData = new ArrayList<>();
66 private RecyclerView mRecyclerMergedGifts; 63 private RecyclerView mRecyclerMergedGifts;
67 private MergedGiftsAdapter mAdapterMergedGifts; 64 private MergedGiftsAdapter mAdapterMergedGifts;
68 private ArrayList<Campaign> mValuesList = new ArrayList<>(); 65 private ArrayList<Campaign> mValuesList = new ArrayList<>();
69 - // private HashSet<Campaign> mHashSetList = new HashSet<>();
70 private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); 66 private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>();
71 private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>(); 67 private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>();
72 private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); 68 private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>();
...@@ -82,37 +78,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -82,37 +78,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
82 super.onCreate(savedInstanceState); 78 super.onCreate(savedInstanceState);
83 setContentView(R.layout.activity_gifts_for_you); 79 setContentView(R.layout.activity_gifts_for_you);
84 mSecondsHandler = new Handler(); 80 mSecondsHandler = new Handler();
85 - filterItems();
86 -
87 - if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) {
88 - mHashSetSeasonalList.clear();
89 - mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList());
90 - mSeasonalList.clear();
91 - mSeasonalList.addAll(mHashSetSeasonalList);
92 - }
93 -
94 - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
95 - mContextualList.clear();
96 - for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
97 - if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA"))
98 - && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U"))
99 - mContextualList.add(ccmsItem);
100 - }
101 - }
102 -
103 - mergeDatasets(
104 - mSeasonalList,
105 - mContextualList,
106 - mValuesList
107 - );
108 81
109 mIvBack = findViewById(R.id.iv_list_close); 82 mIvBack = findViewById(R.id.iv_list_close);
110 mTvTitle = findViewById(R.id.textView3); 83 mTvTitle = findViewById(R.id.textView3);
111 mIvPopupClose = findViewById(R.id.iv_popup_gifts_close); 84 mIvPopupClose = findViewById(R.id.iv_popup_gifts_close);
112 mLlGiftsPopup = findViewById(R.id.ll_gifts_popup); 85 mLlGiftsPopup = findViewById(R.id.ll_gifts_popup);
113 -
114 mRecyclerMergedGifts = findViewById(R.id.rv_merged_gifts); 86 mRecyclerMergedGifts = findViewById(R.id.rv_merged_gifts);
115 87
88 + filterItems();
89 +
90 + mergeDatasets();
91 +
116 initViews(); 92 initViews();
117 } 93 }
118 94
...@@ -191,29 +167,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -191,29 +167,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
191 if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { 167 if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) {
192 filterItems(); 168 filterItems();
193 169
194 - if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { 170 + mergeDatasets();
195 - mHashSetSeasonalList.clear();
196 - mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList());
197 - mSeasonalList.clear();
198 - mSeasonalList.addAll(mHashSetSeasonalList);
199 - }
200 171
201 - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { 172 + runOnUiThread(this::initViews2);
202 - mContextualList.clear();
203 - for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
204 - if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA"))
205 - && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U"))
206 - mContextualList.add(ccmsItem);
207 - }
208 - }
209 -
210 - mergeDatasets(
211 - mSeasonalList,
212 - mContextualList,
213 - mValuesList
214 - );
215 -
216 - runOnUiThread(this::initViews);
217 } 173 }
218 } 174 }
219 175
...@@ -229,164 +185,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -229,164 +185,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
229 // mLlGiftsPopup.setVisibility(View.VISIBLE); 185 // mLlGiftsPopup.setVisibility(View.VISIBLE);
230 186
231 if (mData != null && mData.size() > 0) { 187 if (mData != null && mData.size() > 0) {
188 + mRecyclerMergedGifts.setNestedScrollingEnabled(false);
232 mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 189 mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
233 mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); 190 mAdapterMergedGifts = new MergedGiftsAdapter(this, mData);
234 -// mAdapterMergedGifts.setHasStableIds(true);
235 -// mRecyclerMergedGifts.setItemAnimator(null);
236 mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); 191 mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts);
237 mAdapterMergedGifts.getPositionClicks() 192 mAdapterMergedGifts.getPositionClicks()
238 - .doOnNext(dataItem -> { 193 + .doOnNext(this::handleGiftItemClick)
239 - if (dataItem.getDataType() == 1) {
240 - WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
241 - EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
242 -
243 - if (dataItem.getCampaign().getType().equals("coupon")) {
244 - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
245 - LoyaltyContextualOfferModel ccmsItem = null;
246 - for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
247 - if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
248 - ccmsItem = ccms;
249 - break;
250 - }
251 - }
252 -
253 - if (ccmsItem != null) {
254 - try {
255 - JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
256 - if (campaignSettings != null) {
257 - if (campaignSettings.has("couponset")) {
258 - String cpnUuid = campaignSettings.optString("couponset");
259 - for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
260 - if (cpns.getUuid().equals(cpnUuid)) {
261 - LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
262 - analyticsEvent.setEventName("loyalty_sdk_offer_selected");
263 - analyticsEvent.setParameter("name", dataItem.getCampaign().getTitle());
264 - analyticsEvent.setParameter("type", "coupon");
265 - EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
266 -
267 - WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
268 - WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
269 - Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
270 - intent.putExtra("couponset", (Serializable) cpns);
271 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
272 - intent.putExtra("ccms", ccmsItem);
273 - startActivityForResult(intent, 1004);
274 - break;
275 - }
276 - }
277 - } else {
278 - WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
279 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
280 - }
281 - }
282 - } catch (Exception exception) {
283 - exception.printStackTrace();
284 - }
285 -
286 - return;
287 - }
288 - }
289 -
290 - try {
291 - JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
292 - if (campaignSettings != null) {
293 - if (campaignSettings.has("couponset")) {
294 - String cpnUuid = campaignSettings.optString("couponset");
295 - for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
296 - if (cpns.getUuid().equals(cpnUuid)) {
297 - LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
298 - analyticsEvent.setEventName("loyalty_sdk_offer_selected");
299 - analyticsEvent.setParameter("name", dataItem.getCampaign().getTitle());
300 - analyticsEvent.setParameter("type", "coupon");
301 - EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
302 -
303 - WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
304 - WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
305 - Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
306 - intent.putExtra("couponset", (Serializable) cpns);
307 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
308 - startActivityForResult(intent, 1004);
309 - break;
310 - }
311 - }
312 - } else {
313 - WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
314 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
315 - }
316 - }
317 - } catch (Exception exception) {
318 - exception.printStackTrace();
319 - }
320 -
321 - return;
322 - }
323 -
324 - try {
325 - JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields());
326 - if (extraFields != null) {
327 - if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
328 - for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
329 - if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
330 - LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
331 - analyticsEvent.setEventName("loyalty_sdk_offer_selected");
332 - analyticsEvent.setParameter("name", ccms.getTitle());
333 - analyticsEvent.setParameter("type", "gift");
334 - EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
335 -
336 - WarplyAnalyticsManager.logTrackersEvent("click", ("Telco").concat(":").concat(ccms.getSessionId()));
337 - WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
338 - Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
339 - intent.putExtra("ccms", ccms);
340 - intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
341 - startActivityForResult(intent, 1004);
342 - break;
343 - }
344 - }
345 - return;
346 - }
347 - if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
348 - for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
349 - if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
350 - WarplyAnalyticsManager.logTrackersEvent("click", ("Contextual").concat(":").concat(ccms.getSessionId()));
351 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
352 - break;
353 - }
354 - }
355 - } else {
356 - WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
357 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
358 - }
359 - }
360 - } catch (Exception exception) {
361 - WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
362 - startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
363 - }
364 - } else if (dataItem.getDataType() == 2) {
365 - LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
366 - seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle());
367 - seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId());
368 - seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl());
369 - seasonalCLick.setContext(this);
370 - EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick));
371 -
372 - LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
373 - analyticsEvent.setEventName("loyalty_sdk_offer_selected");
374 - analyticsEvent.setParameter("name", dataItem.getSeasonalList().getTitle());
375 - analyticsEvent.setParameter("type", "seasonal");
376 - EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
377 - } else if (dataItem.getDataType() == 3) {
378 - LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
379 - analyticsEvent.setEventName("loyalty_sdk_offer_selected");
380 - analyticsEvent.setParameter("name", dataItem.getCCMS().getTitle());
381 - analyticsEvent.setParameter("type", "gift");
382 - EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
383 -
384 - WarplyAnalyticsManager.logTrackersEvent("click", ("Contextual").concat(":").concat(dataItem.getCCMS().getSessionId()));
385 - Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class);
386 - intent.putExtra("ccms", dataItem.getCCMS());
387 - startActivity(intent);
388 - }
389 - })
390 .doOnError(error -> { 194 .doOnError(error -> {
391 }) 195 })
392 .subscribe(); 196 .subscribe();
...@@ -397,142 +201,182 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -397,142 +201,182 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
397 mIvBack.setOnClickListener(this); 201 mIvBack.setOnClickListener(this);
398 mIvPopupClose.setOnClickListener(this); 202 mIvPopupClose.setOnClickListener(this);
399 203
204 +// if (WarpUtils.getGiftsPopup(this))
205 +// mLlGiftsPopup.setVisibility(View.VISIBLE);
206 +
400 if (mData != null && mData.size() > 0) { 207 if (mData != null && mData.size() > 0) {
208 +// mRecyclerMergedGifts.setNestedScrollingEnabled(false);
209 +// mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
401 // mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); 210 // mAdapterMergedGifts = new MergedGiftsAdapter(this, mData);
402 -// mAdapterMergedGifts.setHasStableIds(true);
403 -// mRecyclerMergedGifts.setItemAnimator(null);
404 // mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); 211 // mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts);
405 // mAdapterMergedGifts.getPositionClicks() 212 // mAdapterMergedGifts.getPositionClicks()
406 -// .doOnNext(dataItem -> { 213 +// .doOnNext(this::handleGiftItemClick)
407 -// if (dataItem.getDataType() == 1) {
408 -// WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
409 -// EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
410 -//
411 -// if (dataItem.getCampaign().getType().equals("coupon")) {
412 -// if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
413 -// LoyaltyContextualOfferModel ccmsItem = null;
414 -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
415 -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
416 -// ccmsItem = ccms;
417 -// break;
418 -// }
419 -// }
420 -//
421 -// if (ccmsItem != null) {
422 -// try {
423 -// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
424 -// if (campaignSettings != null) {
425 -// if (campaignSettings.has("couponset")) {
426 -// String cpnUuid = campaignSettings.optString("couponset");
427 -// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
428 -// if (cpns.getUuid().equals(cpnUuid)) {
429 -// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
430 -// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
431 -// intent.putExtra("couponset", (Serializable) cpns);
432 -// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
433 -// intent.putExtra("ccms", ccmsItem);
434 -// startActivityForResult(intent, 1004);
435 -// break;
436 -// }
437 -// }
438 -// } else {
439 -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
440 -// }
441 -// }
442 -// } catch (Exception exception) {
443 -// exception.printStackTrace();
444 -// }
445 -//
446 -// return;
447 -// }
448 -// }
449 -//
450 -// try {
451 -// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
452 -// if (campaignSettings != null) {
453 -// if (campaignSettings.has("couponset")) {
454 -// String cpnUuid = campaignSettings.optString("couponset");
455 -// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
456 -// if (cpns.getUuid().equals(cpnUuid)) {
457 -// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
458 -// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
459 -// intent.putExtra("couponset", (Serializable) cpns);
460 -// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
461 -// startActivityForResult(intent, 1004);
462 -// break;
463 -// }
464 -// }
465 -// } else {
466 -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
467 -// }
468 -// }
469 -// } catch (Exception exception) {
470 -// exception.printStackTrace();
471 -// }
472 -//
473 -// return;
474 -// }
475 -//
476 -// try {
477 -// JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields());
478 -// if (extraFields != null) {
479 -// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
480 -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
481 -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
482 -// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
483 -// Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
484 -// intent.putExtra("ccms", ccms);
485 -// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
486 -// startActivityForResult(intent, 1004);
487 -// break;
488 -// }
489 -// }
490 -// return;
491 -// }
492 -// if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
493 -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
494 -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
495 -// WarpUtils.log("CCMS_CLICK " + ccms.toString());
496 -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
497 -// break;
498 -// }
499 -// }
500 -// } else {
501 -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
502 -// }
503 -// }
504 -// } catch (Exception exception) {
505 -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
506 -// }
507 -// } else if (dataItem.getDataType() == 2) {
508 -// LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
509 -// seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle());
510 -// seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId());
511 -// seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl());
512 -// seasonalCLick.setContext(GiftsForYouActivity.this);
513 -// EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick));
514 -// } else if (dataItem.getDataType() == 3) {
515 -// Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class);
516 -// intent.putExtra("ccms", dataItem.getCCMS());
517 -// startActivity(intent);
518 -// }
519 -// })
520 // .doOnError(error -> { 214 // .doOnError(error -> {
521 // }) 215 // })
522 // .subscribe(); 216 // .subscribe();
523 -// mAdapterMergedGifts.notifyDataSetChanged();
524 217
525 mAdapterMergedGifts.updateData(mData); 218 mAdapterMergedGifts.updateData(mData);
526 } 219 }
527 } 220 }
528 221
529 - private void mergeDatasets(ArrayList<LoyaltyGiftsForYouPackage> seasonalList, 222 + private void handleGiftItemClick(MergedGifts dataItem) {
530 - ArrayList<LoyaltyContextualOfferModel> ccmsList, 223 + if (dataItem.getDataType() == 1) {
531 - ArrayList<Campaign> campaignList) { 224 + WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
225 + EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
226 +
227 + if (dataItem.getCampaign().getType().equals("coupon")) {
228 + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
229 + LoyaltyContextualOfferModel ccmsItem = null;
230 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
231 + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
232 + ccmsItem = ccms;
233 + break;
234 + }
235 + }
236 +
237 + if (ccmsItem != null) {
238 + try {
239 + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
240 + if (campaignSettings != null) {
241 + if (campaignSettings.has("couponset")) {
242 + String cpnUuid = campaignSettings.optString("couponset");
243 + for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
244 + if (cpns.getUuid().equals(cpnUuid)) {
245 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
246 + analyticsEvent.setEventName("loyalty_sdk_offer_selected");
247 + analyticsEvent.setParameter("name", dataItem.getCampaign().getTitle());
248 + analyticsEvent.setParameter("type", "coupon");
249 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
250 +
251 + WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
252 + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
253 + Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
254 + intent.putExtra("couponset", (Serializable) cpns);
255 + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
256 + intent.putExtra("ccms", ccmsItem);
257 + startActivityForResult(intent, 1004);
258 + break;
259 + }
260 + }
261 + } else {
262 + WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
263 + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
264 + }
265 + }
266 + } catch (Exception exception) {
267 + exception.printStackTrace();
268 + }
269 +
270 + return;
271 + }
272 + }
273 +
274 + try {
275 + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings());
276 + if (campaignSettings != null) {
277 + if (campaignSettings.has("couponset")) {
278 + String cpnUuid = campaignSettings.optString("couponset");
279 + for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
280 + if (cpns.getUuid().equals(cpnUuid)) {
281 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
282 + analyticsEvent.setEventName("loyalty_sdk_offer_selected");
283 + analyticsEvent.setParameter("name", dataItem.getCampaign().getTitle());
284 + analyticsEvent.setParameter("type", "coupon");
285 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
286 +
287 + WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
288 + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
289 + Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
290 + intent.putExtra("couponset", (Serializable) cpns);
291 + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
292 + startActivityForResult(intent, 1004);
293 + break;
294 + }
295 + }
296 + } else {
297 + WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
298 + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
299 + }
300 + }
301 + } catch (Exception exception) {
302 + exception.printStackTrace();
303 + }
304 +
305 + return;
306 + }
307 +
308 + try {
309 + JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields());
310 + if (extraFields != null) {
311 + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
312 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
313 + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
314 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
315 + analyticsEvent.setEventName("loyalty_sdk_offer_selected");
316 + analyticsEvent.setParameter("name", ccms.getTitle());
317 + analyticsEvent.setParameter("type", "gift");
318 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
319 +
320 + WarplyAnalyticsManager.logTrackersEvent("click", ("Telco").concat(":").concat(ccms.getSessionId()));
321 + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
322 + Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
323 + intent.putExtra("ccms", ccms);
324 + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
325 + startActivityForResult(intent, 1004);
326 + break;
327 + }
328 + }
329 + return;
330 + }
331 + if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
332 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
333 + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
334 + WarplyAnalyticsManager.logTrackersEvent("click", ("Contextual").concat(":").concat(ccms.getSessionId()));
335 + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
336 + break;
337 + }
338 + }
339 + } else {
340 + WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
341 + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
342 + }
343 + }
344 + } catch (Exception exception) {
345 + WarplyAnalyticsManager.logTrackersEvent("click", ("Loyalty").concat(":").concat(dataItem.getCampaign().getSessionUUID()));
346 + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
347 + }
348 + } else if (dataItem.getDataType() == 2) {
349 + LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
350 + seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle());
351 + seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId());
352 + seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl());
353 + seasonalCLick.setContext(this);
354 + EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick));
355 +
356 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
357 + analyticsEvent.setEventName("loyalty_sdk_offer_selected");
358 + analyticsEvent.setParameter("name", dataItem.getSeasonalList().getTitle());
359 + analyticsEvent.setParameter("type", "seasonal");
360 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
361 + } else if (dataItem.getDataType() == 3) {
362 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
363 + analyticsEvent.setEventName("loyalty_sdk_offer_selected");
364 + analyticsEvent.setParameter("name", dataItem.getCCMS().getTitle());
365 + analyticsEvent.setParameter("type", "gift");
366 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
367 +
368 + WarplyAnalyticsManager.logTrackersEvent("click", ("Contextual").concat(":").concat(dataItem.getCCMS().getSessionId()));
369 + Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class);
370 + intent.putExtra("ccms", dataItem.getCCMS());
371 + startActivity(intent);
372 + }
373 + }
374 +
375 + private void mergeDatasets() {
532 mData.clear(); 376 mData.clear();
533 - if (seasonalList != null && seasonalList.size() > 0) { 377 + if (mSeasonalList != null && mSeasonalList.size() > 0) {
534 - Log.v("SEASONAL", String.valueOf(seasonalList.size())); 378 + Log.v("SEASONAL", String.valueOf(mSeasonalList.size()));
535 - for (LoyaltyGiftsForYouPackage seasonal : seasonalList) { 379 + for (LoyaltyGiftsForYouPackage seasonal : mSeasonalList) {
536 MergedGifts data = new MergedGifts(); 380 MergedGifts data = new MergedGifts();
537 data.setCampaign(null); 381 data.setCampaign(null);
538 data.setSeasonalList(seasonal); 382 data.setSeasonalList(seasonal);
...@@ -542,9 +386,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -542,9 +386,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
542 } 386 }
543 } 387 }
544 388
545 - if (ccmsList != null && ccmsList.size() > 0) { 389 + if (mContextualList != null && mContextualList.size() > 0) {
546 - Log.v("CCMS", String.valueOf(ccmsList.size())); 390 + Log.v("CCMS", String.valueOf(mContextualList.size()));
547 - for (LoyaltyContextualOfferModel ccmsItem : ccmsList) { 391 + for (LoyaltyContextualOfferModel ccmsItem : mContextualList) {
548 MergedGifts data = new MergedGifts(); 392 MergedGifts data = new MergedGifts();
549 data.setCampaign(null); 393 data.setCampaign(null);
550 data.setSeasonalList(null); 394 data.setSeasonalList(null);
...@@ -554,16 +398,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -554,16 +398,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
554 } 398 }
555 } 399 }
556 400
557 - if (campaignList != null && campaignList.size() > 0) { 401 + if (mValuesList != null && mValuesList.size() > 0) {
558 - final ArrayList<Campaign> customs3 = new ArrayList<Campaign>(); 402 + Log.v("GIFTS_FOR_YOU", String.valueOf(mValuesList.size()));
559 - for (Campaign campaignItem : campaignList) { 403 + for (Campaign campaign : mValuesList) {
560 - if (!customs3.contains(campaignItem)) {
561 - customs3.add(campaignItem);
562 - }
563 - }
564 -
565 - Log.v("GIFTS_FOR_YOU", String.valueOf(campaignList.size()));
566 - for (Campaign campaign : customs3) {
567 MergedGifts data = new MergedGifts(); 404 MergedGifts data = new MergedGifts();
568 data.setCampaign(campaign); 405 data.setCampaign(campaign);
569 data.setSeasonalList(null); 406 data.setSeasonalList(null);
...@@ -579,6 +416,22 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -579,6 +416,22 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
579 } 416 }
580 417
581 private void filterItems() { 418 private void filterItems() {
419 + if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) {
420 + mHashSetSeasonalList.clear();
421 + mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList());
422 + mSeasonalList.clear();
423 + mSeasonalList.addAll(mHashSetSeasonalList);
424 + }
425 +
426 + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
427 + mContextualList.clear();
428 + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
429 + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA"))
430 + && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U"))
431 + mContextualList.add(ccmsItem);
432 + }
433 + }
434 +
582 mValuesList.clear(); 435 mValuesList.clear();
583 ArrayList<Campaign> gfyList = new ArrayList<>(); 436 ArrayList<Campaign> gfyList = new ArrayList<>();
584 if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) { 437 if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) {
...@@ -623,15 +476,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -623,15 +476,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
623 476
624 WarpUtils.log("GFY_FILTER_LIST_COUNT: " + String.valueOf(gfyList.size())); 477 WarpUtils.log("GFY_FILTER_LIST_COUNT: " + String.valueOf(gfyList.size()));
625 WarpUtils.log("GFY_FILTER_LIST_JSON: " + String.valueOf(gfyList.toString())); 478 WarpUtils.log("GFY_FILTER_LIST_JSON: " + String.valueOf(gfyList.toString()));
626 - mValuesList.addAll(gfyList);
627 - final ArrayList<Campaign> customs = new ArrayList<Campaign>();
628 - for (Campaign campaignItem : mValuesList) {
629 - if (!customs.contains(campaignItem)) {
630 - customs.add(campaignItem);
631 - }
632 - }
633 mValuesList.clear(); 479 mValuesList.clear();
634 - mValuesList.addAll(customs); 480 + mValuesList.addAll(gfyList);
635 WarpUtils.log("GFY_VAR_LIST_COUNT: " + String.valueOf(mValuesList.size())); 481 WarpUtils.log("GFY_VAR_LIST_COUNT: " + String.valueOf(mValuesList.size()));
636 WarpUtils.log("GFY_VAR_LIST_JSON: " + String.valueOf(mValuesList.toString())); 482 WarpUtils.log("GFY_VAR_LIST_JSON: " + String.valueOf(mValuesList.toString()));
637 } 483 }
......
...@@ -6,7 +6,6 @@ import android.content.Intent; ...@@ -6,7 +6,6 @@ import android.content.Intent;
6 import android.os.Bundle; 6 import android.os.Bundle;
7 import android.os.Handler; 7 import android.os.Handler;
8 import android.text.TextUtils; 8 import android.text.TextUtils;
9 -import android.util.Log;
10 import android.view.View; 9 import android.view.View;
11 import android.widget.ImageView; 10 import android.widget.ImageView;
12 import android.widget.LinearLayout; 11 import android.widget.LinearLayout;
...@@ -41,7 +40,6 @@ import ly.warp.sdk.utils.WarplyManagerHelper; ...@@ -41,7 +40,6 @@ import ly.warp.sdk.utils.WarplyManagerHelper;
41 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 40 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
42 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 41 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
43 import ly.warp.sdk.utils.managers.WarplyManager; 42 import ly.warp.sdk.utils.managers.WarplyManager;
44 -import ly.warp.sdk.views.adapters.MergedMoreAdapter;
45 import ly.warp.sdk.views.adapters.MoreCampaignAdapter; 43 import ly.warp.sdk.views.adapters.MoreCampaignAdapter;
46 import ly.warp.sdk.views.adapters.MoreContextualAdapter; 44 import ly.warp.sdk.views.adapters.MoreContextualAdapter;
47 45
...@@ -59,8 +57,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -59,8 +57,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
59 private ImageView mIvBack, mIvPopupClose; 57 private ImageView mIvBack, mIvPopupClose;
60 private RecyclerView mRecyclerMore; 58 private RecyclerView mRecyclerMore;
61 private TextView mTvTitle; 59 private TextView mTvTitle;
62 - private MoreCampaignAdapter mAdapterMore;
63 - private MergedMoreAdapter mAdapterMergedMore;
64 private LinearLayout mLlMorePopup; 60 private LinearLayout mLlMorePopup;
65 private ArrayList<Campaign> mValuesList = new ArrayList<>(); 61 private ArrayList<Campaign> mValuesList = new ArrayList<>();
66 private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); 62 private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>();
...@@ -86,7 +82,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -86,7 +82,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
86 private MoreContextualAdapter mAdapterContextual; 82 private MoreContextualAdapter mAdapterContextual;
87 private int mTimer = 0; 83 private int mTimer = 0;
88 private Handler mSecondsHandler; 84 private Handler mSecondsHandler;
89 -
90 /** 85 /**
91 * New Implementation 86 * New Implementation
92 */ 87 */
...@@ -247,8 +242,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -247,8 +242,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
247 mResearchItems.setNestedScrollingEnabled(false); 242 mResearchItems.setNestedScrollingEnabled(false);
248 mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 243 mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
249 mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); 244 mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
250 -// mResearchItems.setItemAnimator(null);
251 -// mAdapterResearch.setHasStableIds(true);
252 mResearchItems.setAdapter(mAdapterResearch); 245 mResearchItems.setAdapter(mAdapterResearch);
253 mAdapterResearch.getPositionClicks() 246 mAdapterResearch.getPositionClicks()
254 .doOnNext(this::handleMoreItemClick) 247 .doOnNext(this::handleMoreItemClick)
...@@ -269,8 +262,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -269,8 +262,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
269 mExclusiveItems.setNestedScrollingEnabled(false); 262 mExclusiveItems.setNestedScrollingEnabled(false);
270 mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 263 mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
271 mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); 264 mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
272 -// mExclusiveItems.setItemAnimator(null);
273 -// mAdapterExclusive.setHasStableIds(true);
274 mExclusiveItems.setAdapter(mAdapterExclusive); 265 mExclusiveItems.setAdapter(mAdapterExclusive);
275 mAdapterExclusive.getPositionClicks() 266 mAdapterExclusive.getPositionClicks()
276 .doOnNext(this::handleMoreItemClick) 267 .doOnNext(this::handleMoreItemClick)
...@@ -291,8 +282,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -291,8 +282,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
291 mContestItems.setNestedScrollingEnabled(false); 282 mContestItems.setNestedScrollingEnabled(false);
292 mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 283 mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
293 mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); 284 mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
294 -// mContestItems.setItemAnimator(null);
295 -// mAdapterContest.setHasStableIds(true);
296 mContestItems.setAdapter(mAdapterContest); 285 mContestItems.setAdapter(mAdapterContest);
297 mAdapterContest.getPositionClicks() 286 mAdapterContest.getPositionClicks()
298 .doOnNext(this::handleMoreItemClick) 287 .doOnNext(this::handleMoreItemClick)
...@@ -311,8 +300,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -311,8 +300,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
311 mContextualItems.setNestedScrollingEnabled(false); 300 mContextualItems.setNestedScrollingEnabled(false);
312 mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 301 mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
313 mAdapterContextual = new MoreContextualAdapter(this, mContextualList); 302 mAdapterContextual = new MoreContextualAdapter(this, mContextualList);
314 -// mContextualItems.setItemAnimator(null);
315 -// mAdapterContextual.setHasStableIds(true);
316 mContextualItems.setAdapter(mAdapterContextual); 303 mContextualItems.setAdapter(mAdapterContextual);
317 mAdapterContextual.getPositionClicks() 304 mAdapterContextual.getPositionClicks()
318 .doOnNext(this::handleMoreContextualItemClick) 305 .doOnNext(this::handleMoreContextualItemClick)
...@@ -424,8 +411,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -424,8 +411,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
424 } 411 }
425 412
426 private void handleMoreItemClick(Campaign moreItem) { 413 private void handleMoreItemClick(Campaign moreItem) {
427 - EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel()));
428 -
429 try { 414 try {
430 JSONObject extraFields = WarpJSONParser.getJSONFromString(moreItem.getExtraFields()); 415 JSONObject extraFields = WarpJSONParser.getJSONFromString(moreItem.getExtraFields());
431 if (extraFields != null) { 416 if (extraFields != null) {
...@@ -483,31 +468,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -483,31 +468,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
483 startActivity(intent); 468 startActivity(intent);
484 } 469 }
485 470
486 - private void mergeDatasets(ArrayList<Campaign> campaignList,
487 - ArrayList<LoyaltyContextualOfferModel> ccmsList) {
488 - mData.clear();
489 - if (campaignList != null && campaignList.size() > 0) {
490 - Log.v("MORE_FOR_YOU", String.valueOf(campaignList.size()));
491 - for (Campaign campaign : campaignList) {
492 - MergedMore data = new MergedMore();
493 - data.setCampaign(campaign);
494 - data.setDataType(1);
495 - mData.add(data);
496 - }
497 - }
498 -
499 - if (ccmsList != null && ccmsList.size() > 0) {
500 - Log.v("CCMS", String.valueOf(ccmsList.size()));
501 - for (LoyaltyContextualOfferModel ccmsItem : ccmsList) {
502 - MergedMore data = new MergedMore();
503 - data.setCampaign(null);
504 - data.setCCMS(ccmsItem);
505 - data.setDataType(2);
506 - mData.add(data);
507 - }
508 - }
509 - }
510 -
511 /** 471 /**
512 * New Implementation 472 * New Implementation
513 */ 473 */
......
...@@ -89,7 +89,7 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -89,7 +89,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
89 mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); 89 mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
90 mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); 90 mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
91 // registerStepSensor(); 91 // registerStepSensor();
92 -// Warply.getInitializer(this).init(); 92 + Warply.getInitializer(getApplicationContext()).init();
93 WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback); 93 WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback);
94 } 94 }
95 95
......
...@@ -992,8 +992,8 @@ public class WarplyManagerHelper { ...@@ -992,8 +992,8 @@ public class WarplyManagerHelper {
992 }); 992 });
993 } 993 }
994 994
995 - public static void setTrackersEnabled(boolean isEnabled) { 995 + public static void setTrackersEnabled(Context context, boolean isEnabled) {
996 - WarpUtils.setTrackersEnabled(Warply.getWarplyContext(), isEnabled); 996 + WarpUtils.setTrackersEnabled(context, isEnabled);
997 997
998 // JSONObject obj = new JSONObject(); 998 // JSONObject obj = new JSONObject();
999 // try { 999 // try {
...@@ -1137,9 +1137,13 @@ public class WarplyManagerHelper { ...@@ -1137,9 +1137,13 @@ public class WarplyManagerHelper {
1137 public static void setCampaignList(ArrayList<Campaign> campaignList) { 1137 public static void setCampaignList(ArrayList<Campaign> campaignList) {
1138 // mCampaignList.clear(); 1138 // mCampaignList.clear();
1139 // mCampaignList.addAll(campaignList); 1139 // mCampaignList.addAll(campaignList);
1140 - Set<Campaign> set = new LinkedHashSet<>(campaignList); 1140 +
1141 +// Set<Campaign> set = new LinkedHashSet<>(campaignList);
1142 +// mCampaignListAll.clear();
1143 +// mCampaignListAll.addAll(set);
1144 +
1141 mCampaignListAll.clear(); 1145 mCampaignListAll.clear();
1142 - mCampaignListAll.addAll(set); 1146 + mCampaignListAll = campaignList;
1143 1147
1144 mCampaignList.clear(); 1148 mCampaignList.clear();
1145 for (Campaign camp : campaignList) { 1149 for (Campaign camp : campaignList) {
......
...@@ -29,16 +29,11 @@ import android.app.ActivityManager; ...@@ -29,16 +29,11 @@ import android.app.ActivityManager;
29 import android.content.Context; 29 import android.content.Context;
30 import android.content.Intent; 30 import android.content.Intent;
31 import android.os.Build; 31 import android.os.Build;
32 -import android.os.Handler;
33 -import android.os.Looper;
34 -import android.util.Log;
35 32
36 -import androidx.appcompat.app.AlertDialog;
37 import androidx.work.OneTimeWorkRequest; 33 import androidx.work.OneTimeWorkRequest;
38 import androidx.work.WorkManager; 34 import androidx.work.WorkManager;
39 35
40 import org.greenrobot.eventbus.EventBus; 36 import org.greenrobot.eventbus.EventBus;
41 -import org.json.JSONArray;
42 import org.json.JSONException; 37 import org.json.JSONException;
43 import org.json.JSONObject; 38 import org.json.JSONObject;
44 39
...@@ -46,12 +41,10 @@ import java.text.ParseException; ...@@ -46,12 +41,10 @@ import java.text.ParseException;
46 import java.text.SimpleDateFormat; 41 import java.text.SimpleDateFormat;
47 import java.util.ArrayList; 42 import java.util.ArrayList;
48 import java.util.Collections; 43 import java.util.Collections;
49 -import java.util.Comparator;
50 import java.util.Date; 44 import java.util.Date;
51 import java.util.LinkedHashSet; 45 import java.util.LinkedHashSet;
52 import java.util.Set; 46 import java.util.Set;
53 47
54 -import ly.warp.sdk.R;
55 import ly.warp.sdk.Warply; 48 import ly.warp.sdk.Warply;
56 import ly.warp.sdk.db.WarplyDBHelper; 49 import ly.warp.sdk.db.WarplyDBHelper;
57 import ly.warp.sdk.io.callbacks.AddressHook; 50 import ly.warp.sdk.io.callbacks.AddressHook;
...@@ -73,7 +66,6 @@ import ly.warp.sdk.io.callbacks.TagsHook; ...@@ -73,7 +66,6 @@ import ly.warp.sdk.io.callbacks.TagsHook;
73 import ly.warp.sdk.io.callbacks.TransactionsHook; 66 import ly.warp.sdk.io.callbacks.TransactionsHook;
74 import ly.warp.sdk.io.models.AddressList; 67 import ly.warp.sdk.io.models.AddressList;
75 import ly.warp.sdk.io.models.Campaign; 68 import ly.warp.sdk.io.models.Campaign;
76 -import ly.warp.sdk.io.models.CampaignList;
77 import ly.warp.sdk.io.models.Card; 69 import ly.warp.sdk.io.models.Card;
78 import ly.warp.sdk.io.models.CardList; 70 import ly.warp.sdk.io.models.CardList;
79 import ly.warp.sdk.io.models.Consumer; 71 import ly.warp.sdk.io.models.Consumer;
...@@ -82,11 +74,8 @@ import ly.warp.sdk.io.models.Coupon; ...@@ -82,11 +74,8 @@ import ly.warp.sdk.io.models.Coupon;
82 import ly.warp.sdk.io.models.CouponList; 74 import ly.warp.sdk.io.models.CouponList;
83 import ly.warp.sdk.io.models.Couponset; 75 import ly.warp.sdk.io.models.Couponset;
84 import ly.warp.sdk.io.models.CouponsetsList; 76 import ly.warp.sdk.io.models.CouponsetsList;
85 -import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
86 import ly.warp.sdk.io.models.MerchantCategoriesList; 77 import ly.warp.sdk.io.models.MerchantCategoriesList;
87 import ly.warp.sdk.io.models.MerchantList; 78 import ly.warp.sdk.io.models.MerchantList;
88 -import ly.warp.sdk.io.models.NewCampaign;
89 -import ly.warp.sdk.io.models.NewCampaignList;
90 import ly.warp.sdk.io.models.PacingDetails; 79 import ly.warp.sdk.io.models.PacingDetails;
91 import ly.warp.sdk.io.models.PointsList; 80 import ly.warp.sdk.io.models.PointsList;
92 import ly.warp.sdk.io.models.ProductList; 81 import ly.warp.sdk.io.models.ProductList;
...@@ -154,8 +143,6 @@ import ly.warp.sdk.utils.constants.WarpConstants; ...@@ -154,8 +143,6 @@ import ly.warp.sdk.utils.constants.WarpConstants;
154 */ 143 */
155 144
156 public class WarplyManager { 145 public class WarplyManager {
157 - private static ArrayList<Campaign> mNewCampaignList = new ArrayList<Campaign>();
158 -
159 public static void getProducts(WarplyProductsRequest request, final CallbackReceiver<ProductList> receiver) { 146 public static void getProducts(WarplyProductsRequest request, final CallbackReceiver<ProductList> receiver) {
160 // String productCategory = ""; 147 // String productCategory = "";
161 // int resStringId = getWarplyContext().getResources().getIdentifier("products_category", "string", getWarplyContext().getPackageName()); 148 // int resStringId = getWarplyContext().getResources().getIdentifier("products_category", "string", getWarplyContext().getPackageName());
...@@ -1392,53 +1379,28 @@ public class WarplyManager { ...@@ -1392,53 +1379,28 @@ public class WarplyManager {
1392 Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() { 1379 Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() {
1393 @Override 1380 @Override
1394 public void onSuccess(ArrayList<Campaign> result) { 1381 public void onSuccess(ArrayList<Campaign> result) {
1395 -// receiver.onSuccess(result);
1396 - mNewCampaignList.clear();
1397 - mNewCampaignList.addAll(result);
1398 getCampaignsPersonalized(request, new CallbackReceiver<ArrayList<Campaign>>() { 1382 getCampaignsPersonalized(request, new CallbackReceiver<ArrayList<Campaign>>() {
1399 @Override 1383 @Override
1400 public void onSuccess(ArrayList<Campaign> resultPersonalized) { 1384 public void onSuccess(ArrayList<Campaign> resultPersonalized) {
1401 - receiver.onSuccess(resultPersonalized); 1385 + ArrayList<Campaign> newCampaignList = new ArrayList<Campaign>();
1402 - } 1386 + newCampaignList.clear();
1403 - 1387 + newCampaignList.addAll(result);
1404 - @Override 1388 + newCampaignList.addAll(resultPersonalized);
1405 - public void onFailure(int errorCode) { 1389 + Collections.sort(newCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting()));
1406 - receiver.onFailure(errorCode); 1390 + WarplyManagerHelper.setCampaignList(newCampaignList);
1407 - } 1391 + ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>();
1408 - }); 1392 + campaignLoyaltyList.clear();
1409 - } 1393 + ArrayList<Campaign> campaignCarouselList = new ArrayList<>();
1410 - 1394 + campaignCarouselList.clear();
1411 - @Override 1395 + for (Campaign camp : newCampaignList) {
1412 - public void onFailure(int errorCode) { 1396 + JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1413 - receiver.onFailure(errorCode); 1397 + if (campMetadata != null) {
1414 - } 1398 + if (campMetadata.has("carousel")) {
1415 - }, 1399 + campaignCarouselList.add(camp);
1416 - request.getSignature())); 1400 + }
1417 - } 1401 + }
1418 -
1419 - public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) {
1420 - WarpUtils.log("************* WARPLY Get Campaigns Request ********************");
1421 - WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active");
1422 - WarpUtils.log("**************************************************");
1423 -
1424 - Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() {
1425 - @Override
1426 - public void onSuccess(ArrayList<Campaign> result) {
1427 - mNewCampaignList.addAll(result);
1428 - Collections.sort(mNewCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting()));
1429 - ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>();
1430 - campaignLoyaltyList.clear();
1431 - ArrayList<Campaign> campaignCarouselList = new ArrayList<>();
1432 - campaignCarouselList.clear();
1433 - for (Campaign camp : mNewCampaignList) {
1434 - JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1435 - if (campMetadata != null) {
1436 - if (campMetadata.has("carousel")) {
1437 - campaignCarouselList.add(camp);
1438 - }
1439 - }
1440 1402
1441 - if (camp.getOfferCategory().equals("questionnaire")) { 1403 + if (camp.getOfferCategory().equals("questionnaire")) {
1442 // if (WarplyManagerHelper.getConsumerInternal() != null) { 1404 // if (WarplyManagerHelper.getConsumerInternal() != null) {
1443 // JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata()); 1405 // JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
1444 // if (profMetadata != null) { 1406 // if (profMetadata != null) {
...@@ -1478,23 +1440,22 @@ public class WarplyManager { ...@@ -1478,23 +1440,22 @@ public class WarplyManager {
1478 // campaignLoyaltyList.add(camp); 1440 // campaignLoyaltyList.add(camp);
1479 // } 1441 // }
1480 // } 1442 // }
1481 - } else { 1443 + } else {
1482 - try { 1444 + try {
1483 - JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 1445 + JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1484 - if (extraFields != null) { 1446 + if (extraFields != null) {
1485 - if (extraFields.length() == 0 || !(/*extraFields.has("ccms_offer") || */extraFields.has("type"))) { 1447 + if (extraFields.length() == 0 || !(/*extraFields.has("ccms_offer") || */extraFields.has("type"))) {
1448 + campaignLoyaltyList.add(camp);
1449 + }
1450 + }
1451 + } catch (Exception exception) {
1486 campaignLoyaltyList.add(camp); 1452 campaignLoyaltyList.add(camp);
1487 } 1453 }
1488 } 1454 }
1489 - } catch (Exception exception) {
1490 - campaignLoyaltyList.add(camp);
1491 } 1455 }
1492 - } 1456 + WarplyManagerHelper.setCarouselList(campaignCarouselList);
1493 - }
1494 - WarplyManagerHelper.setCampaignList(mNewCampaignList);
1495 - WarplyManagerHelper.setCarouselList(campaignCarouselList);
1496 1457
1497 -// ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>(); 1458 + // ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>();
1498 // JSONArray jArray = null; 1459 // JSONArray jArray = null;
1499 // try { 1460 // try {
1500 // jArray = new JSONArray("[\n" + 1461 // jArray = new JSONArray("[\n" +
...@@ -2045,10 +2006,36 @@ public class WarplyManager { ...@@ -2045,10 +2006,36 @@ public class WarplyManager {
2045 // } 2006 // }
2046 // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list); 2007 // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list);
2047 2008
2048 - Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); 2009 + Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList);
2049 - campaignLoyaltyList.clear(); 2010 + campaignLoyaltyList.clear();
2050 - campaignLoyaltyList.addAll(set); 2011 + campaignLoyaltyList.addAll(set);
2051 - receiver.onSuccess(campaignLoyaltyList); //result 2012 + receiver.onSuccess(campaignLoyaltyList); //resultPersonalized
2013 + }
2014 +
2015 + @Override
2016 + public void onFailure(int errorCode) {
2017 + receiver.onFailure(errorCode);
2018 + }
2019 + });
2020 + }
2021 +
2022 + @Override
2023 + public void onFailure(int errorCode) {
2024 + receiver.onFailure(errorCode);
2025 + }
2026 + },
2027 + request.getSignature()));
2028 + }
2029 +
2030 + public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) {
2031 + WarpUtils.log("************* WARPLY Get Campaigns Request ********************");
2032 + WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active");
2033 + WarpUtils.log("**************************************************");
2034 +
2035 + Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() {
2036 + @Override
2037 + public void onSuccess(ArrayList<Campaign> result) {
2038 + receiver.onSuccess(result);
2052 } 2039 }
2053 2040
2054 @Override 2041 @Override
......