Panagiotis Triantafyllou

fixes

...@@ -42,7 +42,7 @@ public class SplashActivity extends BaseActivity { ...@@ -42,7 +42,7 @@ public class SplashActivity extends BaseActivity {
42 // ); 42 // );
43 43
44 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 44 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
45 - .setGuid("6012049322"), 45 + .setGuid("6012049321"), //6012049321, 6012049322
46 mLoginReceiver); 46 mLoginReceiver);
47 47
48 // WarplyManager.verifyTicket(new WarplyVerifyTicketRequest() 48 // WarplyManager.verifyTicket(new WarplyVerifyTicketRequest()
......
...@@ -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-cosbeta30i' 5 + PUBLISH_VERSION = '4.5.4-cosbeta31i'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -137,6 +137,11 @@ ...@@ -137,6 +137,11 @@
137 android:permission="android.permission.BIND_JOB_SERVICE" /> 137 android:permission="android.permission.BIND_JOB_SERVICE" />
138 138
139 <service 139 <service
140 + android:name="ly.warp.sdk.services.EventService"
141 + android:exported="false"
142 + android:permission="android.permission.BIND_JOB_SERVICE" />
143 +
144 + <service
140 android:name="ly.warp.sdk.services.WarplyBeaconsRangingService" 145 android:name="ly.warp.sdk.services.WarplyBeaconsRangingService"
141 android:exported="false" /> 146 android:exported="false" />
142 147
......
...@@ -490,7 +490,32 @@ public enum Warply { ...@@ -490,7 +490,32 @@ public enum Warply {
490 " \"dataValue\": \"None\",\n" + 490 " \"dataValue\": \"None\",\n" +
491 " \"discount\": \"None\",\n" + 491 " \"discount\": \"None\",\n" +
492 " \"eligibleAssets\": [\n" + 492 " \"eligibleAssets\": [\n" +
493 - " \"306945218770\"\n" + 493 + " \"306945218770\",\n" +
494 + " \"306944333488\",\n" +
495 + " \"306932222490\",\n" +
496 + " \"306996824010\",\n" +
497 + " \"306972713201\",\n" +
498 + " \"306942496252\",\n" +
499 + " \"306977316716\",\n" +
500 + " \"306945433100\",\n" +
501 + " \"306977403986\",\n" +
502 + " \"306936581495\",\n" +
503 + " \"306980689662\",\n" +
504 + " \"306970101490\",\n" +
505 + " \"306973396329\",\n" +
506 + " \"306972577064\",\n" +
507 + " \"306974923219\",\n" +
508 + " \"306977513761\",\n" +
509 + " \"306984220987\",\n" +
510 + " \"306979949205\",\n" +
511 + " \"306943134127\",\n" +
512 + " \"306970437794\",\n" +
513 + " \"306932535319\",\n" +
514 + " \"306974063133\",\n" +
515 + " \"306932520323\",\n" +
516 + " \"306978733823\",\n" +
517 + " \"306985995420\",\n" +
518 + " \"306983879555\",\n" +
494 " ],\n" + 519 " ],\n" +
495 " \"id\": \"000003590\",\n" + 520 " \"id\": \"000003590\",\n" +
496 " \"loyaltyCampaignId\": \"NA\",\n" + 521 " \"loyaltyCampaignId\": \"NA\",\n" +
...@@ -518,7 +543,32 @@ public enum Warply { ...@@ -518,7 +543,32 @@ public enum Warply {
518 " \"dataValue\": \"None\",\n" + 543 " \"dataValue\": \"None\",\n" +
519 " \"discount\": \"None\",\n" + 544 " \"discount\": \"None\",\n" +
520 " \"eligibleAssets\": [\n" + 545 " \"eligibleAssets\": [\n" +
521 - " \"306945218770\"\n" + 546 + " \"306945218770\",\n" +
547 + " \"306944333488\",\n" +
548 + " \"306932222490\",\n" +
549 + " \"306996824010\",\n" +
550 + " \"306972713201\",\n" +
551 + " \"306942496252\",\n" +
552 + " \"306977316716\",\n" +
553 + " \"306945433100\",\n" +
554 + " \"306977403986\",\n" +
555 + " \"306936581495\",\n" +
556 + " \"306980689662\",\n" +
557 + " \"306970101490\",\n" +
558 + " \"306973396329\",\n" +
559 + " \"306972577064\",\n" +
560 + " \"306974923219\",\n" +
561 + " \"306977513761\",\n" +
562 + " \"306984220987\",\n" +
563 + " \"306979949205\",\n" +
564 + " \"306943134127\",\n" +
565 + " \"306970437794\",\n" +
566 + " \"306932535319\",\n" +
567 + " \"306974063133\",\n" +
568 + " \"306932520323\",\n" +
569 + " \"306978733823\",\n" +
570 + " \"306985995420\",\n" +
571 + " \"306983879555\",\n" +
522 " ],\n" + 572 " ],\n" +
523 " \"id\": \"000003599\",\n" + 573 " \"id\": \"000003599\",\n" +
524 " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" + 574 " \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
...@@ -544,7 +594,32 @@ public enum Warply { ...@@ -544,7 +594,32 @@ public enum Warply {
544 " \"businessAdditionalId\": \"\",\n" + 594 " \"businessAdditionalId\": \"\",\n" +
545 " \"businessService\": \"0.0\",\n" + 595 " \"businessService\": \"0.0\",\n" +
546 " \"eligibleAssets\": [\n" + 596 " \"eligibleAssets\": [\n" +
547 - " \"306945218770\"\n" + 597 + " \"306945218770\",\n" +
598 + " \"306944333488\",\n" +
599 + " \"306932222490\",\n" +
600 + " \"306996824010\",\n" +
601 + " \"306972713201\",\n" +
602 + " \"306942496252\",\n" +
603 + " \"306977316716\",\n" +
604 + " \"306945433100\",\n" +
605 + " \"306977403986\",\n" +
606 + " \"306936581495\",\n" +
607 + " \"306980689662\",\n" +
608 + " \"306970101490\",\n" +
609 + " \"306973396329\",\n" +
610 + " \"306972577064\",\n" +
611 + " \"306974923219\",\n" +
612 + " \"306977513761\",\n" +
613 + " \"306984220987\",\n" +
614 + " \"306979949205\",\n" +
615 + " \"306943134127\",\n" +
616 + " \"306970437794\",\n" +
617 + " \"306932535319\",\n" +
618 + " \"306974063133\",\n" +
619 + " \"306932520323\",\n" +
620 + " \"306978733823\",\n" +
621 + " \"306985995420\",\n" +
622 + " \"306983879555\",\n" +
548 " ],\n" + 623 " ],\n" +
549 " \"id\": \"000003588\",\n" + 624 " \"id\": \"000003588\",\n" +
550 " \"loyaltyCampaignId\": \"NA\",\n" + 625 " \"loyaltyCampaignId\": \"NA\",\n" +
...@@ -570,7 +645,32 @@ public enum Warply { ...@@ -570,7 +645,32 @@ public enum Warply {
570 " \"dataValue\": \"None\",\n" + 645 " \"dataValue\": \"None\",\n" +
571 " \"discount\": \"None\",\n" + 646 " \"discount\": \"None\",\n" +
572 " \"eligibleAssets\": [\n" + 647 " \"eligibleAssets\": [\n" +
573 - " \"306945218770\"\n" + 648 + " \"306945218770\",\n" +
649 + " \"306944333488\",\n" +
650 + " \"306932222490\",\n" +
651 + " \"306996824010\",\n" +
652 + " \"306972713201\",\n" +
653 + " \"306942496252\",\n" +
654 + " \"306977316716\",\n" +
655 + " \"306945433100\",\n" +
656 + " \"306977403986\",\n" +
657 + " \"306936581495\",\n" +
658 + " \"306980689662\",\n" +
659 + " \"306970101490\",\n" +
660 + " \"306973396329\",\n" +
661 + " \"306972577064\",\n" +
662 + " \"306974923219\",\n" +
663 + " \"306977513761\",\n" +
664 + " \"306984220987\",\n" +
665 + " \"306979949205\",\n" +
666 + " \"306943134127\",\n" +
667 + " \"306970437794\",\n" +
668 + " \"306932535319\",\n" +
669 + " \"306974063133\",\n" +
670 + " \"306932520323\",\n" +
671 + " \"306978733823\",\n" +
672 + " \"306985995420\",\n" +
673 + " \"306983879555\",\n" +
574 " ],\n" + 674 " ],\n" +
575 " \"id\": \"000003608\",\n" + 675 " \"id\": \"000003608\",\n" +
576 " \"loyaltyCampaignId\": \"c134cdeb8a924f8eac38e261acb9caf5\",\n" + 676 " \"loyaltyCampaignId\": \"c134cdeb8a924f8eac38e261acb9caf5\",\n" +
...@@ -596,7 +696,32 @@ public enum Warply { ...@@ -596,7 +696,32 @@ public enum Warply {
596 " \"businessAdditionalId\": \"\",\n" + 696 " \"businessAdditionalId\": \"\",\n" +
597 " \"businessService\": \"0.0\",\n" + 697 " \"businessService\": \"0.0\",\n" +
598 " \"eligibleAssets\": [\n" + 698 " \"eligibleAssets\": [\n" +
599 - " \"306945218770\"\n" + 699 + " \"306945218770\",\n" +
700 + " \"306944333488\",\n" +
701 + " \"306932222490\",\n" +
702 + " \"306996824010\",\n" +
703 + " \"306972713201\",\n" +
704 + " \"306942496252\",\n" +
705 + " \"306977316716\",\n" +
706 + " \"306945433100\",\n" +
707 + " \"306977403986\",\n" +
708 + " \"306936581495\",\n" +
709 + " \"306980689662\",\n" +
710 + " \"306970101490\",\n" +
711 + " \"306973396329\",\n" +
712 + " \"306972577064\",\n" +
713 + " \"306974923219\",\n" +
714 + " \"306977513761\",\n" +
715 + " \"306984220987\",\n" +
716 + " \"306979949205\",\n" +
717 + " \"306943134127\",\n" +
718 + " \"306970437794\",\n" +
719 + " \"306932535319\",\n" +
720 + " \"306974063133\",\n" +
721 + " \"306932520323\",\n" +
722 + " \"306978733823\",\n" +
723 + " \"306985995420\",\n" +
724 + " \"306983879555\",\n" +
600 " ],\n" + 725 " ],\n" +
601 " \"id\": \"000003612\",\n" + 726 " \"id\": \"000003612\",\n" +
602 " \"loyaltyCampaignId\": \"8eb71c4ceaff409c896e2d1f6f1c20f3\",\n" + 727 " \"loyaltyCampaignId\": \"8eb71c4ceaff409c896e2d1f6f1c20f3\",\n" +
...@@ -622,7 +747,32 @@ public enum Warply { ...@@ -622,7 +747,32 @@ public enum Warply {
622 " \"dataValue\": \"None\",\n" + 747 " \"dataValue\": \"None\",\n" +
623 " \"discount\": \"None\",\n" + 748 " \"discount\": \"None\",\n" +
624 " \"eligibleAssets\": [\n" + 749 " \"eligibleAssets\": [\n" +
625 - " \"306945218770\"\n" + 750 + " \"306945218770\",\n" +
751 + " \"306944333488\",\n" +
752 + " \"306932222490\",\n" +
753 + " \"306996824010\",\n" +
754 + " \"306972713201\",\n" +
755 + " \"306942496252\",\n" +
756 + " \"306977316716\",\n" +
757 + " \"306945433100\",\n" +
758 + " \"306977403986\",\n" +
759 + " \"306936581495\",\n" +
760 + " \"306980689662\",\n" +
761 + " \"306970101490\",\n" +
762 + " \"306973396329\",\n" +
763 + " \"306972577064\",\n" +
764 + " \"306974923219\",\n" +
765 + " \"306977513761\",\n" +
766 + " \"306984220987\",\n" +
767 + " \"306979949205\",\n" +
768 + " \"306943134127\",\n" +
769 + " \"306970437794\",\n" +
770 + " \"306932535319\",\n" +
771 + " \"306974063133\",\n" +
772 + " \"306932520323\",\n" +
773 + " \"306978733823\",\n" +
774 + " \"306985995420\",\n" +
775 + " \"306983879555\",\n" +
626 " ],\n" + 776 " ],\n" +
627 " \"id\": \"000003610\",\n" + 777 " \"id\": \"000003610\",\n" +
628 " \"loyaltyCampaignId\": \"8e2c88ec94c948d8b51577324ed9a4d5\",\n" + 778 " \"loyaltyCampaignId\": \"8e2c88ec94c948d8b51577324ed9a4d5\",\n" +
...@@ -648,7 +798,32 @@ public enum Warply { ...@@ -648,7 +798,32 @@ public enum Warply {
648 " \"businessAdditionalId\": \"\",\n" + 798 " \"businessAdditionalId\": \"\",\n" +
649 " \"businessService\": \"0.0\",\n" + 799 " \"businessService\": \"0.0\",\n" +
650 " \"eligibleAssets\": [\n" + 800 " \"eligibleAssets\": [\n" +
651 - " \"306945218770\"\n" + 801 + " \"306945218770\",\n" +
802 + " \"306944333488\",\n" +
803 + " \"306932222490\",\n" +
804 + " \"306996824010\",\n" +
805 + " \"306972713201\",\n" +
806 + " \"306942496252\",\n" +
807 + " \"306977316716\",\n" +
808 + " \"306945433100\",\n" +
809 + " \"306977403986\",\n" +
810 + " \"306936581495\",\n" +
811 + " \"306980689662\",\n" +
812 + " \"306970101490\",\n" +
813 + " \"306973396329\",\n" +
814 + " \"306972577064\",\n" +
815 + " \"306974923219\",\n" +
816 + " \"306977513761\",\n" +
817 + " \"306984220987\",\n" +
818 + " \"306979949205\",\n" +
819 + " \"306943134127\",\n" +
820 + " \"306970437794\",\n" +
821 + " \"306932535319\",\n" +
822 + " \"306974063133\",\n" +
823 + " \"306932520323\",\n" +
824 + " \"306978733823\",\n" +
825 + " \"306985995420\",\n" +
826 + " \"306983879555\",\n" +
652 " ],\n" + 827 " ],\n" +
653 " \"id\": \"000003614\",\n" + 828 " \"id\": \"000003614\",\n" +
654 " \"loyaltyCampaignId\": \"aaf4022194584f02bb84c7b283c7c51e\",\n" + 829 " \"loyaltyCampaignId\": \"aaf4022194584f02bb84c7b283c7c51e\",\n" +
......
...@@ -148,6 +148,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -148,6 +148,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
148 mAdapterMergedGifts.getPositionClicks() 148 mAdapterMergedGifts.getPositionClicks()
149 .doOnNext(dataItem -> { 149 .doOnNext(dataItem -> {
150 if (dataItem.getDataType() == 1) { 150 if (dataItem.getDataType() == 1) {
151 + WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
151 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); 152 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
152 153
153 if (dataItem.getCampaign().getType().equals("coupon")) { 154 if (dataItem.getCampaign().getType().equals("coupon")) {
...@@ -227,6 +228,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -227,6 +228,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
227 mAdapterMergedGifts.getPositionClicks() 228 mAdapterMergedGifts.getPositionClicks()
228 .doOnNext(dataItem -> { 229 .doOnNext(dataItem -> {
229 if (dataItem.getDataType() == 1) { 230 if (dataItem.getDataType() == 1) {
231 + WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
230 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); 232 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
231 233
232 if (dataItem.getCampaign().getType().equals("coupon")) { 234 if (dataItem.getCampaign().getType().equals("coupon")) {
......
...@@ -116,6 +116,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -116,6 +116,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
116 mRecyclerMore.setAdapter(mAdapterMore); 116 mRecyclerMore.setAdapter(mAdapterMore);
117 mAdapterMore.getPositionClicks() 117 mAdapterMore.getPositionClicks()
118 .doOnNext(gift -> { 118 .doOnNext(gift -> {
119 + WarpUtils.log("MFY_CLICK " + gift.toString());
119 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel())); 120 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel()));
120 121
121 try { 122 try {
...@@ -124,6 +125,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -124,6 +125,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
124 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 125 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
125 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 126 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
126 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { 127 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) {
128 + WarpUtils.log("CCMS_CLICK " + ccms.toString());
127 startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(gift, ccms))); 129 startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(gift, ccms)));
128 break; 130 break;
129 } 131 }
......
...@@ -33,6 +33,8 @@ import android.content.Intent; ...@@ -33,6 +33,8 @@ import android.content.Intent;
33 import android.graphics.Color; 33 import android.graphics.Color;
34 import android.os.Build; 34 import android.os.Build;
35 import android.os.Bundle; 35 import android.os.Bundle;
36 +import android.os.Handler;
37 +import android.os.Looper;
36 import android.text.TextUtils; 38 import android.text.TextUtils;
37 import android.view.KeyEvent; 39 import android.view.KeyEvent;
38 import android.view.View; 40 import android.view.View;
...@@ -56,6 +58,9 @@ import java.util.concurrent.TimeUnit; ...@@ -56,6 +58,9 @@ import java.util.concurrent.TimeUnit;
56 58
57 import ly.warp.sdk.R; 59 import ly.warp.sdk.R;
58 import ly.warp.sdk.Warply; 60 import ly.warp.sdk.Warply;
61 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
62 +import ly.warp.sdk.io.models.CouponList;
63 +import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
59 import ly.warp.sdk.services.PushEventsClickedWorkerService; 64 import ly.warp.sdk.services.PushEventsClickedWorkerService;
60 import ly.warp.sdk.utils.WarpJSONParser; 65 import ly.warp.sdk.utils.WarpJSONParser;
61 import ly.warp.sdk.utils.WarpUtils; 66 import ly.warp.sdk.utils.WarpUtils;
...@@ -63,6 +68,7 @@ import ly.warp.sdk.utils.WarplyPreferences; ...@@ -63,6 +68,7 @@ import ly.warp.sdk.utils.WarplyPreferences;
63 import ly.warp.sdk.utils.WarplyProperty; 68 import ly.warp.sdk.utils.WarplyProperty;
64 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 69 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
65 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 70 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
71 +import ly.warp.sdk.utils.managers.WarplyManager;
66 import ly.warp.sdk.utils.managers.WarplySessionManager; 72 import ly.warp.sdk.utils.managers.WarplySessionManager;
67 import ly.warp.sdk.views.WarpView; 73 import ly.warp.sdk.views.WarpView;
68 74
...@@ -127,8 +133,9 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -127,8 +133,9 @@ public class WarpViewActivity extends WarpBaseActivity {
127 setResult(RESULT_OK, new Intent()); 133 setResult(RESULT_OK, new Intent());
128 finish(); 134 finish();
129 } 135 }
130 -// if (event.getCoupon() != null) 136 + if (event.getCoupon() != null) {
131 -// finish(); 137 + WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
138 + }
132 // if (event.getPacingCard() != null) 139 // if (event.getPacingCard() != null)
133 // finish(); 140 // finish();
134 // if (event.getPacingService() != null) 141 // if (event.getPacingService() != null)
...@@ -252,4 +259,16 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -252,4 +259,16 @@ public class WarpViewActivity extends WarpBaseActivity {
252 public static Intent createIntentFromURL(Context context, String url) { 259 public static Intent createIntentFromURL(Context context, String url) {
253 return new Intent(context, WarpViewActivity.class).putExtra("sessionUrl", url); 260 return new Intent(context, WarpViewActivity.class).putExtra("sessionUrl", url);
254 } 261 }
262 +
263 + private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
264 + @Override
265 + public void onSuccess(CouponList result) {
266 +
267 + }
268 +
269 + @Override
270 + public void onFailure(int errorCode) {
271 +
272 + }
273 + };
255 } 274 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -103,7 +103,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { ...@@ -103,7 +103,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
103 mRecyclerGifts.setAdapter(mAdapterGifts); 103 mRecyclerGifts.setAdapter(mAdapterGifts);
104 mAdapterGifts.getPositionClicks() 104 mAdapterGifts.getPositionClicks()
105 .doOnNext(gift -> { 105 .doOnNext(gift -> {
106 - startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift))); 106 + if (gift.getType().equals("coupon")) {
107 + WarplyManagerHelper.openCouponset(getContext(), gift);
108 + } else
109 + startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
107 }) 110 })
108 .doOnError(error -> { 111 .doOnError(error -> {
109 }) 112 })
...@@ -127,7 +130,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { ...@@ -127,7 +130,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
127 mRecyclerMore.setAdapter(mAdapterMore); 130 mRecyclerMore.setAdapter(mAdapterMore);
128 mAdapterMore.getPositionClicks() 131 mAdapterMore.getPositionClicks()
129 .doOnNext(more -> { 132 .doOnNext(more -> {
130 - startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more))); 133 + if (more.getType().equals("coupon")) {
134 + WarplyManagerHelper.openCouponset(getContext(), more);
135 + } else
136 + startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more)));
131 }) 137 })
132 .doOnError(error -> { 138 .doOnError(error -> {
133 }) 139 })
......
1 +package ly.warp.sdk.services;
2 +
3 +import android.content.Context;
4 +
5 +import androidx.annotation.NonNull;
6 +import androidx.work.Worker;
7 +import androidx.work.WorkerParameters;
8 +
9 +import org.greenrobot.eventbus.EventBus;
10 +
11 +import ly.warp.sdk.io.models.ContexualEventModel;
12 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
13 +
14 +/**
15 + * Created by Panagiotis Triantafyllou on 13/Ιουλ/2022.
16 + */
17 +public class EventService extends Worker {
18 +
19 + public EventService(@NonNull Context context, @NonNull WorkerParameters workerParams) {
20 + super(context, workerParams);
21 + }
22 +
23 + @NonNull
24 + @Override
25 + public Result doWork() {
26 + ContexualEventModel ccmsAdded = new ContexualEventModel();
27 + EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
28 +
29 + return Result.success();
30 + }
31 +}
...@@ -26,19 +26,25 @@ ...@@ -26,19 +26,25 @@
26 package ly.warp.sdk.utils; 26 package ly.warp.sdk.utils;
27 27
28 import android.content.Context; 28 import android.content.Context;
29 +import android.content.Intent;
29 import android.text.TextUtils; 30 import android.text.TextUtils;
30 import android.util.Log; 31 import android.util.Log;
31 32
32 import androidx.appcompat.app.AlertDialog; 33 import androidx.appcompat.app.AlertDialog;
34 +import androidx.work.OneTimeWorkRequest;
35 +import androidx.work.WorkManager;
33 36
34 import org.greenrobot.eventbus.EventBus; 37 import org.greenrobot.eventbus.EventBus;
35 import org.json.JSONObject; 38 import org.json.JSONObject;
36 39
40 +import java.io.Serializable;
37 import java.util.ArrayList; 41 import java.util.ArrayList;
38 import java.util.HashMap; 42 import java.util.HashMap;
39 43
40 import ly.warp.sdk.R; 44 import ly.warp.sdk.R;
41 import ly.warp.sdk.Warply; 45 import ly.warp.sdk.Warply;
46 +import ly.warp.sdk.activities.CouponsetInfoActivity;
47 +import ly.warp.sdk.activities.GiftsForYouActivity;
42 import ly.warp.sdk.activities.WarpViewActivity; 48 import ly.warp.sdk.activities.WarpViewActivity;
43 import ly.warp.sdk.db.WarplyDBHelper; 49 import ly.warp.sdk.db.WarplyDBHelper;
44 import ly.warp.sdk.io.callbacks.CallbackReceiver; 50 import ly.warp.sdk.io.callbacks.CallbackReceiver;
...@@ -49,6 +55,7 @@ import ly.warp.sdk.io.models.Consumer; ...@@ -49,6 +55,7 @@ import ly.warp.sdk.io.models.Consumer;
49 import ly.warp.sdk.io.models.ContexualEventModel; 55 import ly.warp.sdk.io.models.ContexualEventModel;
50 import ly.warp.sdk.io.models.Coupon; 56 import ly.warp.sdk.io.models.Coupon;
51 import ly.warp.sdk.io.models.CouponList; 57 import ly.warp.sdk.io.models.CouponList;
58 +import ly.warp.sdk.io.models.Couponset;
52 import ly.warp.sdk.io.models.CouponsetsList; 59 import ly.warp.sdk.io.models.CouponsetsList;
53 import ly.warp.sdk.io.models.CustomerStateModel; 60 import ly.warp.sdk.io.models.CustomerStateModel;
54 import ly.warp.sdk.io.models.LoyaltyBadgeModel; 61 import ly.warp.sdk.io.models.LoyaltyBadgeModel;
...@@ -57,6 +64,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; ...@@ -57,6 +64,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
57 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; 64 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
58 import ly.warp.sdk.io.request.CosmoteSharingRequest; 65 import ly.warp.sdk.io.request.CosmoteSharingRequest;
59 import ly.warp.sdk.io.request.WarplyIntegrationRequest; 66 import ly.warp.sdk.io.request.WarplyIntegrationRequest;
67 +import ly.warp.sdk.services.EventService;
60 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 68 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
61 import ly.warp.sdk.utils.managers.WarplyManager; 69 import ly.warp.sdk.utils.managers.WarplyManager;
62 70
...@@ -413,8 +421,11 @@ public class WarplyManagerHelper { ...@@ -413,8 +421,11 @@ public class WarplyManagerHelper {
413 mCCMSList.clear(); 421 mCCMSList.clear();
414 mCCMSList.addAll(list); 422 mCCMSList.addAll(list);
415 423
416 - ContexualEventModel ccmsAdded = new ContexualEventModel(); 424 + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build();
417 - EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded)); 425 + WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
426 +
427 +// ContexualEventModel ccmsAdded = new ContexualEventModel();
428 +// EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
418 429
419 // if (list == null || list.size() == 0) { 430 // if (list == null || list.size() == 0) {
420 // CampaignList tempGifts = new CampaignList(); 431 // CampaignList tempGifts = new CampaignList();
...@@ -537,6 +548,30 @@ public class WarplyManagerHelper { ...@@ -537,6 +548,30 @@ public class WarplyManagerHelper {
537 } 548 }
538 549
539 /** 550 /**
551 + * Open Couponset
552 + */
553 + public static void openCouponset(Context context, Campaign item) {
554 + try {
555 + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
556 + if (campaignSettings != null) {
557 + if (campaignSettings.has("couponset")) {
558 + String cpnUuid = campaignSettings.optString("couponset");
559 + for (Couponset cpns : mCouponsetsList) {
560 + if (cpns.getUuid().equals(cpnUuid)) {
561 + Intent intent = new Intent(context, CouponsetInfoActivity.class);
562 + intent.putExtra("couponset", (Serializable) cpns);
563 + context.startActivity(intent);
564 + break;
565 + }
566 + }
567 + }
568 + }
569 + } catch (Exception exception) {
570 + exception.printStackTrace();
571 + }
572 + }
573 +
574 + /**
540 * Save if customer is nonTelco and if he/she has accepted the consents, 575 * Save if customer is nonTelco and if he/she has accepted the consents,
541 * And his msisdn list 576 * And his msisdn list
542 */ 577 */
......
...@@ -382,7 +382,7 @@ public class WarpView extends WebView { ...@@ -382,7 +382,7 @@ public class WarpView extends WebView {
382 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel(); 382 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
383 questionnaireEvent.setName(parts[1]); 383 questionnaireEvent.setName(parts[1]);
384 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); 384 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
385 - } else if (parts[1].equals("addUserTag")) { 385 + } else if (parts[1].equals("userAnswered")) {
386 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel(); 386 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
387 try { 387 try {
388 questionnaireEvent.setName(parts[1]); 388 questionnaireEvent.setName(parts[1]);
...@@ -395,6 +395,19 @@ public class WarpView extends WebView { ...@@ -395,6 +395,19 @@ public class WarpView extends WebView {
395 WarpUtils.setUserTag(Warply.getWarplyContext(), ""); 395 WarpUtils.setUserTag(Warply.getWarplyContext(), "");
396 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); 396 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
397 } 397 }
398 + } else if (parts[1].equals("addUserTag")) {
399 +// QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
400 + try {
401 +// questionnaireEvent.setName(parts[1]);
402 +// questionnaireEvent.setParameter(parts[2]);
403 + WarpUtils.setUserTag(Warply.getWarplyContext(), parts[2]);
404 +// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
405 + } catch (IndexOutOfBoundsException e) {
406 +// questionnaireEvent.setName(parts[1]);
407 +// questionnaireEvent.setParameter("");
408 + WarpUtils.setUserTag(Warply.getWarplyContext(), "");
409 +// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
410 + }
398 } else if (parts[1].equals("couponRetrieved")) { 411 } else if (parts[1].equals("couponRetrieved")) {
399 EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 412 EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
400 } else if (parts[1].equals("couponShared")) { 413 } else if (parts[1].equals("couponShared")) {
......