Panagiotis Triantafyllou

uat changes 10_08_2022

...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { ...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
36 public void onWarplyReady() { 36 public void onWarplyReady() {
37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
39 - .setGuid("6012049139"), //6012049321, 6012049322, 6012049323 39 + .setGuid("6012049321"), //6012049321, 6012049322, 6012049323
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -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-cosbeta44' 5 + PUBLISH_VERSION = '4.5.4-cosbeta45'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -58,7 +58,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -58,7 +58,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
58 private LinearLayout mLlShareButton; 58 private LinearLayout mLlShareButton;
59 private String mSender = ""; 59 private String mSender = "";
60 private EditText mEdtReceiver; 60 private EditText mEdtReceiver;
61 - private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, mAlertDialogCouponAskSharing; 61 + private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing,
62 + mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing;
62 63
63 // =========================================================== 64 // ===========================================================
64 // Methods for/from SuperClass/Interfaces 65 // Methods for/from SuperClass/Interfaces
...@@ -205,6 +206,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -205,6 +206,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
205 .show(); 206 .show();
206 } 207 }
207 208
209 + private void wrongNumberDialog(String message) {
210 + mAlertDialogWrongNumberSharing = new AlertDialog.Builder(this)
211 + .setTitle(R.string.cos_dlg_error_title)
212 + .setMessage(message)
213 + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
214 + dialogPositive.dismiss();
215 + })
216 + .show();
217 + }
218 +
208 private void errorSharingDialog2() { 219 private void errorSharingDialog2() {
209 mAlertDialogErrorSharing = new AlertDialog.Builder(this) 220 mAlertDialogErrorSharing = new AlertDialog.Builder(this)
210 .setTitle(R.string.cos_dlg_error_title) 221 .setTitle(R.string.cos_dlg_error_title)
...@@ -253,9 +264,12 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -253,9 +264,12 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
253 @Override 264 @Override
254 public void onSuccess(JSONObject result) { 265 public void onSuccess(JSONObject result) {
255 int status = result.optInt("status", 2); 266 int status = result.optInt("status", 2);
267 + String message = result.optString("msg", "");
256 runOnUiThread(() -> { 268 runOnUiThread(() -> {
257 if (status == 1) 269 if (status == 1)
258 acceptSharingDialog(); 270 acceptSharingDialog();
271 + else if (status == 4)
272 + wrongNumberDialog(message);
259 else 273 else
260 errorSharingDialog(); 274 errorSharingDialog();
261 }); 275 });
......
...@@ -29,11 +29,13 @@ import ly.warp.sdk.io.models.CampaignList; ...@@ -29,11 +29,13 @@ import ly.warp.sdk.io.models.CampaignList;
29 import ly.warp.sdk.io.models.Coupon; 29 import ly.warp.sdk.io.models.Coupon;
30 import ly.warp.sdk.io.models.CouponList; 30 import ly.warp.sdk.io.models.CouponList;
31 import ly.warp.sdk.io.models.Couponset; 31 import ly.warp.sdk.io.models.Couponset;
32 +import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
32 import ly.warp.sdk.io.request.WarplyGetCampaignsRequest; 33 import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
33 import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; 34 import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
34 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 35 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
35 import ly.warp.sdk.services.EventCampaignService; 36 import ly.warp.sdk.services.EventCampaignService;
36 import ly.warp.sdk.services.EventService; 37 import ly.warp.sdk.services.EventService;
38 +import ly.warp.sdk.utils.WarplyManagerHelper;
37 import ly.warp.sdk.utils.managers.WarplyManager; 39 import ly.warp.sdk.utils.managers.WarplyManager;
38 40
39 41
...@@ -56,6 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -56,6 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
56 private boolean mIsTermsPressed = false; 58 private boolean mIsTermsPressed = false;
57 private AlertDialog mAlertDialogCouponset; 59 private AlertDialog mAlertDialogCouponset;
58 private Campaign mLoyalty; 60 private Campaign mLoyalty;
61 + private LoyaltyContextualOfferModel mCcms = null;
59 62
60 // =========================================================== 63 // ===========================================================
61 // Methods for/from SuperClass/Interfaces 64 // Methods for/from SuperClass/Interfaces
...@@ -68,6 +71,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -68,6 +71,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
68 71
69 mCouponset = (Couponset) getIntent().getSerializableExtra("couponset"); 72 mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
70 mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty"); 73 mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty");
74 + mCcms = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms");
71 75
72 mIvBack = findViewById(R.id.iv_couponset_info_back); 76 mIvBack = findViewById(R.id.iv_couponset_info_back);
73 mTvTerms = findViewById(R.id.tv_terms); 77 mTvTerms = findViewById(R.id.tv_terms);
...@@ -96,9 +100,37 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -96,9 +100,37 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
96 } 100 }
97 if (view.getId() == R.id.ll_get_gift) { 101 if (view.getId() == R.id.ll_get_gift) {
98 mPbLoading.setVisibility(View.VISIBLE); 102 mPbLoading.setVisibility(View.VISIBLE);
99 - WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() 103 + if (mCcms == null) {
100 - .setCouponsetUuid(mCouponset.getUuid()) 104 + WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
101 - .setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback); 105 + .setCouponsetUuid(mCouponset.getUuid())
106 + .setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback);
107 + } else {
108 + WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
109 + .setCouponsetUuid(mCouponset.getUuid())
110 + .setCommunicationUuid(mLoyalty.getSessionUUID())
111 + .setHasContextualOffer(true)
112 + .setUserMsisdn(WarplyManagerHelper.getConsumer().getMsisdn())
113 + .setBusinessService(mCcms.getBusinessService())
114 + .setOfferName(mCcms.getOfferName())
115 + .setProductType(mCcms.getProductType())
116 + .setProvDuration(mCcms.getProvDuration())
117 + .setNoOfRecurrance(mCcms.getNoOfRecurrance())
118 + .setPrice(mCcms.getPrice())
119 + .setDiscount(mCcms.getDiscount())
120 + .setVoiceCategory(mCcms.getVoiceCategory())
121 + .setDataCategory(mCcms.getDataCategory())
122 + .setMinsValue(mCcms.getMinsValue())
123 + .setDataValue(mCcms.getDataValue())
124 + .setProvStepValueMins(mCcms.getProvStepValueMins())
125 + .setOfferAudienceLevel(mCcms.getOfferAudienceLevel())
126 + .setUACIOfferTrackingCode(mCcms.getUACIOfferTrackingCode())
127 + .setOfferCode1(mCcms.getOfferCode1())
128 + .setScore(mCcms.getScore())
129 + .setZone(mCcms.getZone())
130 + .setWave(mCcms.getWave())
131 + .setValidity(mCcms.getValidity())
132 + .setTreatmentCode(mCcms.getTreatmentCode()), mRedeemCouponCallback);
133 + }
102 return; 134 return;
103 } 135 }
104 if (view.getId() == R.id.ll_terms_inner) { 136 if (view.getId() == R.id.ll_terms_inner) {
......
...@@ -483,6 +483,138 @@ public class Consumer implements Parcelable, Serializable { ...@@ -483,6 +483,138 @@ public class Consumer implements Parcelable, Serializable {
483 return sms_segmentation; 483 return sms_segmentation;
484 } 484 }
485 485
486 + public void setAckOptin(boolean ackOptin) {
487 + this.ackOptin = ackOptin;
488 + }
489 +
490 + public void setBillingInfo(JSONObject billingInfo) {
491 + this.billingInfo = billingInfo;
492 + }
493 +
494 + public void setBirthday(String birthday) {
495 + this.birthday = birthday;
496 + }
497 +
498 + public void setBurntPoints(double burntPoints) {
499 + this.burntPoints = burntPoints;
500 + }
501 +
502 + public void setCompanyName(String companyName) {
503 + this.companyName = companyName;
504 + }
505 +
506 + public void setConsumerMetadata(JSONObject consumerMetadata) {
507 + this.consumerMetadata = consumerMetadata;
508 + }
509 +
510 + public void setDisplayName(String displayName) {
511 + this.displayName = displayName;
512 + }
513 +
514 + public void setEmail(String email) {
515 + this.email = email;
516 + }
517 +
518 + public void setFirstName(String firstName) {
519 + this.firstName = firstName;
520 + }
521 +
522 + public void setGender(String gender) {
523 + this.gender = gender;
524 + }
525 +
526 + public void setImageUrl(String imageUrl) {
527 + this.imageUrl = imageUrl;
528 + }
529 +
530 + public void setLanguage(String language) {
531 + this.language = language;
532 + }
533 +
534 + public void setLastName(String lastName) {
535 + this.lastName = lastName;
536 + }
537 +
538 + public void setLoyaltyId(String loyaltyId) {
539 + this.loyaltyId = loyaltyId;
540 + }
541 +
542 + public void setMsisdn(String msisdn) {
543 + this.msisdn = msisdn;
544 + }
545 +
546 + public void setNameday(String nameday) {
547 + this.nameday = nameday;
548 + }
549 +
550 + public void setNickname(String nickname) {
551 + this.nickname = nickname;
552 + }
553 +
554 + public void setOptin(JSONObject optin) {
555 + this.optin = optin;
556 + }
557 +
558 + public void setPasswordSet(boolean passwordSet) {
559 + this.passwordSet = passwordSet;
560 + }
561 +
562 + public void setProfileMetadata(String profileMetadata) {
563 + this.profileMetadata = profileMetadata;
564 + }
565 +
566 + public void setRedeemedPoints(double redeemedPoints) {
567 + this.redeemedPoints = redeemedPoints;
568 + }
569 +
570 + public void setRetrievedPoints(double retrievedPoints) {
571 + this.retrievedPoints = retrievedPoints;
572 + }
573 +
574 + public void setSalutation(String salutation) {
575 + this.salutation = salutation;
576 + }
577 +
578 + public void setSubscribe(boolean subscribe) {
579 + this.subscribe = subscribe;
580 + }
581 +
582 + public void setTags(JSONObject tags) {
583 + this.tags = tags;
584 + }
585 +
586 + public void setTaxId(String taxId) {
587 + this.taxId = taxId;
588 + }
589 +
590 + public void setUserPoints(double userPoints) {
591 + this.userPoints = userPoints;
592 + }
593 +
594 + public void setUuid(String uuid) {
595 + this.uuid = uuid;
596 + }
597 +
598 + public void setVerified(boolean verified) {
599 + this.verified = verified;
600 + }
601 +
602 + public void setNewsletter(boolean newsletter) {
603 + this.newsletter = newsletter;
604 + }
605 +
606 + public void setSms(boolean sms) {
607 + this.sms = sms;
608 + }
609 +
610 + public void setSegmentation(boolean segmentation) {
611 + this.segmentation = segmentation;
612 + }
613 +
614 + public void setSms_segmentation(boolean sms_segmentation) {
615 + this.sms_segmentation = sms_segmentation;
616 + }
617 +
486 @Override 618 @Override
487 public int describeContents() { 619 public int describeContents() {
488 return 0; 620 return 0;
......
...@@ -33,12 +33,12 @@ public class MergedGifts { ...@@ -33,12 +33,12 @@ public class MergedGifts {
33 private int dataType = 0; 33 private int dataType = 0;
34 private LoyaltyGiftsForYouPackage seasonalList; 34 private LoyaltyGiftsForYouPackage seasonalList;
35 private Campaign campaign; 35 private Campaign campaign;
36 + private LoyaltyContextualOfferModel ccms;
36 37
37 public void setDataType(int dataType) { 38 public void setDataType(int dataType) {
38 this.dataType = dataType; 39 this.dataType = dataType;
39 } 40 }
40 41
41 -
42 public void setCampaign(Campaign campaign) { 42 public void setCampaign(Campaign campaign) {
43 this.campaign = campaign; 43 this.campaign = campaign;
44 } 44 }
...@@ -58,4 +58,12 @@ public class MergedGifts { ...@@ -58,4 +58,12 @@ public class MergedGifts {
58 public Campaign getCampaign() { 58 public Campaign getCampaign() {
59 return campaign; 59 return campaign;
60 } 60 }
61 +
62 + public void setCCMS(LoyaltyContextualOfferModel ccmsItem) {
63 + this.ccms = ccmsItem;
64 + }
65 +
66 + public LoyaltyContextualOfferModel getCCMS() {
67 + return ccms;
68 + }
61 } 69 }
......
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 10-Aug-22.
30 + */
31 +
32 +public class MergedMore {
33 + private int dataType = 0;
34 + private Campaign campaign;
35 + private LoyaltyContextualOfferModel ccms;
36 +
37 + public void setDataType(int dataType) {
38 + this.dataType = dataType;
39 + }
40 +
41 + public void setCampaign(Campaign campaign) {
42 + this.campaign = campaign;
43 + }
44 +
45 + public int getDataType() {
46 + return dataType;
47 + }
48 +
49 + public Campaign getCampaign() {
50 + return campaign;
51 + }
52 +
53 + public void setCCMS(LoyaltyContextualOfferModel ccmsItem) {
54 + this.ccms = ccmsItem;
55 + }
56 +
57 + public LoyaltyContextualOfferModel getCCMS() {
58 + return ccms;
59 + }
60 +}
...@@ -30,7 +30,7 @@ public class EventQuestionnaireService extends Worker { ...@@ -30,7 +30,7 @@ public class EventQuestionnaireService extends Worker {
30 WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { 30 WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
31 @Override 31 @Override
32 public void onSuccess(Consumer result) { 32 public void onSuccess(Consumer result) {
33 - WarplyManagerHelper.setConsumer(result); 33 + WarplyManagerHelper.setConsumerInternal(result);
34 34
35 WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { 35 WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
36 @Override 36 @Override
......
...@@ -45,6 +45,7 @@ import java.util.HashMap; ...@@ -45,6 +45,7 @@ import java.util.HashMap;
45 import ly.warp.sdk.R; 45 import ly.warp.sdk.R;
46 import ly.warp.sdk.Warply; 46 import ly.warp.sdk.Warply;
47 import ly.warp.sdk.activities.CouponsetInfoActivity; 47 import ly.warp.sdk.activities.CouponsetInfoActivity;
48 +import ly.warp.sdk.activities.GiftsForYouActivity;
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;
...@@ -83,6 +84,7 @@ public class WarplyManagerHelper { ...@@ -83,6 +84,7 @@ public class WarplyManagerHelper {
83 // =========================================================== 84 // ===========================================================
84 85
85 private static Consumer mConsumer = new Consumer(); 86 private static Consumer mConsumer = new Consumer();
87 + private static Consumer mConsumerInternal = new Consumer();
86 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>(); 88 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
87 private static CouponList mCouponList = new CouponList(); 89 private static CouponList mCouponList = new CouponList();
88 private static CouponList mCouponListExpired = new CouponList(); 90 private static CouponList mCouponListExpired = new CouponList();
...@@ -94,7 +96,7 @@ public class WarplyManagerHelper { ...@@ -94,7 +96,7 @@ public class WarplyManagerHelper {
94 private static ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); 96 private static ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>();
95 private static ArrayList<LoyaltyContextualOfferModel> mCCMSList = new ArrayList<>(); 97 private static ArrayList<LoyaltyContextualOfferModel> mCCMSList = new ArrayList<>();
96 private static AlertDialog mAlertDialogSharing, mAlertDialogAcceptSharing, mAlertDialogRejectSharing, 98 private static AlertDialog mAlertDialogSharing, mAlertDialogAcceptSharing, mAlertDialogRejectSharing,
97 - mAlertDialogReturnSharing, mAlertDialogErrorSharing; 99 + mAlertDialogReturnSharing, mAlertDialogErrorSharing, mAlertDialogErrorUsedSharing, mAlertDialogErrorExpiredSharing;
98 private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); 100 private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel();
99 private static float mDealsSum = 0.0f; 101 private static float mDealsSum = 0.0f;
100 private static MerchantList mMerchantList = new MerchantList(); 102 private static MerchantList mMerchantList = new MerchantList();
...@@ -165,6 +167,10 @@ public class WarplyManagerHelper { ...@@ -165,6 +167,10 @@ public class WarplyManagerHelper {
165 returnSharingDialog(context, modalText); 167 returnSharingDialog(context, modalText);
166 } 168 }
167 } 169 }
170 + } else if (status == 4) {
171 + errorExpiredDialog(context);
172 + } else if (status == 5) {
173 + errorUsedDialog(context);
168 } else 174 } else
169 errorSharingDialog(context); 175 errorSharingDialog(context);
170 } 176 }
...@@ -295,6 +301,32 @@ public class WarplyManagerHelper { ...@@ -295,6 +301,32 @@ public class WarplyManagerHelper {
295 } 301 }
296 302
297 /** 303 /**
304 + * Expired dialog
305 + */
306 + private static void errorExpiredDialog(Context context) {
307 + mAlertDialogErrorExpiredSharing = new AlertDialog.Builder(context)
308 + .setTitle(R.string.cos_dlg_error_title)
309 + .setMessage(R.string.cos_dlg_error_expired)
310 + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
311 + dialogPositive.dismiss();
312 + })
313 + .show();
314 + }
315 +
316 + /**
317 + * Used dialog
318 + */
319 + private static void errorUsedDialog(Context context) {
320 + mAlertDialogErrorUsedSharing = new AlertDialog.Builder(context)
321 + .setTitle(R.string.cos_dlg_error_title)
322 + .setMessage(R.string.cos_dlg_error_used)
323 + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
324 + dialogPositive.dismiss();
325 + })
326 + .show();
327 + }
328 +
329 + /**
298 * Open CCMS campaign 330 * Open CCMS campaign
299 */ 331 */
300 public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) { 332 public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) {
...@@ -606,6 +638,43 @@ public class WarplyManagerHelper { ...@@ -606,6 +638,43 @@ public class WarplyManagerHelper {
606 public static void handleLoyaltyCampaigns(Context context, Campaign item) { 638 public static void handleLoyaltyCampaigns(Context context, Campaign item) {
607 if (item != null) { 639 if (item != null) {
608 if (item.getType().equals("coupon")) { 640 if (item.getType().equals("coupon")) {
641 + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
642 + LoyaltyContextualOfferModel ccmsItem = null;
643 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
644 + if (ccms.getLoyaltyCampaignId().equals(item.getSessionUUID())) {
645 + ccmsItem = ccms;
646 + break;
647 + }
648 + }
649 +
650 + if (ccmsItem != null) {
651 + try {
652 + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
653 + if (campaignSettings != null) {
654 + if (campaignSettings.has("couponset")) {
655 + String cpnUuid = campaignSettings.optString("couponset");
656 + for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
657 + if (cpns.getUuid().equals(cpnUuid)) {
658 + Intent intent = new Intent(context, CouponsetInfoActivity.class);
659 + intent.putExtra("couponset", (Serializable) cpns);
660 + intent.putExtra("loyalty", (Serializable) item);
661 + intent.putExtra("ccms", ccmsItem);
662 + context.startActivity(intent);
663 + break;
664 + }
665 + }
666 + } else {
667 + context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(item)));
668 + }
669 + }
670 + } catch (Exception exception) {
671 + exception.printStackTrace();
672 + }
673 +
674 + return;
675 + }
676 + }
677 +
609 try { 678 try {
610 JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings()); 679 JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
611 if (campaignSettings != null) { 680 if (campaignSettings != null) {
...@@ -790,10 +859,22 @@ public class WarplyManagerHelper { ...@@ -790,10 +859,22 @@ public class WarplyManagerHelper {
790 return mDfyCoupons; 859 return mDfyCoupons;
791 } 860 }
792 861
862 + public static Consumer getConsumerInternal() {
863 + return mConsumerInternal;
864 + }
865 +
866 + public static void setConsumerInternal(Consumer consumer) {
867 + mConsumerInternal = consumer;
868 + }
869 +
793 public static Consumer getConsumer() { 870 public static Consumer getConsumer() {
794 return mConsumer; 871 return mConsumer;
795 } 872 }
796 873
874 + public static void setConsumer(Consumer consumer) {
875 + mConsumer = consumer;
876 + }
877 +
797 public static HashMap<String, CampaignList> getUniqueCampaignList() { 878 public static HashMap<String, CampaignList> getUniqueCampaignList() {
798 return mUniqueCampaignList; 879 return mUniqueCampaignList;
799 } 880 }
...@@ -816,10 +897,6 @@ public class WarplyManagerHelper { ...@@ -816,10 +897,6 @@ public class WarplyManagerHelper {
816 return mCouponListExpired; 897 return mCouponListExpired;
817 } 898 }
818 899
819 - public static void setConsumer(Consumer consumer) {
820 - mConsumer = consumer;
821 - }
822 -
823 public static void setUniqueCampaignList(CampaignList campaignList) { 900 public static void setUniqueCampaignList(CampaignList campaignList) {
824 mCampaignList.clear(); 901 mCampaignList.clear();
825 mCampaignList.addAll(campaignList); 902 mCampaignList.addAll(campaignList);
......
...@@ -802,7 +802,7 @@ public class WarplyManager { ...@@ -802,7 +802,7 @@ public class WarplyManager {
802 getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { 802 getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
803 @Override 803 @Override
804 public void onSuccess(Consumer result) { 804 public void onSuccess(Consumer result) {
805 - WarplyManagerHelper.setConsumer(result); 805 + WarplyManagerHelper.setConsumerInternal(result);
806 if (result != null) { 806 if (result != null) {
807 JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); 807 JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
808 if (profMetadata != null) { 808 if (profMetadata != null) {
...@@ -1383,8 +1383,8 @@ public class WarplyManager { ...@@ -1383,8 +1383,8 @@ public class WarplyManager {
1383 campaignLoyaltyList.clear(); 1383 campaignLoyaltyList.clear();
1384 for (Campaign camp : mNewCampaignList) { 1384 for (Campaign camp : mNewCampaignList) {
1385 if (camp.getOfferCategory().equals("questionnaire")) { 1385 if (camp.getOfferCategory().equals("questionnaire")) {
1386 - if (WarplyManagerHelper.getConsumer() != null) { 1386 + if (WarplyManagerHelper.getConsumerInternal() != null) {
1387 - JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumer().getProfileMetadata()); 1387 + JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
1388 if (profMetadata != null) { 1388 if (profMetadata != null) {
1389 if (!profMetadata.has("answered")) { 1389 if (!profMetadata.has("answered")) {
1390 try { 1390 try {
...@@ -2278,7 +2278,7 @@ public class WarplyManager { ...@@ -2278,7 +2278,7 @@ public class WarplyManager {
2278 getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { 2278 getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
2279 @Override 2279 @Override
2280 public void onSuccess(Consumer result) { 2280 public void onSuccess(Consumer result) {
2281 - WarplyManagerHelper.setConsumer(result); 2281 + WarplyManagerHelper.setConsumerInternal(result);
2282 if (result != null) { 2282 if (result != null) {
2283 JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); 2283 JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
2284 if (profMetadata != null) { 2284 if (profMetadata != null) {
......
...@@ -126,6 +126,23 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. ...@@ -126,6 +126,23 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
126 // holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); 126 // holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
127 // 127 //
128 // holder.tvCouponValue.setText(mergedgiftsItem.getDiscount()); 128 // holder.tvCouponValue.setText(mergedgiftsItem.getDiscount());
129 + } else if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 3) {
130 + if (!TextUtils.isEmpty(mergedgiftsItem.getCCMS().getImageUrl())) {
131 + Glide.with(mContext)
132 +// .setDefaultRequestOptions(
133 +// RequestOptions
134 +// .placeholderOf(R.drawable.ic_default_contact_photo)
135 +// .error(R.drawable.ic_default_contact_photo))
136 + .load(mergedgiftsItem.getCCMS().getImageUrl())
137 + .diskCacheStrategy(DiskCacheStrategy.DATA)
138 + .into(holder.ivMergedGiftsLogo);
139 + } else {
140 + Glide.with(mContext)
141 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
142 + .into(holder.ivMergedGiftsLogo);
143 + }
144 +
145 + holder.tvMergedGiftsTitle.setText(mergedgiftsItem.getCCMS().getTitle());
129 } 146 }
130 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem)); 147 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem));
131 } 148 }
......
1 +package ly.warp.sdk.views.adapters;
2 +
3 +import android.content.Context;
4 +import android.text.TextUtils;
5 +import android.view.LayoutInflater;
6 +import android.view.View;
7 +import android.view.ViewGroup;
8 +import android.widget.ImageView;
9 +import android.widget.TextView;
10 +
11 +import androidx.recyclerview.widget.RecyclerView;
12 +
13 +import com.bumptech.glide.Glide;
14 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
15 +import com.bumptech.glide.load.resource.bitmap.CenterCrop;
16 +import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
17 +
18 +import java.util.ArrayList;
19 +import java.util.Date;
20 +import java.util.concurrent.TimeUnit;
21 +
22 +import io.reactivex.Observable;
23 +import io.reactivex.subjects.PublishSubject;
24 +import ly.warp.sdk.R;
25 +import ly.warp.sdk.io.models.MergedMore;
26 +
27 +public class MergedMoreAdapter extends RecyclerView.Adapter<MergedMoreAdapter.MergedMoreViewHolder> {
28 +
29 + private Context mContext;
30 + private ArrayList<MergedMore> mMergedMore;
31 + private final PublishSubject<MergedMore> onClickSubject = PublishSubject.create();
32 +
33 + public MergedMoreAdapter(Context mContext, ArrayList<MergedMore> mergedmore) {
34 + this.mContext = mContext;
35 + this.mMergedMore = mergedmore;
36 + }
37 +
38 + public class MergedMoreViewHolder extends RecyclerView.ViewHolder {
39 + private ImageView ivCampaignTitle, ivIsNew;
40 + private TextView tvCampaignTitle, tvCampaignSubtitle, tvCampaignMessage;
41 +
42 + public MergedMoreViewHolder(View view) {
43 + super(view);
44 + ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo);
45 + tvCampaignTitle = view.findViewById(R.id.tv_campaign_title);
46 + ivIsNew = view.findViewById(R.id.iv_campaign_new);
47 + tvCampaignSubtitle = view.findViewById(R.id.tv_campaign_subtitle);
48 + tvCampaignMessage = view.findViewById(R.id.tv_campaign_message);
49 + }
50 + }
51 +
52 + @Override
53 + public int getItemCount() {
54 + if (mMergedMore == null)
55 + return 0;
56 + else
57 + return mMergedMore.size();
58 + }
59 +
60 +
61 + public MergedMore getItem(int id) {
62 + return mMergedMore.get(id);
63 + }
64 +
65 + public void updateData(ArrayList<MergedMore> mergedmore) {
66 + mMergedMore.clear();
67 + mMergedMore.addAll(mergedmore);
68 + notifyDataSetChanged();
69 + }
70 +
71 +
72 + @Override
73 + public MergedMoreViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
74 + View itemView;
75 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler_vertical, parent, false);
76 + return new MergedMoreViewHolder(itemView);
77 + }
78 +
79 + @Override
80 + public void onBindViewHolder(final MergedMoreViewHolder holder, int position) {
81 + MergedMore mergedmoreItem = mMergedMore.get(position);
82 + if (mergedmoreItem != null && mergedmoreItem.getDataType() == 1) {
83 + if (!TextUtils.isEmpty(mergedmoreItem.getCampaign().getLogoUrl())) {
84 + Glide.with(mContext)
85 + .load(mergedmoreItem.getCampaign().getLogoUrl())
86 + .transform(new CenterCrop(), new RoundedCorners(4))
87 + .diskCacheStrategy(DiskCacheStrategy.DATA)
88 + .into(holder.ivCampaignTitle);
89 + } else {
90 + Glide.with(mContext)
91 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
92 + .into(holder.ivCampaignTitle);
93 + }
94 +
95 + holder.tvCampaignTitle.setText(mergedmoreItem.getCampaign().getTitle());
96 + holder.tvCampaignSubtitle.setText(mergedmoreItem.getCampaign().getSubtitle());
97 + holder.tvCampaignMessage.setText(mergedmoreItem.getCampaign().getMessage());
98 + if (mergedmoreItem.getCampaign().getIsNew())
99 + holder.ivIsNew.setVisibility(View.VISIBLE);
100 + else
101 + holder.ivIsNew.setVisibility(View.GONE);
102 + } else if (mergedmoreItem != null && mergedmoreItem.getDataType() == 2) {
103 + if (!TextUtils.isEmpty(mergedmoreItem.getCCMS().getImageUrl())) {
104 + Glide.with(mContext)
105 + .load(mergedmoreItem.getCCMS().getImageUrl())
106 + .transform(new CenterCrop(), new RoundedCorners(4))
107 + .diskCacheStrategy(DiskCacheStrategy.DATA)
108 + .into(holder.ivCampaignTitle);
109 + } else {
110 + Glide.with(mContext)
111 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
112 + .into(holder.ivCampaignTitle);
113 + }
114 +
115 + holder.tvCampaignTitle.setText(mergedmoreItem.getCCMS().getTitle());
116 + holder.tvCampaignSubtitle.setText(mergedmoreItem.getCCMS().getSubtitle());
117 + holder.tvCampaignMessage.setText(mergedmoreItem.getCCMS().getMessage());
118 + holder.ivIsNew.setVisibility(View.GONE);
119 + }
120 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedmoreItem));
121 + }
122 +
123 + public Observable<MergedMore> getPositionClicks() {
124 + return onClickSubject.cache();
125 + }
126 +
127 + private long getDifferenceDays(Date d1, Date d2) {
128 + long diff = d2.getTime() - d1.getTime();
129 + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
130 + }
131 +}
...@@ -95,12 +95,12 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte ...@@ -95,12 +95,12 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
95 if (couponItem.getSharingType().equals("sent")) { 95 if (couponItem.getSharingType().equals("sent")) {
96 holder.tvCouponLabel.setText(R.string.cos_shared_coupon_receiver); 96 holder.tvCouponLabel.setText(R.string.cos_shared_coupon_receiver);
97 if (extraFields != null && extraFields.has("receiver_msisdn")) { 97 if (extraFields != null && extraFields.has("receiver_msisdn")) {
98 - holder.tvCouponLabel.setText(extraFields.optString("receiver_msisdn")); 98 + holder.tvCouponPhone.setText(extraFields.optString("receiver_msisdn"));
99 } 99 }
100 } else if (couponItem.getSharingType().equals("received")) { 100 } else if (couponItem.getSharingType().equals("received")) {
101 holder.tvCouponLabel.setText(R.string.cos_shared_coupon_sender); 101 holder.tvCouponLabel.setText(R.string.cos_shared_coupon_sender);
102 if (extraFields != null && extraFields.has("sender_msisdn")) { 102 if (extraFields != null && extraFields.has("sender_msisdn")) {
103 - holder.tvCouponLabel.setText(extraFields.optString("sender_msisdn")); 103 + holder.tvCouponPhone.setText(extraFields.optString("sender_msisdn"));
104 } 104 }
105 } 105 }
106 106
......
...@@ -413,6 +413,7 @@ ...@@ -413,6 +413,7 @@
413 android:layout_width="match_parent" 413 android:layout_width="match_parent"
414 android:layout_height="wrap_content" 414 android:layout_height="wrap_content"
415 android:layout_marginHorizontal="32dp" 415 android:layout_marginHorizontal="32dp"
416 + android:layout_marginTop="24dp"
416 android:gravity="center" 417 android:gravity="center"
417 android:orientation="vertical" 418 android:orientation="vertical"
418 android:visibility="gone"> 419 android:visibility="gone">
......
...@@ -123,6 +123,9 @@ ...@@ -123,6 +123,9 @@
123 <string name="cos_value2">%1$s</string> 123 <string name="cos_value2">%1$s</string>
124 <string name="cos_show_barcode">Εμφάνιση barcode</string> 124 <string name="cos_show_barcode">Εμφάνιση barcode</string>
125 <string name="cos_hide_barcode">Απόκρυψη barcode</string> 125 <string name="cos_hide_barcode">Απόκρυψη barcode</string>
126 + <string name="cos_wrong_number_dlg">Το κινητό που καταχώρησες δεν είναι COSMOTE. Παρακαλούμε καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string>
127 + <string name="cos_dlg_error_expired">Το δώρο έχει λήξει</string>
128 + <string name="cos_dlg_error_used">Το δώρο έχει ήδη χρησιμοποιηθεί</string>
126 129
127 <string-array name="coupons_array"> 130 <string-array name="coupons_array">
128 <item>Κουπόνια</item> 131 <item>Κουπόνια</item>
......