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("6012049321"), 45 + .setGuid("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-cosbeta29' 5 + PUBLISH_VERSION = '4.5.4-cosbeta30i'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -67,7 +67,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -67,7 +67,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
67 67
68 new Thread(() -> { 68 new Thread(() -> {
69 if (!Thread.currentThread().isInterrupted()) { 69 if (!Thread.currentThread().isInterrupted()) {
70 - WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver); 70 +// WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver);
71 + Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
71 } 72 }
72 }).start(); 73 }).start();
73 } 74 }
...@@ -161,20 +162,20 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -161,20 +162,20 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
161 // Inner and Anonymous Classes 162 // Inner and Anonymous Classes
162 // =========================================================== 163 // ===========================================================
163 164
164 - private final CallbackReceiver<Consumer> mConsumerReceiver = new CallbackReceiver<Consumer>() { 165 +// private final CallbackReceiver<Consumer> mConsumerReceiver = new CallbackReceiver<Consumer>() {
165 - @Override 166 +// @Override
166 - public void onSuccess(Consumer result) { 167 +// public void onSuccess(Consumer result) {
167 - mConsumer = result; 168 +// mConsumer = result;
168 - WarplyManagerHelper.setConsumer(result); 169 +//// WarplyManagerHelper.setConsumer(result);
170 +//// Thread.currentThread().interrupt();
171 +// Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
172 +// }
173 +//
174 +// @Override
175 +// public void onFailure(int errorCode) {
169 // Thread.currentThread().interrupt(); 176 // Thread.currentThread().interrupt();
170 - Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver); 177 +// }
171 - } 178 +// };
172 -
173 - @Override
174 - public void onFailure(int errorCode) {
175 - Thread.currentThread().interrupt();
176 - }
177 - };
178 179
179 private final CallbackReceiver<CampaignList> mInboxReceiver = new CallbackReceiver<CampaignList>() { 180 private final CallbackReceiver<CampaignList> mInboxReceiver = new CallbackReceiver<CampaignList>() {
180 @Override 181 @Override
......
...@@ -215,11 +215,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -215,11 +215,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
215 215
216 private void filterItems() { 216 private void filterItems() {
217 ArrayList<Campaign> gfyList = new ArrayList<>(); 217 ArrayList<Campaign> gfyList = new ArrayList<>();
218 - if (WarplyManagerHelper.getCampaignList() != null && WarplyManagerHelper.getCampaignList().size() > 0) { 218 + if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) {
219 - Log.v("Got L:{" + String.valueOf(WarplyManagerHelper.getCampaignList().size()) + "}", " LOYALTY campaigns"); 219 + Log.v("Got L:{" + String.valueOf(WarplyManagerHelper.getCampaignListAll().size()) + "}", " LOYALTY campaigns");
220 if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() == null || WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() == 0) { 220 if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() == null || WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() == 0) {
221 Log.v("Got C:{0}", " CCMS campaigns"); 221 Log.v("Got C:{0}", " CCMS campaigns");
222 - for (Campaign camp : WarplyManagerHelper.getCampaignList()) { 222 + for (Campaign camp : WarplyManagerHelper.getCampaignListAll()) {
223 if (camp.getOfferCategory().equals("gifts_for_you")) { 223 if (camp.getOfferCategory().equals("gifts_for_you")) {
224 try { 224 try {
225 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 225 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
...@@ -236,7 +236,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -236,7 +236,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
236 } else { 236 } else {
237 int ccmsCount = 0; 237 int ccmsCount = 0;
238 Log.v("Got C:{" + String.valueOf(WarplyManagerHelper.getCCMSLoyaltyCampaigns().size()) + "}", " CCMS campaigns"); 238 Log.v("Got C:{" + String.valueOf(WarplyManagerHelper.getCCMSLoyaltyCampaigns().size()) + "}", " CCMS campaigns");
239 - for (Campaign camp : WarplyManagerHelper.getCampaignList()) { 239 + for (Campaign camp : WarplyManagerHelper.getCampaignListAll()) {
240 if (camp.getOfferCategory().equals("gifts_for_you")) { 240 if (camp.getOfferCategory().equals("gifts_for_you")) {
241 try { 241 try {
242 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 242 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
......
...@@ -19,21 +19,14 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; ...@@ -19,21 +19,14 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
19 import org.greenrobot.eventbus.EventBus; 19 import org.greenrobot.eventbus.EventBus;
20 20
21 import java.io.Serializable; 21 import java.io.Serializable;
22 -import java.text.ParseException;
23 -import java.text.SimpleDateFormat;
24 import java.util.Collections; 22 import java.util.Collections;
25 import java.util.Comparator; 23 import java.util.Comparator;
26 -import java.util.Date;
27 -import java.util.concurrent.TimeUnit;
28 24
29 import ly.warp.sdk.R; 25 import ly.warp.sdk.R;
30 import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; 26 import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
31 import ly.warp.sdk.io.models.ActiveDFYCouponModel; 27 import ly.warp.sdk.io.models.ActiveDFYCouponModel;
32 -import ly.warp.sdk.io.models.Coupon;
33 -import ly.warp.sdk.io.models.CouponList;
34 -import ly.warp.sdk.io.models.Couponset;
35 -import ly.warp.sdk.io.models.CouponsetsList;
36 import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; 28 import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
29 +import ly.warp.sdk.utils.WarpUtils;
37 import ly.warp.sdk.utils.WarplyManagerHelper; 30 import ly.warp.sdk.utils.WarplyManagerHelper;
38 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 31 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
39 import ly.warp.sdk.views.adapters.ActiveCouponAdapter; 32 import ly.warp.sdk.views.adapters.ActiveCouponAdapter;
...@@ -164,23 +157,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { ...@@ -164,23 +157,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
164 // =========================================================== 157 // ===========================================================
165 158
166 private void initViews() { 159 private void initViews() {
167 - CouponList mCouponList = new CouponList(); 160 + if (WarplyManagerHelper.getCouponList() != null) {
168 - CouponList mCouponListInitial = new CouponList();
169 - mCouponListInitial.addAll(WarplyManagerHelper.getCouponList());
170 - CouponsetsList mCouponsetListInitial = new CouponsetsList();
171 - mCouponsetListInitial.addAll(WarplyManagerHelper.getCouponsets());
172 - for (Coupon coupon : mCouponListInitial) {
173 - for (Couponset couponset : mCouponsetListInitial) {
174 - if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
175 - coupon.setDescription(couponset.getShortDescription());
176 - coupon.setImage(couponset.getImgPreview());
177 - coupon.setName(couponset.getName());
178 - mCouponList.add(coupon);
179 - }
180 - }
181 - }
182 -
183 - if (mCouponList != null) {
184 mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList()); 161 mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList());
185 mRecyclerCoupons.setAdapter(mAdapterCoupons); 162 mRecyclerCoupons.setAdapter(mAdapterCoupons);
186 mAdapterCoupons.getPositionClicks() 163 mAdapterCoupons.getPositionClicks()
...@@ -194,6 +171,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { ...@@ -194,6 +171,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
194 .subscribe(); 171 .subscribe();
195 } 172 }
196 173
174 + if (WarplyManagerHelper.getLoyaltyBadge() != null) {
175 + WarpUtils.log("LOYALTY_BADGE_COUNT: " + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()));
176 + WarpUtils.log("LOYALTY_BADGE_SUM: " + String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()));
177 + }
178 +
197 mTvGiftsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()))); 179 mTvGiftsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue())));
198 mTvGiftsValueAll.setText(String.format(getString(R.string.cos_deals_win_title), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()))); 180 mTvGiftsValueAll.setText(String.format(getString(R.string.cos_deals_win_title), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())));
199 mTvDealsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(/*couponDfyValue*/ WarplyManagerHelper.getDealsCouponsSum()))); 181 mTvDealsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(/*couponDfyValue*/ WarplyManagerHelper.getDealsCouponsSum())));
......
...@@ -139,11 +139,11 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -139,11 +139,11 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
139 139
140 private void filterItems() { 140 private void filterItems() {
141 ArrayList<Campaign> gfyList = new ArrayList<>(); 141 ArrayList<Campaign> gfyList = new ArrayList<>();
142 - if (WarplyManagerHelper.getCampaignList() != null && WarplyManagerHelper.getCampaignList().size() > 0) { 142 + if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) {
143 - Log.v("Got L:{" + String.valueOf(WarplyManagerHelper.getCampaignList().size()) + "}", " LOYALTY campaigns"); 143 + Log.v("Got L:{" + String.valueOf(WarplyManagerHelper.getCampaignListAll().size()) + "}", " LOYALTY campaigns");
144 if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() == null || WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() == 0) { 144 if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() == null || WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() == 0) {
145 Log.v("Got C:{0}", " CCMS campaigns"); 145 Log.v("Got C:{0}", " CCMS campaigns");
146 - for (Campaign camp : WarplyManagerHelper.getCampaignList()) { 146 + for (Campaign camp : WarplyManagerHelper.getCampaignListAll()) {
147 if (camp.getOfferCategory().equals("more_for_you")) { 147 if (camp.getOfferCategory().equals("more_for_you")) {
148 try { 148 try {
149 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 149 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
...@@ -160,7 +160,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -160,7 +160,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
160 } else { 160 } else {
161 int ccmsCount = 0; 161 int ccmsCount = 0;
162 Log.v("Got C:{" + String.valueOf(WarplyManagerHelper.getCCMSLoyaltyCampaigns().size()) + "}", " CCMS campaigns"); 162 Log.v("Got C:{" + String.valueOf(WarplyManagerHelper.getCCMSLoyaltyCampaigns().size()) + "}", " CCMS campaigns");
163 - for (Campaign camp : WarplyManagerHelper.getCampaignList()) { 163 + for (Campaign camp : WarplyManagerHelper.getCampaignListAll()) {
164 if (camp.getOfferCategory().equals("more_for_you")) { 164 if (camp.getOfferCategory().equals("more_for_you")) {
165 try { 165 try {
166 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 166 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
......
...@@ -127,8 +127,8 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -127,8 +127,8 @@ public class WarpViewActivity extends WarpBaseActivity {
127 setResult(RESULT_OK, new Intent()); 127 setResult(RESULT_OK, new Intent());
128 finish(); 128 finish();
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)
......
...@@ -32,12 +32,12 @@ package ly.warp.sdk.io.models; ...@@ -32,12 +32,12 @@ package ly.warp.sdk.io.models;
32 public class WarplyPacingEventModel { 32 public class WarplyPacingEventModel {
33 33
34 private boolean isVisible = false; 34 private boolean isVisible = false;
35 - private boolean isEnabled = false; 35 +// private boolean isEnabled = false;
36 36
37 37
38 public WarplyPacingEventModel() { 38 public WarplyPacingEventModel() {
39 this.isVisible = false; 39 this.isVisible = false;
40 - this.isEnabled = false; 40 +// this.isEnabled = false;
41 } 41 }
42 42
43 public boolean isVisible() { 43 public boolean isVisible() {
...@@ -48,11 +48,11 @@ public class WarplyPacingEventModel { ...@@ -48,11 +48,11 @@ public class WarplyPacingEventModel {
48 isVisible = visible; 48 isVisible = visible;
49 } 49 }
50 50
51 - public boolean isEnabled() { 51 +// public boolean isEnabled() {
52 - return isEnabled; 52 +// return isEnabled;
53 - } 53 +// }
54 - 54 +//
55 - public void setEnabled(boolean enabled) { 55 +// public void setEnabled(boolean enabled) {
56 - isEnabled = enabled; 56 +// isEnabled = enabled;
57 - } 57 +// }
58 } 58 }
......
...@@ -77,6 +77,7 @@ public class WarplyManagerHelper { ...@@ -77,6 +77,7 @@ public class WarplyManagerHelper {
77 private static CouponsetsList mCouponsetsList = new CouponsetsList(); 77 private static CouponsetsList mCouponsetsList = new CouponsetsList();
78 private static CustomerStateModel mCustomerStateModel = new CustomerStateModel(); 78 private static CustomerStateModel mCustomerStateModel = new CustomerStateModel();
79 private static CampaignList mCampaignList = new CampaignList(); 79 private static CampaignList mCampaignList = new CampaignList();
80 + private static CampaignList mCampaignListAll = new CampaignList();
80 private static ArrayList<ActiveDFYCouponModel> mDfyCoupons = new ArrayList(); 81 private static ArrayList<ActiveDFYCouponModel> mDfyCoupons = new ArrayList();
81 private static ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); 82 private static ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>();
82 private static ArrayList<LoyaltyContextualOfferModel> mCCMSList = new ArrayList<>(); 83 private static ArrayList<LoyaltyContextualOfferModel> mCCMSList = new ArrayList<>();
...@@ -120,6 +121,7 @@ public class WarplyManagerHelper { ...@@ -120,6 +121,7 @@ public class WarplyManagerHelper {
120 * Handle sharing flow 121 * Handle sharing flow
121 */ 122 */
122 public static void handleSharing(Context context, String sharingId) { 123 public static void handleSharing(Context context, String sharingId) {
124 + WarpUtils.log("SHARING_ID: " + sharingId);
123 WarplyManager.cosmoteSharing(new CosmoteSharingRequest().setSharingId(sharingId), new CallbackReceiver<JSONObject>() { 125 WarplyManager.cosmoteSharing(new CosmoteSharingRequest().setSharingId(sharingId), new CallbackReceiver<JSONObject>() {
124 @Override 126 @Override
125 public void onSuccess(JSONObject result) { 127 public void onSuccess(JSONObject result) {
...@@ -274,7 +276,7 @@ public class WarplyManagerHelper { ...@@ -274,7 +276,7 @@ public class WarplyManagerHelper {
274 public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) { 276 public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) {
275 Log.v("CCMS_PRESSED", ccmsItem.getId() + " " + ccmsItem.getOfferName()); 277 Log.v("CCMS_PRESSED", ccmsItem.getId() + " " + ccmsItem.getOfferName());
276 item.setNew(false); 278 item.setNew(false);
277 - String tempAudienceLevel = ccmsItem.getEligibleAssets() != null && ccmsItem.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID"; 279 +// String tempAudienceLevel = ccmsItem.getEligibleAssets() != null && ccmsItem.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID";
278 String assets = ""; 280 String assets = "";
279 if (ccmsItem.getEligibleAssets() != null && ccmsItem.getEligibleAssets().size() > 0) { 281 if (ccmsItem.getEligibleAssets() != null && ccmsItem.getEligibleAssets().size() > 0) {
280 for (String singleAsset : ccmsItem.getEligibleAssets()) { 282 for (String singleAsset : ccmsItem.getEligibleAssets()) {
...@@ -313,7 +315,7 @@ public class WarplyManagerHelper { ...@@ -313,7 +315,7 @@ public class WarplyManagerHelper {
313 + "&WAVE=" + ccmsItem.getWave() 315 + "&WAVE=" + ccmsItem.getWave()
314 + "&VALIDITY=" + ccmsItem.getValidity() 316 + "&VALIDITY=" + ccmsItem.getValidity()
315 + "&TREATMENT_CODE=" + ccmsItem.getTreatmentCode() 317 + "&TREATMENT_CODE=" + ccmsItem.getTreatmentCode()
316 - + "&OfferAudienceLevel=" + tempAudienceLevel 318 + + "&OfferAudienceLevel=" + ccmsItem.getOfferAudienceLevel()
317 + "&ASSETS=" + assets 319 + "&ASSETS=" + assets
318 + "&ZONE=" + ccmsItem.getZone(); 320 + "&ZONE=" + ccmsItem.getZone();
319 321
...@@ -339,7 +341,7 @@ public class WarplyManagerHelper { ...@@ -339,7 +341,7 @@ public class WarplyManagerHelper {
339 if (extraFields != null) { 341 if (extraFields != null) {
340 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 342 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
341 if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) { 343 if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
342 - String tempAudienceLevel = item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID"; 344 +// String tempAudienceLevel = item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID";
343 String assets = ""; 345 String assets = "";
344 if (item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0) { 346 if (item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0) {
345 for (String singleAsset : item.getEligibleAssets()) { 347 for (String singleAsset : item.getEligibleAssets()) {
...@@ -379,7 +381,7 @@ public class WarplyManagerHelper { ...@@ -379,7 +381,7 @@ public class WarplyManagerHelper {
379 + "&WAVE=" + item.getWave() 381 + "&WAVE=" + item.getWave()
380 + "&VALIDITY=" + item.getValidity() 382 + "&VALIDITY=" + item.getValidity()
381 + "&TREATMENT_CODE=" + item.getTreatmentCode() 383 + "&TREATMENT_CODE=" + item.getTreatmentCode()
382 - + "&OfferAudienceLevel=" + tempAudienceLevel 384 + + "&OfferAudienceLevel=" + item.getOfferAudienceLevel()
383 + "&ASSETS=" + assets 385 + "&ASSETS=" + assets
384 + "&ZONE=" + item.getZone(); 386 + "&ZONE=" + item.getZone();
385 break; 387 break;
...@@ -518,7 +520,9 @@ public class WarplyManagerHelper { ...@@ -518,7 +520,9 @@ public class WarplyManagerHelper {
518 if (mCampaignList != null && mCampaignList.size() > 0) { 520 if (mCampaignList != null && mCampaignList.size() > 0) {
519 for (Campaign camp : mCampaignList) { 521 for (Campaign camp : mCampaignList) {
520 if (camp.getOfferCategory().equals("pacing")) { 522 if (camp.getOfferCategory().equals("pacing")) {
521 - return constructCampaignUrl(camp); 523 + String pacingUrl = constructCampaignUrl(camp);
524 + WarpUtils.log("PACING_LOG: " + pacingUrl);
525 + return pacingUrl;
522 } 526 }
523 } 527 }
524 } 528 }
...@@ -589,6 +593,11 @@ public class WarplyManagerHelper { ...@@ -589,6 +593,11 @@ public class WarplyManagerHelper {
589 } 593 }
590 594
591 public static CouponList getCouponList() { 595 public static CouponList getCouponList() {
596 + if (mCouponList != null && mCouponList.size() > 0) {
597 + WarpUtils.log("GET_COUPON_LIST size: " + String.valueOf(mCouponList.size()));
598 + } else {
599 + WarpUtils.log("GET_COUPON_LIST size: 0");
600 + }
592 return mCouponList; 601 return mCouponList;
593 } 602 }
594 603
...@@ -617,14 +626,35 @@ public class WarplyManagerHelper { ...@@ -617,14 +626,35 @@ public class WarplyManagerHelper {
617 } 626 }
618 627
619 public static void setCampaignList(CampaignList campaignList) { 628 public static void setCampaignList(CampaignList campaignList) {
629 +// mCampaignList.clear();
630 +// mCampaignList.addAll(campaignList);
631 +
632 + mCampaignListAll.clear();
633 + mCampaignListAll.addAll(campaignList);
634 +
620 mCampaignList.clear(); 635 mCampaignList.clear();
621 - mCampaignList.addAll(campaignList); 636 + for (Campaign camp : campaignList) {
637 + try {
638 + JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
639 + if (extraFields != null) {
640 + if (extraFields.length() == 0 || !extraFields.has("ccms_offer")) {
641 + mCampaignList.add(camp);
642 + }
643 + }
644 + } catch (Exception exception) {
645 + mCampaignList.add(camp);
646 + }
647 + }
622 } 648 }
623 649
624 public static CampaignList getCampaignList() { 650 public static CampaignList getCampaignList() {
625 return mCampaignList; 651 return mCampaignList;
626 } 652 }
627 653
654 + public static CampaignList getCampaignListAll() {
655 + return mCampaignListAll;
656 + }
657 +
628 public static void setCouponList(CouponList couponList) { 658 public static void setCouponList(CouponList couponList) {
629 LoyaltyBadgeModel badge = new LoyaltyBadgeModel(); 659 LoyaltyBadgeModel badge = new LoyaltyBadgeModel();
630 CouponList cpnlist = new CouponList(); 660 CouponList cpnlist = new CouponList();
...@@ -632,19 +662,13 @@ public class WarplyManagerHelper { ...@@ -632,19 +662,13 @@ public class WarplyManagerHelper {
632 int couponCount = 0; 662 int couponCount = 0;
633 for (Coupon coupon : couponList) { 663 for (Coupon coupon : couponList) {
634 if (coupon.getStatus() == 1) { 664 if (coupon.getStatus() == 1) {
635 - try {
636 - float tempCouponValue = Float.parseFloat(coupon.getDiscount());
637 cpnlist.add(coupon); 665 cpnlist.add(coupon);
638 - } catch (NumberFormatException e) {
639 - cpnlist.remove(coupon);
640 - }
641 } else if (coupon.getStatus() == 0) { 666 } else if (coupon.getStatus() == 0) {
642 try { 667 try {
643 couponCount += 1; 668 couponCount += 1;
644 couponValue += Float.parseFloat(coupon.getDiscount()); 669 couponValue += Float.parseFloat(coupon.getDiscount());
645 } catch (NumberFormatException e) { 670 } catch (NumberFormatException e) {
646 couponCount -= 1; 671 couponCount -= 1;
647 - cpnlist.remove(coupon);
648 } 672 }
649 } 673 }
650 } 674 }
......
...@@ -107,6 +107,7 @@ import ly.warp.sdk.io.request.WarplyUserCouponsRequest; ...@@ -107,6 +107,7 @@ import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
107 import ly.warp.sdk.io.request.WarplyValidateCouponRequest; 107 import ly.warp.sdk.io.request.WarplyValidateCouponRequest;
108 import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; 108 import ly.warp.sdk.io.request.WarplyVerifyOTPRequest;
109 import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; 109 import ly.warp.sdk.io.request.WarplyVerifyTicketRequest;
110 +import ly.warp.sdk.utils.WarpJSONParser;
110 import ly.warp.sdk.utils.WarpUtils; 111 import ly.warp.sdk.utils.WarpUtils;
111 import ly.warp.sdk.utils.WarplyManagerHelper; 112 import ly.warp.sdk.utils.WarplyManagerHelper;
112 import ly.warp.sdk.utils.WarplyProperty; 113 import ly.warp.sdk.utils.WarplyProperty;
...@@ -778,6 +779,26 @@ public class WarplyManager { ...@@ -778,6 +779,26 @@ public class WarplyManager {
778 e.printStackTrace(); 779 e.printStackTrace();
779 receiver.onFailure(2); 780 receiver.onFailure(2);
780 } 781 }
782 +
783 + getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
784 + @Override
785 + public void onSuccess(Consumer result) {
786 + WarplyManagerHelper.setConsumer(result);
787 + if (result != null) {
788 + JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
789 + if (profMetadata != null) {
790 + if (profMetadata.has("badge")) {
791 + WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge"));
792 + }
793 + }
794 + }
795 + }
796 +
797 + @Override
798 + public void onFailure(int errorCode) {
799 +
800 + }
801 + });
781 } else 802 } else
782 receiver.onFailure(2); 803 receiver.onFailure(2);
783 } else 804 } else
...@@ -799,19 +820,19 @@ public class WarplyManager { ...@@ -799,19 +820,19 @@ public class WarplyManager {
799 Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, true, "context", request.toJson(), new CouponsHook(new CallbackReceiver<CouponList>() { 820 Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, true, "context", request.toJson(), new CouponsHook(new CallbackReceiver<CouponList>() {
800 @Override 821 @Override
801 public void onSuccess(CouponList result) { 822 public void onSuccess(CouponList result) {
802 - CouponList mCouponList = new CouponList(); 823 +// CouponList mCouponList = new CouponList();
803 - for (Coupon coupon : result) { 824 +// for (Coupon coupon : result) {
804 - for (Couponset couponset : WarplyManagerHelper.getCouponsets()) { 825 +// for (Couponset couponset : WarplyManagerHelper.getCouponsets()) {
805 - if (coupon.getCouponsetUuid().equals(couponset.getUuid())) { 826 +// if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
806 - coupon.setDescription(couponset.getShortDescription()); 827 +// coupon.setDescription(couponset.getShortDescription());
807 - coupon.setImage(couponset.getImgPreview()); 828 +// coupon.setImage(couponset.getImgPreview());
808 - coupon.setName(couponset.getName()); 829 +// coupon.setName(couponset.getName());
809 - mCouponList.add(coupon); 830 +// mCouponList.add(coupon);
810 - } 831 +// }
811 - } 832 +// }
812 - } 833 +// }
813 - WarplyManagerHelper.setCouponList(mCouponList); 834 +// WarplyManagerHelper.setCouponList(mCouponList);
814 - receiver.onSuccess(mCouponList); 835 + receiver.onSuccess(/*mCouponList*/ result);
815 } 836 }
816 837
817 @Override 838 @Override
...@@ -1618,6 +1639,26 @@ public class WarplyManager { ...@@ -1618,6 +1639,26 @@ public class WarplyManager {
1618 e.printStackTrace(); 1639 e.printStackTrace();
1619 receiver.onFailure(2); 1640 receiver.onFailure(2);
1620 } 1641 }
1642 +
1643 + getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
1644 + @Override
1645 + public void onSuccess(Consumer result) {
1646 + WarplyManagerHelper.setConsumer(result);
1647 + if (result != null) {
1648 + JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
1649 + if (profMetadata != null) {
1650 + if (profMetadata.has("badge")) {
1651 + WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge"));
1652 + }
1653 + }
1654 + }
1655 + }
1656 +
1657 + @Override
1658 + public void onFailure(int errorCode) {
1659 +
1660 + }
1661 + });
1621 } else 1662 } else
1622 receiver.onFailure(2); 1663 receiver.onFailure(2);
1623 } else 1664 } else
......
...@@ -396,8 +396,10 @@ public class WarpView extends WebView { ...@@ -396,8 +396,10 @@ public class WarpView extends WebView {
396 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); 396 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
397 } 397 }
398 } else if (parts[1].equals("couponRetrieved")) { 398 } else if (parts[1].equals("couponRetrieved")) {
399 + EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
400 + } else if (parts[1].equals("couponShared")) {
399 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 401 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
400 - } else if (parts[2].equals("serviceDisabled")) { 402 + } /*else if (parts[2].equals("serviceDisabled")) {
401 // WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG); 403 // WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG);
402 WarplyPacingEventModel pacingService = new WarplyPacingEventModel(); 404 WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
403 pacingService.setEnabled(false); 405 pacingService.setEnabled(false);
...@@ -407,11 +409,11 @@ public class WarpView extends WebView { ...@@ -407,11 +409,11 @@ public class WarpView extends WebView {
407 WarplyPacingEventModel pacingService = new WarplyPacingEventModel(); 409 WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
408 pacingService.setEnabled(true); 410 pacingService.setEnabled(true);
409 EventBus.getDefault().post(new WarplyEventBusManager(pacingService)); 411 EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
410 - } else if (parts[2].equals("shortcutEnabled")) { 412 + }*/ else if (parts[1].equals("steps") && parts[2].equals("shortcutEnabled")) {
411 WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel(); 413 WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
412 pacingVisible.setVisible(true); 414 pacingVisible.setVisible(true);
413 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); 415 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
414 - } else if (parts[2].equals("shortcutDisabled")) { 416 + } else if (parts[1].equals("steps") && parts[2].equals("shortcutDisabled")) {
415 WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel(); 417 WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
416 pacingVisible.setVisible(false); 418 pacingVisible.setVisible(false);
417 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); 419 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
......
...@@ -129,7 +129,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -129,7 +129,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
129 else 129 else
130 holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); 130 holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
131 131
132 - holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); 132 + holder.tvCouponValue.setText(couponItem.getDiscount());
133 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); 133 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
134 } 134 }
135 } 135 }
......