Panagiotis Triantafyllou

additions

...@@ -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-cosbeta37' 5 + PUBLISH_VERSION = '4.5.4-cosbeta38'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -349,7 +349,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -349,7 +349,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
349 try { 349 try {
350 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 350 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
351 if (extraFields != null) { 351 if (extraFields != null) {
352 - if (extraFields.length() == 0 || !extraFields.has("ccms_offer") || !(extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true"))) { 352 + if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
353 gfyList.add(camp); 353 gfyList.add(camp);
354 } 354 }
355 } 355 }
......
...@@ -234,7 +234,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -234,7 +234,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
234 try { 234 try {
235 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 235 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
236 if (extraFields != null) { 236 if (extraFields != null) {
237 - if (extraFields.length() == 0 || !extraFields.has("ccms_offer") || !(extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true"))) { 237 + if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
238 gfyList.add(camp); 238 gfyList.add(camp);
239 } 239 }
240 } 240 }
......
...@@ -38,10 +38,17 @@ public class LoyaltyContextualOfferModel implements Serializable { ...@@ -38,10 +38,17 @@ public class LoyaltyContextualOfferModel implements Serializable {
38 private String wave; 38 private String wave;
39 private String validity; 39 private String validity;
40 private String offerAudienceLevel; 40 private String offerAudienceLevel;
41 - private String imageUrl; 41 + private String imageUrl; // εξωτερική εικόνα
42 - private String title; 42 + private String title; // τίτλος εξωτερικά
43 - private String subtitle; 43 + private String subtitle; // για more for you 2ο λεκτικό
44 - private String description; 44 + private String message; // για more for you 3ο λεκτικό
45 + private String titleOffer; // τιτλος εσωτερικά
46 + private String imageOfferUrl; // εικόνα εσωτερικά
47 + private String duration; // διάρκεια
48 + private String giftType; // είδος δώρου
49 + private String giftValue; // αξία δώρου
50 + private String description; // περιγραφή
51 + private String termsAndConditions; // όροι
45 52
46 53
47 public LoyaltyContextualOfferModel() { 54 public LoyaltyContextualOfferModel() {
...@@ -75,7 +82,14 @@ public class LoyaltyContextualOfferModel implements Serializable { ...@@ -75,7 +82,14 @@ public class LoyaltyContextualOfferModel implements Serializable {
75 this.imageUrl = ""; 82 this.imageUrl = "";
76 this.title = ""; 83 this.title = "";
77 this.subtitle = ""; 84 this.subtitle = "";
85 + this.message = "";
86 + this.titleOffer = "";
87 + this.imageOfferUrl = "";
88 + this.duration = "";
89 + this.giftType = "";
90 + this.giftValue = "";
78 this.description = ""; 91 this.description = "";
92 + this.termsAndConditions = "";
79 } 93 }
80 94
81 public LoyaltyContextualOfferModel(JSONObject jobj) { 95 public LoyaltyContextualOfferModel(JSONObject jobj) {
...@@ -119,7 +133,14 @@ public class LoyaltyContextualOfferModel implements Serializable { ...@@ -119,7 +133,14 @@ public class LoyaltyContextualOfferModel implements Serializable {
119 this.imageUrl = jobj.optString("imageUrl"); 133 this.imageUrl = jobj.optString("imageUrl");
120 this.title = jobj.optString("title"); 134 this.title = jobj.optString("title");
121 this.subtitle = jobj.optString("subtitle"); 135 this.subtitle = jobj.optString("subtitle");
136 + this.message = jobj.optString("message");
137 + this.titleOffer = jobj.optString("titleOffer");
138 + this.imageOfferUrl = jobj.optString("imageOfferUrl");
139 + this.duration = jobj.optString("duration");
140 + this.giftType = jobj.optString("giftType");
141 + this.giftValue = jobj.optString("giftValue");
122 this.description = jobj.optString("description"); 142 this.description = jobj.optString("description");
143 + this.termsAndConditions = jobj.optString("termsAndConditions");
123 } 144 }
124 } 145 }
125 146
...@@ -363,6 +384,54 @@ public class LoyaltyContextualOfferModel implements Serializable { ...@@ -363,6 +384,54 @@ public class LoyaltyContextualOfferModel implements Serializable {
363 this.subtitle = subtitle; 384 this.subtitle = subtitle;
364 } 385 }
365 386
387 + public String getMessage() {
388 + return message;
389 + }
390 +
391 + public void setMessage(String message) {
392 + this.message = message;
393 + }
394 +
395 + public String getTitleOffer() {
396 + return titleOffer;
397 + }
398 +
399 + public void setTitleOffer(String titleOffer) {
400 + this.titleOffer = titleOffer;
401 + }
402 +
403 + public String getImageOfferUrl() {
404 + return imageOfferUrl;
405 + }
406 +
407 + public void setImageOfferUrl(String imageOfferUrl) {
408 + this.imageOfferUrl = imageOfferUrl;
409 + }
410 +
411 + public String getDuration() {
412 + return duration;
413 + }
414 +
415 + public void setDuration(String duration) {
416 + this.duration = duration;
417 + }
418 +
419 + public String getGiftType() {
420 + return giftType;
421 + }
422 +
423 + public void setGiftType(String giftType) {
424 + this.giftType = giftType;
425 + }
426 +
427 + public String getGiftValue() {
428 + return giftValue;
429 + }
430 +
431 + public void setGiftValue(String giftValue) {
432 + this.giftValue = giftValue;
433 + }
434 +
366 public String getDescription() { 435 public String getDescription() {
367 return description; 436 return description;
368 } 437 }
...@@ -370,4 +439,12 @@ public class LoyaltyContextualOfferModel implements Serializable { ...@@ -370,4 +439,12 @@ public class LoyaltyContextualOfferModel implements Serializable {
370 public void setDescription(String description) { 439 public void setDescription(String description) {
371 this.description = description; 440 this.description = description;
372 } 441 }
442 +
443 + public String getTermsAndConditions() {
444 + return termsAndConditions;
445 + }
446 +
447 + public void setTermsAndConditions(String termsAndConditions) {
448 + this.termsAndConditions = termsAndConditions;
449 + }
373 } 450 }
......
...@@ -45,6 +45,7 @@ import ly.warp.sdk.R; ...@@ -45,6 +45,7 @@ import ly.warp.sdk.R;
45 import ly.warp.sdk.Warply; 45 import ly.warp.sdk.Warply;
46 import ly.warp.sdk.activities.CouponsetInfoActivity; 46 import ly.warp.sdk.activities.CouponsetInfoActivity;
47 import ly.warp.sdk.activities.GiftsForYouActivity; 47 import ly.warp.sdk.activities.GiftsForYouActivity;
48 +import ly.warp.sdk.activities.MoreForYouActivity;
48 import ly.warp.sdk.activities.TelcoActivity; 49 import ly.warp.sdk.activities.TelcoActivity;
49 import ly.warp.sdk.activities.WarpViewActivity; 50 import ly.warp.sdk.activities.WarpViewActivity;
50 import ly.warp.sdk.db.WarplyDBHelper; 51 import ly.warp.sdk.db.WarplyDBHelper;
...@@ -416,6 +417,110 @@ public class WarplyManagerHelper { ...@@ -416,6 +417,110 @@ public class WarplyManagerHelper {
416 return url; 417 return url;
417 } 418 }
418 419
420 + public static void handleContextualCampaigns(Context context, LoyaltyContextualOfferModel item) {
421 + if (item != null) {
422 + if (mCampaignListAll != null && mCampaignListAll.size() > 0) {
423 + for (Campaign camp : mCampaignListAll) {
424 + try {
425 + JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
426 + if (extraFields != null) {
427 + if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
428 + if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
429 + String assets = "";
430 + if (item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0) {
431 + for (String singleAsset : item.getEligibleAssets()) {
432 + assets = assets + singleAsset + ",";
433 + }
434 +
435 + if (!TextUtils.isEmpty(assets)) {
436 + assets = assets.substring(0, assets.length() - 1);
437 + }
438 + }
439 +
440 + String url = camp.getIndexUrl()
441 + + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
442 + + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
443 + + "&api_key=" + WarpUtils.getApiKey(Warply.getWarplyContext())
444 + + "&session_uuid=" + camp.getSessionUUID()
445 + + "&access_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
446 + + "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token")
447 + + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
448 + + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret")
449 + + "&Session_ID=" + item.getSessionId()
450 + + "&businessService=" + item.getBusinessService()
451 + + "&offerName=" + item.getOfferName()
452 + + "&productType=" + item.getProductType()
453 + + "&provDuration=" + item.getProvDuration()
454 + + "&noOfRecurrance=" + item.getNoOfRecurrance()
455 + + "&price=" + item.getPrice()
456 + + "&discount=" + item.getDiscount()
457 + + "&voiceCategory=" + item.getVoiceCategory()
458 + + "&dataCategory=" + item.getDataCategory()
459 + + "&minsValue=" + item.getMinsValue()
460 + + "&dataValue=" + item.getDataValue()
461 + + "&provStepValueMins=" + item.getProvStepValueMins()
462 + + "&UACIOfferTrackingCode=" + item.getUACIOfferTrackingCode()
463 + + "&OFFERCODE1=" + item.getOfferCode1()
464 + + "&SCORE=" + item.getScore()
465 + + "&WAVE=" + item.getWave()
466 + + "&VALIDITY=" + item.getValidity()
467 + + "&TREATMENT_CODE=" + item.getTreatmentCode()
468 + + "&OfferAudienceLevel=" + item.getOfferAudienceLevel()
469 + + "&ASSETS=" + assets
470 + + "&ZONE=" + item.getZone();
471 +
472 + context.startActivity(WarpViewActivity.createIntentFromURL(context, url));
473 + break;
474 + }
475 + } else if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
476 + if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
477 + Intent intent = new Intent(context, TelcoActivity.class);
478 + intent.putExtra("ccms", item);
479 + intent.putExtra("loyalty", (Serializable) camp);
480 + context.startActivity(intent);
481 + break;
482 + }
483 + }
484 + }
485 + } catch (Exception exception) {
486 + Log.v("handleContextual_Error", exception.toString());
487 + }
488 + }
489 + }
490 + }
491 + }
492 +
493 + public static void handleLoyaltyCampaigns(Context context, Campaign item) {
494 + if (item != null) {
495 + if (item.getType().equals("coupon")) {
496 + try {
497 + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
498 + if (campaignSettings != null) {
499 + if (campaignSettings.has("couponset")) {
500 + String cpnUuid = campaignSettings.optString("couponset");
501 + for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
502 + if (cpns.getUuid().equals(cpnUuid)) {
503 + Intent intent = new Intent(context, CouponsetInfoActivity.class);
504 + intent.putExtra("couponset", (Serializable) cpns);
505 + context.startActivity(intent);
506 + break;
507 + }
508 + }
509 + } else {
510 + context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(item)));
511 + }
512 + }
513 + } catch (Exception exception) {
514 + Log.v("handleLoyalty_Error", exception.toString());
515 + }
516 +
517 + return;
518 + }
519 +
520 + context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(item)));
521 + }
522 + }
523 +
419 /** 524 /**
420 * Set the List with CCMS Campaigns 525 * Set the List with CCMS Campaigns
421 */ 526 */
......
...@@ -1892,7 +1892,7 @@ public class WarplyManager { ...@@ -1892,7 +1892,7 @@ public class WarplyManager {
1892 // } 1892 // }
1893 // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list); 1893 // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list);
1894 1894
1895 - receiver.onSuccess(/*result*/campaignLoyaltyList); 1895 + receiver.onSuccess(campaignLoyaltyList); //result
1896 } 1896 }
1897 1897
1898 @Override 1898 @Override
......
...@@ -432,7 +432,7 @@ public class WarpView extends WebView { ...@@ -432,7 +432,7 @@ public class WarpView extends WebView {
432 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); 432 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
433 } else if (parts[1].equals("request") || parts[1].equals("response")) { 433 } else if (parts[1].equals("request") || parts[1].equals("response")) {
434 WarpUtils.log("**************** WARPLY Webview Log START *****************"); 434 WarpUtils.log("**************** WARPLY Webview Log START *****************");
435 - WarpUtils.verbose(parts[2]); 435 + WarpUtils.log(message);
436 WarpUtils.log("**************** WARPLY Webview Log END *****************"); 436 WarpUtils.log("**************** WARPLY Webview Log END *****************");
437 } 437 }
438 } 438 }
......