Panagiotis Triantafyllou

feedback fixes and changes

...@@ -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.5.4r16' 5 + PUBLISH_VERSION = '4.5.5.4r17'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -34,10 +34,8 @@ import ly.warp.sdk.io.models.CouponList; ...@@ -34,10 +34,8 @@ import ly.warp.sdk.io.models.CouponList;
34 import ly.warp.sdk.io.models.Couponset; 34 import ly.warp.sdk.io.models.Couponset;
35 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; 35 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
36 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; 36 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
37 -import ly.warp.sdk.io.models.OpenMyRewardsEventModel;
38 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; 37 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
39 import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; 38 import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
40 -import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
41 import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; 39 import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
42 import ly.warp.sdk.services.EventCampaignService; 40 import ly.warp.sdk.services.EventCampaignService;
43 import ly.warp.sdk.utils.WarpUtils; 41 import ly.warp.sdk.utils.WarpUtils;
...@@ -237,12 +235,8 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -237,12 +235,8 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
237 mCoupon.setImage(mCouponset.getImgPreview()); 235 mCoupon.setImage(mCouponset.getImgPreview());
238 mCoupon.setName(mCouponset.getName()); 236 mCoupon.setName(mCouponset.getName());
239 showDialog(true, 1); 237 showDialog(true, 1);
240 - new Thread(() -> { 238 + WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
241 - if (!Thread.currentThread().isInterrupted()) { 239 + WarplyManager.getCampaigns(mCampaignsCallback);
242 - WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
243 - WarplyManager.getCampaigns(mCampaignsCallback);
244 - }
245 - }).start();
246 } else { 240 } else {
247 showDialog(false, status); 241 showDialog(false, status);
248 } 242 }
...@@ -364,7 +358,6 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -364,7 +358,6 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
364 private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { 358 private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
365 @Override 359 @Override
366 public void onSuccess(CouponList result) { 360 public void onSuccess(CouponList result) {
367 -// Thread.currentThread().interrupt();
368 WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); 361 WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
369 couponsChanged.setChanged(true); 362 couponsChanged.setChanged(true);
370 EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); 363 EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
...@@ -372,7 +365,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -372,7 +365,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
372 365
373 @Override 366 @Override
374 public void onFailure(int errorCode) { 367 public void onFailure(int errorCode) {
375 - Thread.currentThread().interrupt(); 368 +
376 } 369 }
377 }; 370 };
378 371
...@@ -381,12 +374,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -381,12 +374,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
381 public void onSuccess(ArrayList<Campaign> result) { 374 public void onSuccess(ArrayList<Campaign> result) {
382 OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); 375 OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
383 WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork); 376 WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork);
384 -// Thread.currentThread().interrupt();
385 } 377 }
386 378
387 @Override 379 @Override
388 public void onFailure(int errorCode) { 380 public void onFailure(int errorCode) {
389 - Thread.currentThread().interrupt(); 381 +
390 } 382 }
391 }; 383 };
392 384
......
...@@ -110,6 +110,7 @@ public class Campaign implements Parcelable, Serializable { ...@@ -110,6 +110,7 @@ public class Campaign implements Parcelable, Serializable {
110 private String endDate, startDate; 110 private String endDate, startDate;
111 private boolean showExpiration; 111 private boolean showExpiration;
112 private String couponImg; 112 private String couponImg;
113 + private String filter = "";
113 114
114 /** 115 /**
115 * Basic constructor used to create an object from a String, representing a 116 * Basic constructor used to create an object from a String, representing a
...@@ -698,6 +699,14 @@ public class Campaign implements Parcelable, Serializable { ...@@ -698,6 +699,14 @@ public class Campaign implements Parcelable, Serializable {
698 this.couponImg = couponImg; 699 this.couponImg = couponImg;
699 } 700 }
700 701
702 + public String getFilter() {
703 + return filter;
704 + }
705 +
706 + public void setFilter(String filter) {
707 + this.filter = filter;
708 + }
709 +
701 @Override 710 @Override
702 public int describeContents() { 711 public int describeContents() {
703 return 0; 712 return 0;
......
...@@ -95,6 +95,7 @@ public class NewCampaign implements Parcelable, Serializable { ...@@ -95,6 +95,7 @@ public class NewCampaign implements Parcelable, Serializable {
95 private String bannerTitle = ""; 95 private String bannerTitle = "";
96 private boolean showExpiration = false; 96 private boolean showExpiration = false;
97 private String couponImg = ""; 97 private String couponImg = "";
98 + private String filter = "";
98 99
99 /** 100 /**
100 * Basic constructor used to create an object from a String, representing a 101 * Basic constructor used to create an object from a String, representing a
...@@ -146,6 +147,11 @@ public class NewCampaign implements Parcelable, Serializable { ...@@ -146,6 +147,11 @@ public class NewCampaign implements Parcelable, Serializable {
146 } else { 147 } else {
147 this.showExpiration = false; 148 this.showExpiration = false;
148 } 149 }
150 + if (this.extraFields.has("filter")) {
151 + this.filter = this.extraFields.optString("filter");
152 + } else {
153 + this.filter = "";
154 + }
149 } 155 }
150 this.couponImg = json.optString("coupon_img"); 156 this.couponImg = json.optString("coupon_img");
151 } 157 }
...@@ -402,6 +408,14 @@ public class NewCampaign implements Parcelable, Serializable { ...@@ -402,6 +408,14 @@ public class NewCampaign implements Parcelable, Serializable {
402 this.couponImg = couponImg; 408 this.couponImg = couponImg;
403 } 409 }
404 410
411 + public String getFilter() {
412 + return filter;
413 + }
414 +
415 + public void setFilter(String filter) {
416 + this.filter = filter;
417 + }
418 +
405 @Override 419 @Override
406 public int describeContents() { 420 public int describeContents() {
407 return 0; 421 return 0;
......
...@@ -1533,7 +1533,8 @@ public class WarplyManager { ...@@ -1533,7 +1533,8 @@ public class WarplyManager {
1533 JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 1533 JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1534 if (campMetadata != null) { 1534 if (campMetadata != null) {
1535 if (campMetadata.has("carousel")) { 1535 if (campMetadata.has("carousel")) {
1536 - campaignCarouselList.add(camp); 1536 + if (camp.getCouponAvailability() == null || camp.getCouponAvailability() != 0)
1537 + campaignCarouselList.add(camp);
1537 } 1538 }
1538 } 1539 }
1539 1540
...@@ -1541,11 +1542,13 @@ public class WarplyManager { ...@@ -1541,11 +1542,13 @@ public class WarplyManager {
1541 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 1542 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1542 if (extraFields != null) { 1543 if (extraFields != null) {
1543 if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) { 1544 if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
1544 - campaignLoyaltyList.add(camp); 1545 + if (camp.getCouponAvailability() == null || camp.getCouponAvailability() != 0)
1546 + campaignLoyaltyList.add(camp);
1545 } 1547 }
1546 } 1548 }
1547 } catch (Exception exception) { 1549 } catch (Exception exception) {
1548 - campaignLoyaltyList.add(camp); 1550 + if (camp.getCouponAvailability() == null || camp.getCouponAvailability() != 0)
1551 + campaignLoyaltyList.add(camp);
1549 } 1552 }
1550 } 1553 }
1551 WarplyManagerHelper.setCampaignList(newCampaignList); 1554 WarplyManagerHelper.setCampaignList(newCampaignList);
...@@ -1770,6 +1773,7 @@ public class WarplyManager { ...@@ -1770,6 +1773,7 @@ public class WarplyManager {
1770 camp.setStartDate(newCamp.getStartDate()); 1773 camp.setStartDate(newCamp.getStartDate());
1771 camp.setShowExpiration(newCamp.isShowExpiration()); 1774 camp.setShowExpiration(newCamp.isShowExpiration());
1772 camp.setCouponImg(newCamp.getCouponImg()); 1775 camp.setCouponImg(newCamp.getCouponImg());
1776 + camp.setFilter(newCamp.getFilter());
1773 try { 1777 try {
1774 camp.setExtraFields(newCamp.getExtraFields().toString()); 1778 camp.setExtraFields(newCamp.getExtraFields().toString());
1775 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) { 1779 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) {
...@@ -1918,6 +1922,7 @@ public class WarplyManager { ...@@ -1918,6 +1922,7 @@ public class WarplyManager {
1918 camp.setStartDate(newCamp.getStartDate()); 1922 camp.setStartDate(newCamp.getStartDate());
1919 camp.setShowExpiration(newCamp.isShowExpiration()); 1923 camp.setShowExpiration(newCamp.isShowExpiration());
1920 camp.setCouponImg(newCamp.getCouponImg()); 1924 camp.setCouponImg(newCamp.getCouponImg());
1925 + camp.setFilter(newCamp.getFilter());
1921 try { 1926 try {
1922 camp.setExtraFields(newCamp.getExtraFields().toString()); 1927 camp.setExtraFields(newCamp.getExtraFields().toString());
1923 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) { 1928 if (!TextUtils.isEmpty(newCamp.getExtraFields().toString())) {
......
...@@ -89,8 +89,6 @@ import ly.warp.sdk.R; ...@@ -89,8 +89,6 @@ import ly.warp.sdk.R;
89 import ly.warp.sdk.Warply; 89 import ly.warp.sdk.Warply;
90 import ly.warp.sdk.activities.ActiveCouponsActivity; 90 import ly.warp.sdk.activities.ActiveCouponsActivity;
91 import ly.warp.sdk.activities.ActiveUnifiedCouponsActivity; 91 import ly.warp.sdk.activities.ActiveUnifiedCouponsActivity;
92 -import ly.warp.sdk.activities.BaseFragmentActivity;
93 -import ly.warp.sdk.activities.CouponsetInfoActivity;
94 import ly.warp.sdk.activities.WarpViewActivity; 92 import ly.warp.sdk.activities.WarpViewActivity;
95 import ly.warp.sdk.db.WarplyDBHelper; 93 import ly.warp.sdk.db.WarplyDBHelper;
96 import ly.warp.sdk.io.callbacks.CallbackReceiver; 94 import ly.warp.sdk.io.callbacks.CallbackReceiver;
...@@ -99,7 +97,6 @@ import ly.warp.sdk.io.models.CouponEventModel; ...@@ -99,7 +97,6 @@ import ly.warp.sdk.io.models.CouponEventModel;
99 import ly.warp.sdk.io.models.CouponList; 97 import ly.warp.sdk.io.models.CouponList;
100 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; 98 import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel;
101 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; 99 import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
102 -import ly.warp.sdk.io.models.OpenMyRewardsEventModel;
103 import ly.warp.sdk.io.models.QuestionnaireEventModel; 100 import ly.warp.sdk.io.models.QuestionnaireEventModel;
104 import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel; 101 import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel;
105 import ly.warp.sdk.io.models.RefreshVouchersEventModel; 102 import ly.warp.sdk.io.models.RefreshVouchersEventModel;
...@@ -508,18 +505,34 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -508,18 +505,34 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
508 } else if (parts[1].equals("couponRetrieved")) { 505 } else if (parts[1].equals("couponRetrieved")) {
509 EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 506 EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
510 } else if (parts[1].equals("loyaltyWallet")) { 507 } else if (parts[1].equals("loyaltyWallet")) {
508 + // Open the old LoyaltyWallet activity
511 // Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), LoyaltyWallet.class); 509 // Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), LoyaltyWallet.class);
512 // getContext().startActivity(intent); 510 // getContext().startActivity(intent);
513 511
514 - OpenMyRewardsEventModel openMyRewards = new OpenMyRewardsEventModel(); 512 + // Client now opens the new LoyaltyWallet via event which is fragment (LoyaltyFragment)
515 - openMyRewards.setOpen(true); 513 +// OpenMyRewardsEventModel openMyRewards = new OpenMyRewardsEventModel();
516 - EventBus.getDefault().post(new WarplyEventBusManager(openMyRewards)); 514 +// openMyRewards.setOpen(true);
515 +// EventBus.getDefault().post(new WarplyEventBusManager(openMyRewards));
516 +
517 + //Now the client does nothing, the sdk opens the active unified screen
518 + WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
517 519
518 RefreshVouchersEventModel vouchersRefreshed = new RefreshVouchersEventModel(); 520 RefreshVouchersEventModel vouchersRefreshed = new RefreshVouchersEventModel();
519 vouchersRefreshed.setRefreshed(true); 521 vouchersRefreshed.setRefreshed(true);
520 EventBus.getDefault().post(new WarplyEventBusManager(vouchersRefreshed)); 522 EventBus.getDefault().post(new WarplyEventBusManager(vouchersRefreshed));
521 } else if (parts[1].equals("activeCoupons")) { 523 } else if (parts[1].equals("activeCoupons")) {
522 - WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback); 524 + WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
525 + WarplyManager.getCampaigns(mCampaignsCallback);
526 +
527 + Handler handlerIntent = new Handler();
528 + Runnable runnableIntent = new Runnable() {
529 + @Override
530 + public void run() {
531 + Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), ActiveCouponsActivity.class);
532 + getContext().startActivity(intent);
533 + }
534 + };
535 + handlerIntent.postDelayed(runnableIntent, 1500);
523 } else if (parts[1].equals("ccmsRetrieved")) { 536 } else if (parts[1].equals("ccmsRetrieved")) {
524 WarplyCCMSEnabledModel ccmsEnabled = new WarplyCCMSEnabledModel(); 537 WarplyCCMSEnabledModel ccmsEnabled = new WarplyCCMSEnabledModel();
525 ccmsEnabled.setActivated(true); 538 ccmsEnabled.setActivated(true);
...@@ -900,4 +913,31 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -900,4 +913,31 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
900 getContext().startActivity(intent); 913 getContext().startActivity(intent);
901 } 914 }
902 }; 915 };
916 +
917 + private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
918 + @Override
919 + public void onSuccess(CouponList result) {
920 + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
921 + couponsChanged.setChanged(true);
922 + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
923 + }
924 +
925 + @Override
926 + public void onFailure(int errorCode) {
927 +
928 + }
929 + };
930 +
931 + private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
932 + @Override
933 + public void onSuccess(ArrayList<Campaign> result) {
934 + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
935 + WorkManager.getInstance((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext()).enqueue(mywork);
936 + }
937 +
938 + @Override
939 + public void onFailure(int errorCode) {
940 +
941 + }
942 + };
903 } 943 }
...\ No newline at end of file ...\ No newline at end of file
......