Panagiotis Triantafyllou

additions

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta37'
PUBLISH_VERSION = '4.5.4-cosbeta38'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -349,7 +349,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !extraFields.has("ccms_offer") || !(extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true"))) {
if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
gfyList.add(camp);
}
}
......
......@@ -234,7 +234,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !extraFields.has("ccms_offer") || !(extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true"))) {
if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
gfyList.add(camp);
}
}
......
......@@ -38,10 +38,17 @@ public class LoyaltyContextualOfferModel implements Serializable {
private String wave;
private String validity;
private String offerAudienceLevel;
private String imageUrl;
private String title;
private String subtitle;
private String description;
private String imageUrl; // εξωτερική εικόνα
private String title; // τίτλος εξωτερικά
private String subtitle; // για more for you 2ο λεκτικό
private String message; // για more for you 3ο λεκτικό
private String titleOffer; // τιτλος εσωτερικά
private String imageOfferUrl; // εικόνα εσωτερικά
private String duration; // διάρκεια
private String giftType; // είδος δώρου
private String giftValue; // αξία δώρου
private String description; // περιγραφή
private String termsAndConditions; // όροι
public LoyaltyContextualOfferModel() {
......@@ -75,7 +82,14 @@ public class LoyaltyContextualOfferModel implements Serializable {
this.imageUrl = "";
this.title = "";
this.subtitle = "";
this.message = "";
this.titleOffer = "";
this.imageOfferUrl = "";
this.duration = "";
this.giftType = "";
this.giftValue = "";
this.description = "";
this.termsAndConditions = "";
}
public LoyaltyContextualOfferModel(JSONObject jobj) {
......@@ -119,7 +133,14 @@ public class LoyaltyContextualOfferModel implements Serializable {
this.imageUrl = jobj.optString("imageUrl");
this.title = jobj.optString("title");
this.subtitle = jobj.optString("subtitle");
this.message = jobj.optString("message");
this.titleOffer = jobj.optString("titleOffer");
this.imageOfferUrl = jobj.optString("imageOfferUrl");
this.duration = jobj.optString("duration");
this.giftType = jobj.optString("giftType");
this.giftValue = jobj.optString("giftValue");
this.description = jobj.optString("description");
this.termsAndConditions = jobj.optString("termsAndConditions");
}
}
......@@ -363,6 +384,54 @@ public class LoyaltyContextualOfferModel implements Serializable {
this.subtitle = subtitle;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getTitleOffer() {
return titleOffer;
}
public void setTitleOffer(String titleOffer) {
this.titleOffer = titleOffer;
}
public String getImageOfferUrl() {
return imageOfferUrl;
}
public void setImageOfferUrl(String imageOfferUrl) {
this.imageOfferUrl = imageOfferUrl;
}
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getGiftType() {
return giftType;
}
public void setGiftType(String giftType) {
this.giftType = giftType;
}
public String getGiftValue() {
return giftValue;
}
public void setGiftValue(String giftValue) {
this.giftValue = giftValue;
}
public String getDescription() {
return description;
}
......@@ -370,4 +439,12 @@ public class LoyaltyContextualOfferModel implements Serializable {
public void setDescription(String description) {
this.description = description;
}
public String getTermsAndConditions() {
return termsAndConditions;
}
public void setTermsAndConditions(String termsAndConditions) {
this.termsAndConditions = termsAndConditions;
}
}
......
......@@ -45,6 +45,7 @@ import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.CouponsetInfoActivity;
import ly.warp.sdk.activities.GiftsForYouActivity;
import ly.warp.sdk.activities.MoreForYouActivity;
import ly.warp.sdk.activities.TelcoActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
......@@ -416,6 +417,110 @@ public class WarplyManagerHelper {
return url;
}
public static void handleContextualCampaigns(Context context, LoyaltyContextualOfferModel item) {
if (item != null) {
if (mCampaignListAll != null && mCampaignListAll.size() > 0) {
for (Campaign camp : mCampaignListAll) {
try {
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 assets = "";
if (item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0) {
for (String singleAsset : item.getEligibleAssets()) {
assets = assets + singleAsset + ",";
}
if (!TextUtils.isEmpty(assets)) {
assets = assets.substring(0, assets.length() - 1);
}
}
String url = camp.getIndexUrl()
+ "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
+ "&api_key=" + WarpUtils.getApiKey(Warply.getWarplyContext())
+ "&session_uuid=" + camp.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret")
+ "&Session_ID=" + item.getSessionId()
+ "&businessService=" + item.getBusinessService()
+ "&offerName=" + item.getOfferName()
+ "&productType=" + item.getProductType()
+ "&provDuration=" + item.getProvDuration()
+ "&noOfRecurrance=" + item.getNoOfRecurrance()
+ "&price=" + item.getPrice()
+ "&discount=" + item.getDiscount()
+ "&voiceCategory=" + item.getVoiceCategory()
+ "&dataCategory=" + item.getDataCategory()
+ "&minsValue=" + item.getMinsValue()
+ "&dataValue=" + item.getDataValue()
+ "&provStepValueMins=" + item.getProvStepValueMins()
+ "&UACIOfferTrackingCode=" + item.getUACIOfferTrackingCode()
+ "&OFFERCODE1=" + item.getOfferCode1()
+ "&SCORE=" + item.getScore()
+ "&WAVE=" + item.getWave()
+ "&VALIDITY=" + item.getValidity()
+ "&TREATMENT_CODE=" + item.getTreatmentCode()
+ "&OfferAudienceLevel=" + item.getOfferAudienceLevel()
+ "&ASSETS=" + assets
+ "&ZONE=" + item.getZone();
context.startActivity(WarpViewActivity.createIntentFromURL(context, url));
break;
}
} else if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
Intent intent = new Intent(context, TelcoActivity.class);
intent.putExtra("ccms", item);
intent.putExtra("loyalty", (Serializable) camp);
context.startActivity(intent);
break;
}
}
}
} catch (Exception exception) {
Log.v("handleContextual_Error", exception.toString());
}
}
}
}
}
public static void handleLoyaltyCampaigns(Context context, Campaign item) {
if (item != null) {
if (item.getType().equals("coupon")) {
try {
JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
if (campaignSettings != null) {
if (campaignSettings.has("couponset")) {
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
Intent intent = new Intent(context, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
context.startActivity(intent);
break;
}
}
} else {
context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(item)));
}
}
} catch (Exception exception) {
Log.v("handleLoyalty_Error", exception.toString());
}
return;
}
context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(item)));
}
}
/**
* Set the List with CCMS Campaigns
*/
......
......@@ -1892,7 +1892,7 @@ public class WarplyManager {
// }
// WarplyManagerHelper.setCCMSLoyaltyCampaigns(list);
receiver.onSuccess(/*result*/campaignLoyaltyList);
receiver.onSuccess(campaignLoyaltyList); //result
}
@Override
......
......@@ -432,7 +432,7 @@ public class WarpView extends WebView {
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
} else if (parts[1].equals("request") || parts[1].equals("response")) {
WarpUtils.log("**************** WARPLY Webview Log START *****************");
WarpUtils.verbose(parts[2]);
WarpUtils.log(message);
WarpUtils.log("**************** WARPLY Webview Log END *****************");
}
}
......