Panagiotis Triantafyllou

sm fixes

...@@ -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.6rc59' 5 + PUBLISH_VERSION = '4.5.4.6rc60'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -203,6 +203,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -203,6 +203,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
203 if (mIsFromWallet) { 203 if (mIsFromWallet) {
204 mTvCouponCodeTitle.setVisibility(View.GONE); 204 mTvCouponCodeTitle.setVisibility(View.GONE);
205 mTvCouponCode.setVisibility(View.GONE); 205 mTvCouponCode.setVisibility(View.GONE);
206 + mLlGiftIt.setVisibility(View.GONE);
206 } 207 }
207 mLlBarcodeShown.setVisibility(View.GONE); 208 mLlBarcodeShown.setVisibility(View.GONE);
208 mLlBarcodeContainer.setVisibility(View.GONE); 209 mLlBarcodeContainer.setVisibility(View.GONE);
......
...@@ -95,7 +95,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -95,7 +95,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
95 private int mTimer = 0; 95 private int mTimer = 0;
96 private Handler mSecondsHandler; 96 private Handler mSecondsHandler;
97 private ArrayList<UnifiedCoupon> mUnifiedCoupons = new ArrayList<UnifiedCoupon>(); 97 private ArrayList<UnifiedCoupon> mUnifiedCoupons = new ArrayList<UnifiedCoupon>();
98 - private ArrayList<UnifiedCoupon> mUnifiedCouponsAll = new ArrayList<UnifiedCoupon>();
99 private float countValue = 0.0f; 98 private float countValue = 0.0f;
100 private MarketCouponAdapter mAdapterMarketCoupons; 99 private MarketCouponAdapter mAdapterMarketCoupons;
101 private ExpandableLayout mElGifts; 100 private ExpandableLayout mElGifts;
...@@ -499,9 +498,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -499,9 +498,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
499 } 498 }
500 499
501 // Third Expandable Banner 500 // Third Expandable Banner
502 - if (mUnifiedCouponsAll.size() > 0) { 501 + if (WarplyManagerHelper.getMarketCoupons().size() > 0) {
503 countValue = 0.0f; 502 countValue = 0.0f;
504 - for (UnifiedCoupon unicou : mUnifiedCouponsAll) { 503 + for (UnifiedCoupon unicou : WarplyManagerHelper.getMarketCoupons()) {
505 if (unicou.getCoupons() != null && unicou.getCoupons().size() > 0) { 504 if (unicou.getCoupons() != null && unicou.getCoupons().size() > 0) {
506 for (Coupon inncou : unicou.getCoupons()) { 505 for (Coupon inncou : unicou.getCoupons()) {
507 if (inncou.getStatus() == 0) { 506 if (inncou.getStatus() == 0) {
...@@ -666,20 +665,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -666,20 +665,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
666 private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() { 665 private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
667 @Override 666 @Override
668 public void onSuccess(ArrayList<UnifiedCoupon> result) { 667 public void onSuccess(ArrayList<UnifiedCoupon> result) {
669 - final ExecutorService executor = Executors.newFixedThreadPool(1); 668 + mUnifiedCoupons = result;
670 - executor.submit(() -> { 669 + initViews();
671 - mUnifiedCouponsAll = result;
672 - ArrayList<UnifiedCoupon> cpnlist = new ArrayList<UnifiedCoupon>();
673 - for (UnifiedCoupon cpn : result) {
674 - if (cpn.getStatus().trim().equals("active")) {
675 - cpnlist.add(cpn);
676 - }
677 - }
678 - mUnifiedCoupons = cpnlist;
679 - WarplyManagerHelper.setMarketCoupons(result);
680 - new Handler(Looper.getMainLooper()).post(() -> initViews());
681 - executor.shutdownNow();
682 - });
683 } 670 }
684 671
685 @Override 672 @Override
......
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 +/**
30 + * Created by Panagiotis Triantafyllou on 21-June-23.
31 + */
32 +
33 +public class WarplyUnifiedActivatedEventModel {
34 + private boolean activated;
35 +
36 + public WarplyUnifiedActivatedEventModel() {
37 + this.activated = true;
38 + }
39 +
40 + public boolean isActivated() {
41 + return activated;
42 + }
43 +
44 + public void setActivated(boolean activated) {
45 + this.activated = activated;
46 + }
47 +}
...@@ -215,9 +215,10 @@ public class WarplyManagerHelper { ...@@ -215,9 +215,10 @@ public class WarplyManagerHelper {
215 if (innerResult != null) { 215 if (innerResult != null) {
216 String modalText = innerResult.optString("modal_text", ""); 216 String modalText = innerResult.optString("modal_text", "");
217 String sharingStatus = innerResult.optString("status", ""); 217 String sharingStatus = innerResult.optString("status", "");
218 + String couponsetType = innerResult.optString("couponset_type", "");
218 219
219 if (!TextUtils.isEmpty(sharingStatus) && sharingStatus.equals("pending")) { 220 if (!TextUtils.isEmpty(sharingStatus) && sharingStatus.equals("pending")) {
220 - initialSharingDialog(context, modalText, sharingId); 221 + initialSharingDialog(context, modalText, sharingId, !TextUtils.isEmpty(couponsetType) && couponsetType.equals("supermarket"));
221 return; 222 return;
222 } 223 }
223 if (!TextUtils.isEmpty(sharingStatus) && sharingStatus.equals("reject")) { 224 if (!TextUtils.isEmpty(sharingStatus) && sharingStatus.equals("reject")) {
...@@ -247,7 +248,7 @@ public class WarplyManagerHelper { ...@@ -247,7 +248,7 @@ public class WarplyManagerHelper {
247 /** 248 /**
248 * First dialog when we handle the deeplink 249 * First dialog when we handle the deeplink
249 */ 250 */
250 - private static void initialSharingDialog(Context context, String alertTitle, String sharingId) { 251 + private static void initialSharingDialog(Context context, String alertTitle, String sharingId, boolean isSupermarket) {
251 mAlertDialogSharing = new AlertDialog.Builder(context) 252 mAlertDialogSharing = new AlertDialog.Builder(context)
252 .setTitle(R.string.cos_dlg_success_title) 253 .setTitle(R.string.cos_dlg_success_title)
253 .setMessage(alertTitle) 254 .setMessage(alertTitle)
...@@ -276,7 +277,7 @@ public class WarplyManagerHelper { ...@@ -276,7 +277,7 @@ public class WarplyManagerHelper {
276 277
277 } 278 }
278 }); 279 });
279 - acceptSharingDialog(context); 280 + acceptSharingDialog(context, isSupermarket);
280 } else 281 } else
281 errorSharingDialog(context); 282 errorSharingDialog(context);
282 } 283 }
...@@ -293,10 +294,10 @@ public class WarplyManagerHelper { ...@@ -293,10 +294,10 @@ public class WarplyManagerHelper {
293 /** 294 /**
294 * Dialog when we success get the sharing gift 295 * Dialog when we success get the sharing gift
295 */ 296 */
296 - private static void acceptSharingDialog(Context context) { 297 + private static void acceptSharingDialog(Context context, boolean isSupermarket) {
297 mAlertDialogAcceptSharing = new AlertDialog.Builder(context) 298 mAlertDialogAcceptSharing = new AlertDialog.Builder(context)
298 .setTitle(R.string.cos_dlg_success_title) 299 .setTitle(R.string.cos_dlg_success_title)
299 - .setMessage(R.string.cos_dlg_positive_button_text) 300 + .setMessage(isSupermarket ? R.string.cos_dlg_positive_button_text2 : R.string.cos_dlg_positive_button_text)
300 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { 301 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
301 dialogPositive.dismiss(); 302 dialogPositive.dismiss();
302 }) 303 })
...@@ -1253,7 +1254,7 @@ public class WarplyManagerHelper { ...@@ -1253,7 +1254,7 @@ public class WarplyManagerHelper {
1253 return mMarketCoupons; 1254 return mMarketCoupons;
1254 } 1255 }
1255 1256
1256 - public static void setMarketCoupons( ArrayList<UnifiedCoupon> marketCoupons) { 1257 + public static void setMarketCoupons(ArrayList<UnifiedCoupon> marketCoupons) {
1257 mMarketCoupons = marketCoupons; 1258 mMarketCoupons = marketCoupons;
1258 } 1259 }
1259 1260
......
...@@ -20,6 +20,7 @@ import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; ...@@ -20,6 +20,7 @@ import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
20 import ly.warp.sdk.io.models.WarplyPacingCardEventModel; 20 import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
21 import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; 21 import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel;
22 import ly.warp.sdk.io.models.WarplyPacingEventModel; 22 import ly.warp.sdk.io.models.WarplyPacingEventModel;
23 +import ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel;
23 import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel; 24 import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel;
24 import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel; 25 import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel;
25 26
...@@ -50,11 +51,16 @@ public class WarplyEventBusManager { ...@@ -50,11 +51,16 @@ public class WarplyEventBusManager {
50 51
51 private WarplyWebviewCallbackEventModel webviewCallback; 52 private WarplyWebviewCallbackEventModel webviewCallback;
52 private WarplyWebviewActivityCallbackEventModel webviewActivityCallback; 53 private WarplyWebviewActivityCallbackEventModel webviewActivityCallback;
54 + private WarplyUnifiedActivatedEventModel unifiedActivated;
53 55
54 public WarplyEventBusManager() { 56 public WarplyEventBusManager() {
55 57
56 } 58 }
57 59
60 + public WarplyEventBusManager(WarplyUnifiedActivatedEventModel unifiedActivated) {
61 + this.unifiedActivated = unifiedActivated;
62 + }
63 +
58 public WarplyEventBusManager(String eventName) { 64 public WarplyEventBusManager(String eventName) {
59 this.eventName = eventName; 65 this.eventName = eventName;
60 } 66 }
...@@ -248,4 +254,8 @@ public class WarplyEventBusManager { ...@@ -248,4 +254,8 @@ public class WarplyEventBusManager {
248 public WarplyWebviewActivityCallbackEventModel getWarplyWebviewActivityCallbackEventModel() { 254 public WarplyWebviewActivityCallbackEventModel getWarplyWebviewActivityCallbackEventModel() {
249 return webviewActivityCallback; 255 return webviewActivityCallback;
250 } 256 }
257 +
258 + public WarplyUnifiedActivatedEventModel getWarplyUnifiedActivatedEventModel() {
259 + return unifiedActivated;
260 + }
251 } 261 }
......
...@@ -1910,6 +1910,7 @@ public class WarplyManager { ...@@ -1910,6 +1910,7 @@ public class WarplyManager {
1910 } 1910 }
1911 if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) { 1911 if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) {
1912 ArrayList<UnifiedCoupon> couponList = new ArrayList<UnifiedCoupon>(); 1912 ArrayList<UnifiedCoupon> couponList = new ArrayList<UnifiedCoupon>();
1913 + ArrayList<UnifiedCoupon> allCouponList = new ArrayList<UnifiedCoupon>();
1913 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel(); 1914 LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
1914 dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty"); 1915 dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty");
1915 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent)); 1916 EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
...@@ -1924,8 +1925,13 @@ public class WarplyManager { ...@@ -1924,8 +1925,13 @@ public class WarplyManager {
1924 jCouponsInnerBody = jCouponsBody.optJSONArray("coupons"); 1925 jCouponsInnerBody = jCouponsBody.optJSONArray("coupons");
1925 if (jCouponsInnerBody != null && jCouponsInnerBody.length() > 0) { 1926 if (jCouponsInnerBody != null && jCouponsInnerBody.length() > 0) {
1926 for (int i = 0; i < jCouponsInnerBody.length(); i++) { 1927 for (int i = 0; i < jCouponsInnerBody.length(); i++) {
1927 - couponList.add(new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i))); 1928 + UnifiedCoupon tempUni = new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i));
1929 + allCouponList.add(tempUni);
1930 + if (tempUni.getStatus().trim().equals("active"))
1931 + couponList.add(tempUni);
1928 } 1932 }
1933 +
1934 + WarplyManagerHelper.setMarketCoupons(allCouponList);
1929 } 1935 }
1930 } 1936 }
1931 } catch (Exception e) { 1937 } catch (Exception e) {
...@@ -2187,7 +2193,8 @@ public class WarplyManager { ...@@ -2187,7 +2193,8 @@ public class WarplyManager {
2187 Date newDate = new Date(); 2193 Date newDate = new Date();
2188 try { 2194 try {
2189 newDate = simpleDateFormat.parse(coupon.getExpiration()); 2195 newDate = simpleDateFormat.parse(coupon.getExpiration());
2190 - } catch (ParseException e) { 2196 + } catch (
2197 + ParseException e) {
2191 e.printStackTrace(); 2198 e.printStackTrace();
2192 } 2199 }
2193 coupon.setExpirationDate(newDate); 2200 coupon.setExpirationDate(newDate);
......
...@@ -90,6 +90,7 @@ import ly.warp.sdk.io.models.QuestionnaireEventModel; ...@@ -90,6 +90,7 @@ import ly.warp.sdk.io.models.QuestionnaireEventModel;
90 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; 90 import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
91 import ly.warp.sdk.io.models.WarplyPacingCardEventModel; 91 import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
92 import ly.warp.sdk.io.models.WarplyPacingEventModel; 92 import ly.warp.sdk.io.models.WarplyPacingEventModel;
93 +import ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel;
93 import ly.warp.sdk.services.WarplyHealthService; 94 import ly.warp.sdk.services.WarplyHealthService;
94 import ly.warp.sdk.utils.WarpUtils; 95 import ly.warp.sdk.utils.WarpUtils;
95 import ly.warp.sdk.utils.WarplyManagerHelper; 96 import ly.warp.sdk.utils.WarplyManagerHelper;
...@@ -552,6 +553,21 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -552,6 +553,21 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
552 } catch (Exception e) { 553 } catch (Exception e) {
553 e.printStackTrace(); 554 e.printStackTrace();
554 } 555 }
556 + } else if (parts[1].equals("unified_coupon_activated")) {
557 + WarplyUnifiedActivatedEventModel unifiedActivated = new WarplyUnifiedActivatedEventModel();
558 + unifiedActivated.setActivated(true);
559 + EventBus.getDefault().post(new WarplyEventBusManager(unifiedActivated));
560 +
561 + try {
562 + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
563 + analyticsEvent.setEventName("loyalty_sdk_unified_activated");
564 + analyticsEvent.setParameter("name", parts[2]);
565 + analyticsEvent.setParameter("type", parts[3]);
566 + analyticsEvent.setParameter("successful", parts[4]);
567 + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
568 + } catch (Exception e) {
569 + e.printStackTrace();
570 + }
555 } else if (parts[1].equals("time_spent_on_loyalty_sdk")) { 571 } else if (parts[1].equals("time_spent_on_loyalty_sdk")) {
556 try { 572 try {
557 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); 573 LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
88 <string name="cos_dlg_negative_button">Απόρριψη</string> 88 <string name="cos_dlg_negative_button">Απόρριψη</string>
89 <string name="cos_dlg_positive_button2">ΟΚ</string> 89 <string name="cos_dlg_positive_button2">ΟΚ</string>
90 <string name="cos_dlg_positive_button_text">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο My Rewards!</string> 90 <string name="cos_dlg_positive_button_text">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο My Rewards!</string>
91 + <string name="cos_dlg_positive_button_text2">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο καλάθι του SuperMarket Deals!</string>
91 <string name="cos_dlg_reject_text">Το δώρο θα επιστραφεί και δεν θα μπορεί να ενεργοποιηθεί ξανά.</string> 92 <string name="cos_dlg_reject_text">Το δώρο θα επιστραφεί και δεν θα μπορεί να ενεργοποιηθεί ξανά.</string>
92 <string name="cos_dlg_return_text">Έλαβες πίσω το δώρο σου, κουπόνι αξίας 100€ για τα Intersport</string> 93 <string name="cos_dlg_return_text">Έλαβες πίσω το δώρο σου, κουπόνι αξίας 100€ για τα Intersport</string>
93 <string name="cos_dlg_negative_button2">Άκυρο</string> 94 <string name="cos_dlg_negative_button2">Άκυρο</string>
......