Panagiotis Triantafyllou

new version

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta27a'
PUBLISH_VERSION = '4.5.4-cosbeta28'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -129,9 +129,11 @@ public class WarpViewActivity extends WarpBaseActivity {
}
if (event.getCoupon() != null)
finish();
if (event.getPacingCard() != null)
finish();
if (event.getPacingService() != null)
// if (event.getPacingCard() != null)
// finish();
// if (event.getPacingService() != null)
// finish();
if (event.getPacing() != null)
finish();
}
......
package ly.warp.sdk.io.models;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
/**
......@@ -7,8 +10,8 @@ import java.util.ArrayList;
*/
public class LoyaltyContextualOfferModel {
private String sessionId; //Needed for Interest/Accept/Reject
private ArrayList<String> eligibleAssets; //Array of the eligible assets for this offer
private String sessionId;
private ArrayList<String> eligibleAssets;
private String id;
private String businessAdditionalId;
private String treatmentCode;
......@@ -66,6 +69,47 @@ public class LoyaltyContextualOfferModel {
this.offerAudienceLevel = "";
}
public LoyaltyContextualOfferModel(JSONObject jobj) {
if (jobj != null) {
this.sessionId = jobj.optString("sessionId");
this.eligibleAssets = new ArrayList<>();
JSONArray assets = new JSONArray();
assets = jobj.optJSONArray("eligibleAssets");
if (assets != null && assets.length() > 0) {
ArrayList<String> assetsList = new ArrayList<>();
for (int i = 0; i < assets.length(); i++) {
assetsList.add(assets.optString(i));
}
this.eligibleAssets.addAll(assetsList);
}
this.id = jobj.optString("id");
this.businessAdditionalId = jobj.optString("businessAdditionalId");
this.treatmentCode = jobj.optString("treatmentCode");
this.offerName = jobj.optString("offerName");
this.productType = jobj.optString("productType");
this.provDuration = jobj.optString("provDuration");
this.noOfRecurrance = jobj.optString("noOfRecurrance");
this.price = jobj.optString("price");
this.discount = jobj.optString("discount");
this.voiceCategory = jobj.optString("voiceCategory");
this.dataCategory = jobj.optString("dataCategory");
this.minsValue = jobj.optString("minsValue");
this.dataValue = jobj.optString("dataValue");
this.provStepValueMins = jobj.optString("provStepValueMins");
this.postpayProduct = jobj.optString("postpayProduct");
this.notificationMessage = jobj.optString("notificationMessage");
this.loyaltyCampaignId = jobj.optString("loyaltyCampaignId");
this.businessService = jobj.optString("businessService");
this.UACIOfferTrackingCode = jobj.optString("UACIOfferTrackingCode");
this.offerCode1 = jobj.optString("offerCode1");
this.score = jobj.optString("score");
this.zone = jobj.optString("zone");
this.wave = jobj.optString("wave");
this.validity = jobj.optString("validity");
this.offerAudienceLevel = jobj.optString("offerAudienceLevel");
}
}
public String getSessionId() {
return sessionId;
}
......
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 08-July-22.
*/
public class WarplyPacingEventModel {
private boolean isVisible = false;
private boolean isEnabled = false;
public WarplyPacingEventModel() {
this.isVisible = false;
this.isEnabled = false;
}
public boolean isVisible() {
return isVisible;
}
public void setVisible(boolean visible) {
isVisible = visible;
}
public boolean isEnabled() {
return isEnabled;
}
public void setEnabled(boolean enabled) {
isEnabled = enabled;
}
}
......@@ -38,6 +38,7 @@ import java.util.HashMap;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.ActiveDFYCouponModel;
......@@ -313,7 +314,8 @@ public class WarplyManagerHelper {
+ "&VALIDITY=" + ccmsItem.getValidity()
+ "&TREATMENT_CODE=" + ccmsItem.getTreatmentCode()
+ "&OfferAudienceLevel=" + tempAudienceLevel
+ "&ASSETS=" + assets;
+ "&ASSETS=" + assets
+ "&ZONE=" + ccmsItem.getZone();
// if (mConsumer != null)
......@@ -330,15 +332,13 @@ public class WarplyManagerHelper {
public static String constructCcmsUrl(LoyaltyContextualOfferModel item) {
String url = "";
if (item != null) {
if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) {
for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
if (mCampaignList != null && mCampaignList.size() > 0) {
for (Campaign camp : mCampaignList) {
try {
String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) {
String keyValue = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
if (!TextUtils.isEmpty(keyValue) && keyValue.equals("true")) {
if (camp.getSessionUUID().equals(item.getLoyaltyCampaignId())) {
Log.v("CCMS_PRESSED", item.getId() + " " + item.getOfferName());
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
String tempAudienceLevel = item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID";
String assets = "";
if (item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0) {
......@@ -350,6 +350,7 @@ public class WarplyManagerHelper {
assets = assets.substring(0, assets.length() - 1);
}
}
url = camp.getIndexUrl()
+ "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
......@@ -379,7 +380,8 @@ public class WarplyManagerHelper {
+ "&VALIDITY=" + item.getValidity()
+ "&TREATMENT_CODE=" + item.getTreatmentCode()
+ "&OfferAudienceLevel=" + tempAudienceLevel
+ "&ASSETS=" + assets;
+ "&ASSETS=" + assets
+ "&ZONE=" + item.getZone();
break;
}
}
......@@ -649,7 +651,8 @@ public class WarplyManagerHelper {
badge.setCouponCount(couponCount);
badge.setValue(couponValue);
mLoyaltyBadge = badge;
mCouponList = cpnlist;
mCouponList.clear();
mCouponList.addAll(cpnlist);
}
public static LoyaltyBadgeModel getLoyaltyBadge() {
......
......@@ -12,6 +12,7 @@ import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
/**
* Created by Panagiotis Triantafyllou on 26/Απρ/2022.
......@@ -21,6 +22,7 @@ public class WarplyEventBusManager {
private LoyaltySDKFirebaseEventModel fireEvent;
private LoyaltyContextualOfferModel ccms;
protected HashMap<String, Object> mWarplyEventBusManager = new HashMap();
private WarplyPacingEventModel pacing;
private WarplyPacingCardEventModel pacingCard;
private WarplyPacingCardServiceEnabledModel pacingService;
private WarplyDealsAnalysisEventModel dealsAnalysis;
......@@ -54,13 +56,17 @@ public class WarplyEventBusManager {
this.fireEvent = fireEvent;
}
public WarplyEventBusManager(WarplyPacingCardEventModel pacingCard) {
this.pacingCard = pacingCard;
public WarplyEventBusManager(WarplyPacingEventModel pacing) {
this.pacing = pacing;
}
public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) {
this.pacingService = pacingService;
}
// public WarplyEventBusManager(WarplyPacingCardEventModel pacingCard) {
// this.pacingCard = pacingCard;
// }
//
// public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) {
// this.pacingService = pacingService;
// }
public WarplyEventBusManager(WarplyDealsAnalysisEventModel dealsAnalysis) {
this.dealsAnalysis = dealsAnalysis;
......@@ -147,4 +153,8 @@ public class WarplyEventBusManager {
public ActiveDFYCouponEventModel getActiveCoupon() {
return activeCoupon;
}
public WarplyPacingEventModel getPacing() {
return pacing;
}
}
......
......@@ -67,6 +67,7 @@ import ly.warp.sdk.io.models.CouponEventModel;
import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.services.UpdateUserLocationService;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyProperty;
......@@ -398,19 +399,20 @@ public class WarpView extends WebView {
// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
} else if (parts[2].equals("serviceDisabled")) {
// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG);
WarplyPacingCardServiceEnabledModel pacingService = new WarplyPacingCardServiceEnabledModel();
WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
pacingService.setEnabled(false);
pacingService.setVisible(false);
EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
} else if (parts[2].equals("serviceEnabled")) {
WarplyPacingCardServiceEnabledModel pacingService = new WarplyPacingCardServiceEnabledModel();
WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
pacingService.setEnabled(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
} else if (parts[2].equals("shortcutEnabled")) {
WarplyPacingCardEventModel pacingVisible = new WarplyPacingCardEventModel();
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
} else if (parts[2].equals("shortcutDisabled")) {
WarplyPacingCardEventModel pacingVisible = new WarplyPacingCardEventModel();
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(false);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
} else if (parts[1].equals("request") || parts[1].equals("response")) {
......