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
......
...@@ -63,6 +63,7 @@ import ly.warp.sdk.io.callbacks.WarplyReadyCallback; ...@@ -63,6 +63,7 @@ import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
63 import ly.warp.sdk.io.models.Campaign; 63 import ly.warp.sdk.io.models.Campaign;
64 import ly.warp.sdk.io.models.CampaignList; 64 import ly.warp.sdk.io.models.CampaignList;
65 import ly.warp.sdk.io.models.InboxStats; 65 import ly.warp.sdk.io.models.InboxStats;
66 +import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
66 import ly.warp.sdk.io.request.WarplyInboxRequest; 67 import ly.warp.sdk.io.request.WarplyInboxRequest;
67 import ly.warp.sdk.io.request.WarplyJsonArrayRequest; 68 import ly.warp.sdk.io.request.WarplyJsonArrayRequest;
68 import ly.warp.sdk.io.request.WarplyJsonObjectRequest; 69 import ly.warp.sdk.io.request.WarplyJsonObjectRequest;
...@@ -477,6 +478,300 @@ public enum Warply { ...@@ -477,6 +478,300 @@ public enum Warply {
477 @Override 478 @Override
478 public void onSuccess(CampaignList result) { 479 public void onSuccess(CampaignList result) {
479 WarplyManagerHelper.setCampaignList(result); 480 WarplyManagerHelper.setCampaignList(result);
481 +
482 + ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>();
483 + JSONArray jArray = null;
484 + try {
485 + jArray = new JSONArray("[\n" +
486 + " {\n" +
487 + " \"UACIOfferTrackingCode\": \"5166.e07.fffffffffa10663a.ffffffffda30c76a\",\n" +
488 + " \"businessAdditionalId\": \"\",\n" +
489 + " \"dataCategory\": \"Data\",\n" +
490 + " \"dataValue\": \"None\",\n" +
491 + " \"discount\": \"None\",\n" +
492 + " \"eligibleAssets\": [\n" +
493 + " \"306945218770\"\n" +
494 + " ],\n" +
495 + " \"id\": \"000003590\",\n" +
496 + " \"loyaltyCampaignId\": \"NA\",\n" +
497 + " \"minsValue\": \"None\",\n" +
498 + " \"noOfRecurrance\": \"None\",\n" +
499 + " \"notificationMessage\": \"None\",\n" +
500 + " \"offerAudienceLevel\": \"msisdn\",\n" +
501 + " \"offerCode1\": \"000003590\",\n" +
502 + " \"offerName\": \"CCMS loyalty white label\",\n" +
503 + " \"price\": \"None\",\n" +
504 + " \"productType\": \"White Label\",\n" +
505 + " \"provDuration\": \"0.0\",\n" +
506 + " \"provStepValueMins\": \"None\",\n" +
507 + " \"score\": \"50\",\n" +
508 + " \"treatmentCode\": \"5166.e07.fffffffffa10663a.ffffffffda30c76a\",\n" +
509 + " \"validity\": \"0\",\n" +
510 + " \"voiceCategory\": \"None\",\n" +
511 + " \"wave\": \"1\",\n" +
512 + " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
513 + " },\n" +
514 + " {\n" +
515 + " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" +
516 + " \"businessAdditionalId\": \"\",\n" +
517 + " \"dataCategory\": \"Data\",\n" +
518 + " \"dataValue\": \"None\",\n" +
519 + " \"discount\": \"None\",\n" +
520 + " \"eligibleAssets\": [\n" +
521 + " \"306945218770\"\n" +
522 + " ],\n" +
523 + " \"id\": \"000003599\",\n" +
524 + " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
525 + " \"minsValue\": \"None\",\n" +
526 + " \"noOfRecurrance\": \"None\",\n" +
527 + " \"notificationMessage\": \"None\",\n" +
528 + " \"offerAudienceLevel\": \"msisdn\",\n" +
529 + " \"offerCode1\": \"000003599\",\n" +
530 + " \"offerName\": \"CCMS loyalty white label with campaignId\",\n" +
531 + " \"price\": \"None\",\n" +
532 + " \"productType\": \"White Label\",\n" +
533 + " \"provDuration\": \"0.0\",\n" +
534 + " \"provStepValueMins\": \"None\",\n" +
535 + " \"score\": \"50\",\n" +
536 + " \"treatmentCode\": \"51ed.e10.2c006f18.71e96d08\",\n" +
537 + " \"validity\": \"0\",\n" +
538 + " \"voiceCategory\": \"None\",\n" +
539 + " \"wave\": \"1\",\n" +
540 + " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
541 + " },\n" +
542 + " {\n" +
543 + " \"UACIOfferTrackingCode\": \"516c.e05.ffffffffa943695b.79ff470b\",\n" +
544 + " \"businessAdditionalId\": \"\",\n" +
545 + " \"businessService\": \"0.0\",\n" +
546 + " \"eligibleAssets\": [\n" +
547 + " \"306945218770\"\n" +
548 + " ],\n" +
549 + " \"id\": \"000003588\",\n" +
550 + " \"loyaltyCampaignId\": \"NA\",\n" +
551 + " \"noOfRecurrance\": \"0\",\n" +
552 + " \"notificationMessage\": \"None\",\n" +
553 + " \"offerAudienceLevel\": \"msisdn\",\n" +
554 + " \"offerCode1\": \"000003588\",\n" +
555 + " \"offerName\": \"CCMS loyalty postpay addon\",\n" +
556 + " \"postpayProduct\": \"0.0\",\n" +
557 + " \"price\": \"None\",\n" +
558 + " \"productType\": \"MOBILE ADDON\",\n" +
559 + " \"provDuration\": \"0.0\",\n" +
560 + " \"score\": \"50\",\n" +
561 + " \"treatmentCode\": \"516c.e05.ffffffffa943695b.79ff470b\",\n" +
562 + " \"validity\": \"0\",\n" +
563 + " \"wave\": \"1\",\n" +
564 + " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
565 + " },\n" +
566 + " {\n" +
567 + " \"UACIOfferTrackingCode\": \"5224.e19.30e2f27b.ffffffffeb22b0db\",\n" +
568 + " \"businessAdditionalId\": \"\",\n" +
569 + " \"dataCategory\": \"Data\",\n" +
570 + " \"dataValue\": \"None\",\n" +
571 + " \"discount\": \"None\",\n" +
572 + " \"eligibleAssets\": [\n" +
573 + " \"306945218770\"\n" +
574 + " ],\n" +
575 + " \"id\": \"000003608\",\n" +
576 + " \"loyaltyCampaignId\": \"c134cdeb8a924f8eac38e261acb9caf5\",\n" +
577 + " \"minsValue\": \"None\",\n" +
578 + " \"noOfRecurrance\": \"None\",\n" +
579 + " \"notificationMessage\": \"None\",\n" +
580 + " \"offerAudienceLevel\": \"msisdn\",\n" +
581 + " \"offerCode1\": \"000003608\",\n" +
582 + " \"offerName\": \"CCMS loyalty gifts4u v1\",\n" +
583 + " \"price\": \"None\",\n" +
584 + " \"productType\": \"White Label\",\n" +
585 + " \"provDuration\": \"0.0\",\n" +
586 + " \"provStepValueMins\": \"None\",\n" +
587 + " \"score\": \"50\",\n" +
588 + " \"treatmentCode\": \"5224.e19.30e2f27b.ffffffffeb22b0db\",\n" +
589 + " \"validity\": \"0\",\n" +
590 + " \"voiceCategory\": \"None\",\n" +
591 + " \"wave\": \"1\",\n" +
592 + " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
593 + " },\n" +
594 + " {\n" +
595 + " \"UACIOfferTrackingCode\": \"5228.e1d.38378e61.750186c1\",\n" +
596 + " \"businessAdditionalId\": \"\",\n" +
597 + " \"businessService\": \"0.0\",\n" +
598 + " \"eligibleAssets\": [\n" +
599 + " \"306945218770\"\n" +
600 + " ],\n" +
601 + " \"id\": \"000003612\",\n" +
602 + " \"loyaltyCampaignId\": \"8eb71c4ceaff409c896e2d1f6f1c20f3\",\n" +
603 + " \"noOfRecurrance\": \"0\",\n" +
604 + " \"notificationMessage\": \"None\",\n" +
605 + " \"offerAudienceLevel\": \"msisdn\",\n" +
606 + " \"offerCode1\": \"000003612\",\n" +
607 + " \"offerName\": \"CCMS loyalty - postpay addon gifts4u\",\n" +
608 + " \"postpayProduct\": \"0.0\",\n" +
609 + " \"price\": \"None\",\n" +
610 + " \"productType\": \"MOBILE ADDON\",\n" +
611 + " \"provDuration\": \"0.0\",\n" +
612 + " \"score\": \"50\",\n" +
613 + " \"treatmentCode\": \"5228.e1d.38378e61.750186c1\",\n" +
614 + " \"validity\": \"0\",\n" +
615 + " \"wave\": \"1\",\n" +
616 + " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
617 + " },\n" +
618 + " {\n" +
619 + " \"UACIOfferTrackingCode\": \"5222.e1b.ffffffffe725d1b3.ffffffffed6d8723\",\n" +
620 + " \"businessAdditionalId\": \"\",\n" +
621 + " \"dataCategory\": \"Data\",\n" +
622 + " \"dataValue\": \"None\",\n" +
623 + " \"discount\": \"None\",\n" +
624 + " \"eligibleAssets\": [\n" +
625 + " \"306945218770\"\n" +
626 + " ],\n" +
627 + " \"id\": \"000003610\",\n" +
628 + " \"loyaltyCampaignId\": \"8e2c88ec94c948d8b51577324ed9a4d5\",\n" +
629 + " \"minsValue\": \"None\",\n" +
630 + " \"noOfRecurrance\": \"None\",\n" +
631 + " \"notificationMessage\": \"None\",\n" +
632 + " \"offerAudienceLevel\": \"msisdn\",\n" +
633 + " \"offerCode1\": \"000003610\",\n" +
634 + " \"offerName\": \"CCMS loyalty more4u v1\",\n" +
635 + " \"price\": \"20\",\n" +
636 + " \"productType\": \"White Label\",\n" +
637 + " \"provDuration\": \"7.0\",\n" +
638 + " \"provStepValueMins\": \"None\",\n" +
639 + " \"score\": \"60\",\n" +
640 + " \"treatmentCode\": \"5222.e1b.ffffffffe725d1b3.ffffffffed6d8723\",\n" +
641 + " \"validity\": \"0\",\n" +
642 + " \"voiceCategory\": \"None\",\n" +
643 + " \"wave\": \"1\",\n" +
644 + " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
645 + " },\n" +
646 + " {\n" +
647 + " \"UACIOfferTrackingCode\": \"5226.e1f.728b68c6.ffffffffa6c7b10e\",\n" +
648 + " \"businessAdditionalId\": \"\",\n" +
649 + " \"businessService\": \"0.0\",\n" +
650 + " \"eligibleAssets\": [\n" +
651 + " \"306945218770\"\n" +
652 + " ],\n" +
653 + " \"id\": \"000003614\",\n" +
654 + " \"loyaltyCampaignId\": \"aaf4022194584f02bb84c7b283c7c51e\",\n" +
655 + " \"noOfRecurrance\": \"0\",\n" +
656 + " \"notificationMessage\": \"None\",\n" +
657 + " \"offerAudienceLevel\": \"msisdn\",\n" +
658 + " \"offerCode1\": \"000003614\",\n" +
659 + " \"offerName\": \"CCMS loyalty - postpay addon more4u\",\n" +
660 + " \"postpayProduct\": \"0.0\",\n" +
661 + " \"price\": \"None\",\n" +
662 + " \"productType\": \"MOBILE ADDON\",\n" +
663 + " \"provDuration\": \"0.0\",\n" +
664 + " \"score\": \"50\",\n" +
665 + " \"treatmentCode\": \"5226.e1f.728b68c6.ffffffffa6c7b10e\",\n" +
666 + " \"validity\": \"0\",\n" +
667 + " \"wave\": \"1\",\n" +
668 + " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
669 + " },\n" +
670 + " {\n" +
671 + " \"UACIOfferTrackingCode\": \"5154.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
672 + " \"businessAdditionalId\": \"\",\n" +
673 + " \"eligibleAssets\": [],\n" +
674 + " \"id\": \"000003586\",\n" +
675 + " \"loyaltyCampaignId\": \"NA\",\n" +
676 + " \"offerAudienceLevel\": \"guid\",\n" +
677 + " \"offerCode1\": \"000003586\",\n" +
678 + " \"offerName\": \"CCMS loyalty offer 6\",\n" +
679 + " \"productType\": \"GENERIC\",\n" +
680 + " \"score\": \"50\",\n" +
681 + " \"treatmentCode\": \"5154.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
682 + " \"validity\": \"0\",\n" +
683 + " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
684 + " },\n" +
685 + " {\n" +
686 + " \"UACIOfferTrackingCode\": \"51d2.e0c.291f49d9.40d5a689\",\n" +
687 + " \"businessAdditionalId\": \"\",\n" +
688 + " \"eligibleAssets\": [],\n" +
689 + " \"id\": \"000003595\",\n" +
690 + " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
691 + " \"offerAudienceLevel\": \"guid\",\n" +
692 + " \"offerCode1\": \"000003595\",\n" +
693 + " \"offerName\": \"CCMS Loyal offer campaignId\",\n" +
694 + " \"productType\": \"GENERIC\",\n" +
695 + " \"score\": \"50\",\n" +
696 + " \"treatmentCode\": \"51d2.e0c.291f49d9.40d5a689\",\n" +
697 + " \"validity\": \"0\",\n" +
698 + " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
699 + " },\n" +
700 + " {\n" +
701 + " \"UACIOfferTrackingCode\": \"51d6.e0c.291f49d9.40d5a689\",\n" +
702 + " \"businessAdditionalId\": \"\",\n" +
703 + " \"eligibleAssets\": [],\n" +
704 + " \"id\": \"000003595\",\n" +
705 + " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
706 + " \"offerAudienceLevel\": \"guid\",\n" +
707 + " \"offerCode1\": \"000003595\",\n" +
708 + " \"offerName\": \"CCMS Loyal offer campaignId\",\n" +
709 + " \"productType\": \"GENERIC\",\n" +
710 + " \"score\": \"50\",\n" +
711 + " \"treatmentCode\": \"51d6.e0c.291f49d9.40d5a689\",\n" +
712 + " \"validity\": \"0\",\n" +
713 + " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
714 + " },\n" +
715 + " {\n" +
716 + " \"UACIOfferTrackingCode\": \"5150.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
717 + " \"businessAdditionalId\": \"\",\n" +
718 + " \"eligibleAssets\": [],\n" +
719 + " \"id\": \"000003586\",\n" +
720 + " \"loyaltyCampaignId\": \"NA\",\n" +
721 + " \"offerAudienceLevel\": \"guid\",\n" +
722 + " \"offerCode1\": \"000003586\",\n" +
723 + " \"offerName\": \"CCMS loyalty offer 6\",\n" +
724 + " \"productType\": \"GENERIC\",\n" +
725 + " \"score\": \"50\",\n" +
726 + " \"treatmentCode\": \"5150.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
727 + " \"validity\": \"0\",\n" +
728 + " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
729 + " },\n" +
730 + " {\n" +
731 + " \"UACIOfferTrackingCode\": \"5152.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
732 + " \"businessAdditionalId\": \"\",\n" +
733 + " \"eligibleAssets\": [],\n" +
734 + " \"id\": \"000003586\",\n" +
735 + " \"loyaltyCampaignId\": \"NA\",\n" +
736 + " \"offerAudienceLevel\": \"guid\",\n" +
737 + " \"offerCode1\": \"000003586\",\n" +
738 + " \"offerName\": \"CCMS loyalty offer 6\",\n" +
739 + " \"productType\": \"GENERIC\",\n" +
740 + " \"score\": \"50\",\n" +
741 + " \"treatmentCode\": \"5152.e03.ffffffffeebc476a.ffffffffc5b96f6a\",\n" +
742 + " \"validity\": \"0\",\n" +
743 + " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
744 + " },\n" +
745 + " {\n" +
746 + " \"UACIOfferTrackingCode\": \"51d4.e0c.291f49d9.40d5a689\",\n" +
747 + " \"businessAdditionalId\": \"\",\n" +
748 + " \"eligibleAssets\": [],\n" +
749 + " \"id\": \"000003595\",\n" +
750 + " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
751 + " \"offerAudienceLevel\": \"guid\",\n" +
752 + " \"offerCode1\": \"000003595\",\n" +
753 + " \"offerName\": \"CCMS Loyal offer campaignId\",\n" +
754 + " \"productType\": \"GENERIC\",\n" +
755 + " \"score\": \"50\",\n" +
756 + " \"treatmentCode\": \"51d4.e0c.291f49d9.40d5a689\",\n" +
757 + " \"validity\": \"0\",\n" +
758 + " \"zone\": \"COSMOTE_APP_MORE4U\"\n" +
759 + " }\n" +
760 + " ]");
761 + } catch (JSONException e) {
762 + e.printStackTrace();
763 + }
764 + if (jArray != null && jArray.length() > 0) {
765 + for (int i = 0; i < jArray.length(); i++) {
766 + JSONObject jobj = new JSONObject();
767 + jobj = jArray.optJSONObject(i);
768 + if (jobj != null) {
769 + LoyaltyContextualOfferModel model = new LoyaltyContextualOfferModel(jobj);
770 + list.add(model);
771 + }
772 + }
773 + }
774 + WarplyManagerHelper.setCCMSLoyaltyCampaigns(list);
480 if (result.size() >= 0) { 775 if (result.size() >= 0) {
481 objectSerializer.serialize(result, File.separator + requestSignature); 776 objectSerializer.serialize(result, File.separator + requestSignature);
482 warplyPreferences.saveInboxLastCachedTimeStamp(requestSignature, System.currentTimeMillis()); 777 warplyPreferences.saveInboxLastCachedTimeStamp(requestSignature, System.currentTimeMillis());
......
...@@ -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")) {
......