Panagiotis Triantafyllou

new version

...@@ -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-cosbeta27a' 5 + PUBLISH_VERSION = '4.5.4-cosbeta28'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -129,9 +129,11 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -129,9 +129,11 @@ public class WarpViewActivity extends WarpBaseActivity {
129 } 129 }
130 if (event.getCoupon() != null) 130 if (event.getCoupon() != null)
131 finish(); 131 finish();
132 - if (event.getPacingCard() != null) 132 +// if (event.getPacingCard() != null)
133 - finish(); 133 +// finish();
134 - if (event.getPacingService() != null) 134 +// if (event.getPacingService() != null)
135 +// finish();
136 + if (event.getPacing() != null)
135 finish(); 137 finish();
136 } 138 }
137 139
......
1 package ly.warp.sdk.io.models; 1 package ly.warp.sdk.io.models;
2 2
3 +import org.json.JSONArray;
4 +import org.json.JSONObject;
5 +
3 import java.util.ArrayList; 6 import java.util.ArrayList;
4 7
5 /** 8 /**
...@@ -7,8 +10,8 @@ import java.util.ArrayList; ...@@ -7,8 +10,8 @@ import java.util.ArrayList;
7 */ 10 */
8 11
9 public class LoyaltyContextualOfferModel { 12 public class LoyaltyContextualOfferModel {
10 - private String sessionId; //Needed for Interest/Accept/Reject 13 + private String sessionId;
11 - private ArrayList<String> eligibleAssets; //Array of the eligible assets for this offer 14 + private ArrayList<String> eligibleAssets;
12 private String id; 15 private String id;
13 private String businessAdditionalId; 16 private String businessAdditionalId;
14 private String treatmentCode; 17 private String treatmentCode;
...@@ -66,6 +69,47 @@ public class LoyaltyContextualOfferModel { ...@@ -66,6 +69,47 @@ public class LoyaltyContextualOfferModel {
66 this.offerAudienceLevel = ""; 69 this.offerAudienceLevel = "";
67 } 70 }
68 71
72 + public LoyaltyContextualOfferModel(JSONObject jobj) {
73 + if (jobj != null) {
74 + this.sessionId = jobj.optString("sessionId");
75 + this.eligibleAssets = new ArrayList<>();
76 + JSONArray assets = new JSONArray();
77 + assets = jobj.optJSONArray("eligibleAssets");
78 + if (assets != null && assets.length() > 0) {
79 + ArrayList<String> assetsList = new ArrayList<>();
80 + for (int i = 0; i < assets.length(); i++) {
81 + assetsList.add(assets.optString(i));
82 + }
83 + this.eligibleAssets.addAll(assetsList);
84 + }
85 + this.id = jobj.optString("id");
86 + this.businessAdditionalId = jobj.optString("businessAdditionalId");
87 + this.treatmentCode = jobj.optString("treatmentCode");
88 + this.offerName = jobj.optString("offerName");
89 + this.productType = jobj.optString("productType");
90 + this.provDuration = jobj.optString("provDuration");
91 + this.noOfRecurrance = jobj.optString("noOfRecurrance");
92 + this.price = jobj.optString("price");
93 + this.discount = jobj.optString("discount");
94 + this.voiceCategory = jobj.optString("voiceCategory");
95 + this.dataCategory = jobj.optString("dataCategory");
96 + this.minsValue = jobj.optString("minsValue");
97 + this.dataValue = jobj.optString("dataValue");
98 + this.provStepValueMins = jobj.optString("provStepValueMins");
99 + this.postpayProduct = jobj.optString("postpayProduct");
100 + this.notificationMessage = jobj.optString("notificationMessage");
101 + this.loyaltyCampaignId = jobj.optString("loyaltyCampaignId");
102 + this.businessService = jobj.optString("businessService");
103 + this.UACIOfferTrackingCode = jobj.optString("UACIOfferTrackingCode");
104 + this.offerCode1 = jobj.optString("offerCode1");
105 + this.score = jobj.optString("score");
106 + this.zone = jobj.optString("zone");
107 + this.wave = jobj.optString("wave");
108 + this.validity = jobj.optString("validity");
109 + this.offerAudienceLevel = jobj.optString("offerAudienceLevel");
110 + }
111 + }
112 +
69 public String getSessionId() { 113 public String getSessionId() {
70 return sessionId; 114 return sessionId;
71 } 115 }
......
1 +/*
2 + * Copyright 2010-2013 Warply Ltd. All rights reserved.
3 + *
4 + * Redistribution and use in source and binary forms, without modification, are
5 + * permitted provided that the following conditions are met:
6 + *
7 + * 1. Redistributions of source code must retain the above copyright notice,
8 + * this list of conditions and the following disclaimer.
9 + *
10 + * 2. Redistributions in binary form must reproduce the above copyright notice,
11 + * this list of conditions and the following disclaimer in the documentation
12 + * and/or other materials provided with the distribution.
13 + *
14 + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
15 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17 + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 + */
25 +
26 +package ly.warp.sdk.io.models;
27 +
28 +/**
29 + * Created by Panagiotis Triantafyllou on 08-July-22.
30 + */
31 +
32 +public class WarplyPacingEventModel {
33 +
34 + private boolean isVisible = false;
35 + private boolean isEnabled = false;
36 +
37 +
38 + public WarplyPacingEventModel() {
39 + this.isVisible = false;
40 + this.isEnabled = false;
41 + }
42 +
43 + public boolean isVisible() {
44 + return isVisible;
45 + }
46 +
47 + public void setVisible(boolean visible) {
48 + isVisible = visible;
49 + }
50 +
51 + public boolean isEnabled() {
52 + return isEnabled;
53 + }
54 +
55 + public void setEnabled(boolean enabled) {
56 + isEnabled = enabled;
57 + }
58 +}
...@@ -38,6 +38,7 @@ import java.util.HashMap; ...@@ -38,6 +38,7 @@ import java.util.HashMap;
38 38
39 import ly.warp.sdk.R; 39 import ly.warp.sdk.R;
40 import ly.warp.sdk.Warply; 40 import ly.warp.sdk.Warply;
41 +import ly.warp.sdk.activities.WarpViewActivity;
41 import ly.warp.sdk.db.WarplyDBHelper; 42 import ly.warp.sdk.db.WarplyDBHelper;
42 import ly.warp.sdk.io.callbacks.CallbackReceiver; 43 import ly.warp.sdk.io.callbacks.CallbackReceiver;
43 import ly.warp.sdk.io.models.ActiveDFYCouponModel; 44 import ly.warp.sdk.io.models.ActiveDFYCouponModel;
...@@ -313,7 +314,8 @@ public class WarplyManagerHelper { ...@@ -313,7 +314,8 @@ public class WarplyManagerHelper {
313 + "&VALIDITY=" + ccmsItem.getValidity() 314 + "&VALIDITY=" + ccmsItem.getValidity()
314 + "&TREATMENT_CODE=" + ccmsItem.getTreatmentCode() 315 + "&TREATMENT_CODE=" + ccmsItem.getTreatmentCode()
315 + "&OfferAudienceLevel=" + tempAudienceLevel 316 + "&OfferAudienceLevel=" + tempAudienceLevel
316 - + "&ASSETS=" + assets; 317 + + "&ASSETS=" + assets
318 + + "&ZONE=" + ccmsItem.getZone();
317 319
318 320
319 // if (mConsumer != null) 321 // if (mConsumer != null)
...@@ -330,15 +332,13 @@ public class WarplyManagerHelper { ...@@ -330,15 +332,13 @@ public class WarplyManagerHelper {
330 public static String constructCcmsUrl(LoyaltyContextualOfferModel item) { 332 public static String constructCcmsUrl(LoyaltyContextualOfferModel item) {
331 String url = ""; 333 String url = "";
332 if (item != null) { 334 if (item != null) {
333 - if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) { 335 + if (mCampaignList != null && mCampaignList.size() > 0) {
334 - for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { 336 + for (Campaign camp : mCampaignList) {
335 try { 337 try {
336 - String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); 338 + JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
337 - if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) { 339 + if (extraFields != null) {
338 - String keyValue = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key); 340 + if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
339 - if (!TextUtils.isEmpty(keyValue) && keyValue.equals("true")) { 341 + if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
340 - if (camp.getSessionUUID().equals(item.getLoyaltyCampaignId())) {
341 - Log.v("CCMS_PRESSED", item.getId() + " " + item.getOfferName());
342 String tempAudienceLevel = item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID"; 342 String tempAudienceLevel = item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID";
343 String assets = ""; 343 String assets = "";
344 if (item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0) { 344 if (item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0) {
...@@ -350,6 +350,7 @@ public class WarplyManagerHelper { ...@@ -350,6 +350,7 @@ public class WarplyManagerHelper {
350 assets = assets.substring(0, assets.length() - 1); 350 assets = assets.substring(0, assets.length() - 1);
351 } 351 }
352 } 352 }
353 +
353 url = camp.getIndexUrl() 354 url = camp.getIndexUrl()
354 + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) 355 + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
355 + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) 356 + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
...@@ -379,7 +380,8 @@ public class WarplyManagerHelper { ...@@ -379,7 +380,8 @@ public class WarplyManagerHelper {
379 + "&VALIDITY=" + item.getValidity() 380 + "&VALIDITY=" + item.getValidity()
380 + "&TREATMENT_CODE=" + item.getTreatmentCode() 381 + "&TREATMENT_CODE=" + item.getTreatmentCode()
381 + "&OfferAudienceLevel=" + tempAudienceLevel 382 + "&OfferAudienceLevel=" + tempAudienceLevel
382 - + "&ASSETS=" + assets; 383 + + "&ASSETS=" + assets
384 + + "&ZONE=" + item.getZone();
383 break; 385 break;
384 } 386 }
385 } 387 }
...@@ -649,7 +651,8 @@ public class WarplyManagerHelper { ...@@ -649,7 +651,8 @@ public class WarplyManagerHelper {
649 badge.setCouponCount(couponCount); 651 badge.setCouponCount(couponCount);
650 badge.setValue(couponValue); 652 badge.setValue(couponValue);
651 mLoyaltyBadge = badge; 653 mLoyaltyBadge = badge;
652 - mCouponList = cpnlist; 654 + mCouponList.clear();
655 + mCouponList.addAll(cpnlist);
653 } 656 }
654 657
655 public static LoyaltyBadgeModel getLoyaltyBadge() { 658 public static LoyaltyBadgeModel getLoyaltyBadge() {
......
...@@ -12,6 +12,7 @@ import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; ...@@ -12,6 +12,7 @@ import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
12 import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; 12 import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
13 import ly.warp.sdk.io.models.WarplyPacingCardEventModel; 13 import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
14 import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; 14 import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel;
15 +import ly.warp.sdk.io.models.WarplyPacingEventModel;
15 16
16 /** 17 /**
17 * Created by Panagiotis Triantafyllou on 26/Απρ/2022. 18 * Created by Panagiotis Triantafyllou on 26/Απρ/2022.
...@@ -21,6 +22,7 @@ public class WarplyEventBusManager { ...@@ -21,6 +22,7 @@ public class WarplyEventBusManager {
21 private LoyaltySDKFirebaseEventModel fireEvent; 22 private LoyaltySDKFirebaseEventModel fireEvent;
22 private LoyaltyContextualOfferModel ccms; 23 private LoyaltyContextualOfferModel ccms;
23 protected HashMap<String, Object> mWarplyEventBusManager = new HashMap(); 24 protected HashMap<String, Object> mWarplyEventBusManager = new HashMap();
25 + private WarplyPacingEventModel pacing;
24 private WarplyPacingCardEventModel pacingCard; 26 private WarplyPacingCardEventModel pacingCard;
25 private WarplyPacingCardServiceEnabledModel pacingService; 27 private WarplyPacingCardServiceEnabledModel pacingService;
26 private WarplyDealsAnalysisEventModel dealsAnalysis; 28 private WarplyDealsAnalysisEventModel dealsAnalysis;
...@@ -54,13 +56,17 @@ public class WarplyEventBusManager { ...@@ -54,13 +56,17 @@ public class WarplyEventBusManager {
54 this.fireEvent = fireEvent; 56 this.fireEvent = fireEvent;
55 } 57 }
56 58
57 - public WarplyEventBusManager(WarplyPacingCardEventModel pacingCard) { 59 + public WarplyEventBusManager(WarplyPacingEventModel pacing) {
58 - this.pacingCard = pacingCard; 60 + this.pacing = pacing;
59 } 61 }
60 62
61 - public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) { 63 +// public WarplyEventBusManager(WarplyPacingCardEventModel pacingCard) {
62 - this.pacingService = pacingService; 64 +// this.pacingCard = pacingCard;
63 - } 65 +// }
66 +//
67 +// public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) {
68 +// this.pacingService = pacingService;
69 +// }
64 70
65 public WarplyEventBusManager(WarplyDealsAnalysisEventModel dealsAnalysis) { 71 public WarplyEventBusManager(WarplyDealsAnalysisEventModel dealsAnalysis) {
66 this.dealsAnalysis = dealsAnalysis; 72 this.dealsAnalysis = dealsAnalysis;
...@@ -147,4 +153,8 @@ public class WarplyEventBusManager { ...@@ -147,4 +153,8 @@ public class WarplyEventBusManager {
147 public ActiveDFYCouponEventModel getActiveCoupon() { 153 public ActiveDFYCouponEventModel getActiveCoupon() {
148 return activeCoupon; 154 return activeCoupon;
149 } 155 }
156 +
157 + public WarplyPacingEventModel getPacing() {
158 + return pacing;
159 + }
150 } 160 }
......
...@@ -67,6 +67,7 @@ import ly.warp.sdk.io.models.CouponEventModel; ...@@ -67,6 +67,7 @@ import ly.warp.sdk.io.models.CouponEventModel;
67 import ly.warp.sdk.io.models.QuestionnaireEventModel; 67 import ly.warp.sdk.io.models.QuestionnaireEventModel;
68 import ly.warp.sdk.io.models.WarplyPacingCardEventModel; 68 import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
69 import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; 69 import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel;
70 +import ly.warp.sdk.io.models.WarplyPacingEventModel;
70 import ly.warp.sdk.services.UpdateUserLocationService; 71 import ly.warp.sdk.services.UpdateUserLocationService;
71 import ly.warp.sdk.utils.WarpUtils; 72 import ly.warp.sdk.utils.WarpUtils;
72 import ly.warp.sdk.utils.WarplyProperty; 73 import ly.warp.sdk.utils.WarplyProperty;
...@@ -398,19 +399,20 @@ public class WarpView extends WebView { ...@@ -398,19 +399,20 @@ public class WarpView extends WebView {
398 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 399 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
399 } else if (parts[2].equals("serviceDisabled")) { 400 } else if (parts[2].equals("serviceDisabled")) {
400 // WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG); 401 // WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG);
401 - WarplyPacingCardServiceEnabledModel pacingService = new WarplyPacingCardServiceEnabledModel(); 402 + WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
402 pacingService.setEnabled(false); 403 pacingService.setEnabled(false);
404 + pacingService.setVisible(false);
403 EventBus.getDefault().post(new WarplyEventBusManager(pacingService)); 405 EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
404 } else if (parts[2].equals("serviceEnabled")) { 406 } else if (parts[2].equals("serviceEnabled")) {
405 - WarplyPacingCardServiceEnabledModel pacingService = new WarplyPacingCardServiceEnabledModel(); 407 + WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
406 pacingService.setEnabled(true); 408 pacingService.setEnabled(true);
407 EventBus.getDefault().post(new WarplyEventBusManager(pacingService)); 409 EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
408 } else if (parts[2].equals("shortcutEnabled")) { 410 } else if (parts[2].equals("shortcutEnabled")) {
409 - WarplyPacingCardEventModel pacingVisible = new WarplyPacingCardEventModel(); 411 + WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
410 pacingVisible.setVisible(true); 412 pacingVisible.setVisible(true);
411 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); 413 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
412 } else if (parts[2].equals("shortcutDisabled")) { 414 } else if (parts[2].equals("shortcutDisabled")) {
413 - WarplyPacingCardEventModel pacingVisible = new WarplyPacingCardEventModel(); 415 + WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
414 pacingVisible.setVisible(false); 416 pacingVisible.setVisible(false);
415 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); 417 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
416 } else if (parts[1].equals("request") || parts[1].equals("response")) { 418 } else if (parts[1].equals("request") || parts[1].equals("response")) {
......