Panagiotis Triantafyllou

sm fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc59'
PUBLISH_VERSION = '4.5.4.6rc60'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -203,6 +203,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
if (mIsFromWallet) {
mTvCouponCodeTitle.setVisibility(View.GONE);
mTvCouponCode.setVisibility(View.GONE);
mLlGiftIt.setVisibility(View.GONE);
}
mLlBarcodeShown.setVisibility(View.GONE);
mLlBarcodeContainer.setVisibility(View.GONE);
......
......@@ -95,7 +95,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private int mTimer = 0;
private Handler mSecondsHandler;
private ArrayList<UnifiedCoupon> mUnifiedCoupons = new ArrayList<UnifiedCoupon>();
private ArrayList<UnifiedCoupon> mUnifiedCouponsAll = new ArrayList<UnifiedCoupon>();
private float countValue = 0.0f;
private MarketCouponAdapter mAdapterMarketCoupons;
private ExpandableLayout mElGifts;
......@@ -499,9 +498,9 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
// Third Expandable Banner
if (mUnifiedCouponsAll.size() > 0) {
if (WarplyManagerHelper.getMarketCoupons().size() > 0) {
countValue = 0.0f;
for (UnifiedCoupon unicou : mUnifiedCouponsAll) {
for (UnifiedCoupon unicou : WarplyManagerHelper.getMarketCoupons()) {
if (unicou.getCoupons() != null && unicou.getCoupons().size() > 0) {
for (Coupon inncou : unicou.getCoupons()) {
if (inncou.getStatus() == 0) {
......@@ -666,20 +665,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
final ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(() -> {
mUnifiedCouponsAll = result;
ArrayList<UnifiedCoupon> cpnlist = new ArrayList<UnifiedCoupon>();
for (UnifiedCoupon cpn : result) {
if (cpn.getStatus().trim().equals("active")) {
cpnlist.add(cpn);
}
}
mUnifiedCoupons = cpnlist;
WarplyManagerHelper.setMarketCoupons(result);
new Handler(Looper.getMainLooper()).post(() -> initViews());
executor.shutdownNow();
});
mUnifiedCoupons = result;
initViews();
}
@Override
......
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 21-June-23.
*/
public class WarplyUnifiedActivatedEventModel {
private boolean activated;
public WarplyUnifiedActivatedEventModel() {
this.activated = true;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
}
......@@ -215,9 +215,10 @@ public class WarplyManagerHelper {
if (innerResult != null) {
String modalText = innerResult.optString("modal_text", "");
String sharingStatus = innerResult.optString("status", "");
String couponsetType = innerResult.optString("couponset_type", "");
if (!TextUtils.isEmpty(sharingStatus) && sharingStatus.equals("pending")) {
initialSharingDialog(context, modalText, sharingId);
initialSharingDialog(context, modalText, sharingId, !TextUtils.isEmpty(couponsetType) && couponsetType.equals("supermarket"));
return;
}
if (!TextUtils.isEmpty(sharingStatus) && sharingStatus.equals("reject")) {
......@@ -247,7 +248,7 @@ public class WarplyManagerHelper {
/**
* First dialog when we handle the deeplink
*/
private static void initialSharingDialog(Context context, String alertTitle, String sharingId) {
private static void initialSharingDialog(Context context, String alertTitle, String sharingId, boolean isSupermarket) {
mAlertDialogSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_success_title)
.setMessage(alertTitle)
......@@ -276,7 +277,7 @@ public class WarplyManagerHelper {
}
});
acceptSharingDialog(context);
acceptSharingDialog(context, isSupermarket);
} else
errorSharingDialog(context);
}
......@@ -293,10 +294,10 @@ public class WarplyManagerHelper {
/**
* Dialog when we success get the sharing gift
*/
private static void acceptSharingDialog(Context context) {
private static void acceptSharingDialog(Context context, boolean isSupermarket) {
mAlertDialogAcceptSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_success_title)
.setMessage(R.string.cos_dlg_positive_button_text)
.setMessage(isSupermarket ? R.string.cos_dlg_positive_button_text2 : R.string.cos_dlg_positive_button_text)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
......@@ -1253,7 +1254,7 @@ public class WarplyManagerHelper {
return mMarketCoupons;
}
public static void setMarketCoupons( ArrayList<UnifiedCoupon> marketCoupons) {
public static void setMarketCoupons(ArrayList<UnifiedCoupon> marketCoupons) {
mMarketCoupons = marketCoupons;
}
......
......@@ -20,6 +20,7 @@ import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel;
import ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel;
import ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel;
......@@ -50,11 +51,16 @@ public class WarplyEventBusManager {
private WarplyWebviewCallbackEventModel webviewCallback;
private WarplyWebviewActivityCallbackEventModel webviewActivityCallback;
private WarplyUnifiedActivatedEventModel unifiedActivated;
public WarplyEventBusManager() {
}
public WarplyEventBusManager(WarplyUnifiedActivatedEventModel unifiedActivated) {
this.unifiedActivated = unifiedActivated;
}
public WarplyEventBusManager(String eventName) {
this.eventName = eventName;
}
......@@ -248,4 +254,8 @@ public class WarplyEventBusManager {
public WarplyWebviewActivityCallbackEventModel getWarplyWebviewActivityCallbackEventModel() {
return webviewActivityCallback;
}
public WarplyUnifiedActivatedEventModel getWarplyUnifiedActivatedEventModel() {
return unifiedActivated;
}
}
......
......@@ -1910,6 +1910,7 @@ public class WarplyManager {
}
if (jobjCouponsResponse != null && jobjCouponsResponse.has("status") && jobjCouponsResponse.optInt("status", 2) == 1) {
ArrayList<UnifiedCoupon> couponList = new ArrayList<UnifiedCoupon>();
ArrayList<UnifiedCoupon> allCouponList = new ArrayList<UnifiedCoupon>();
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_unified_coupons_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
......@@ -1924,8 +1925,13 @@ public class WarplyManager {
jCouponsInnerBody = jCouponsBody.optJSONArray("coupons");
if (jCouponsInnerBody != null && jCouponsInnerBody.length() > 0) {
for (int i = 0; i < jCouponsInnerBody.length(); i++) {
couponList.add(new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i)));
UnifiedCoupon tempUni = new UnifiedCoupon(jCouponsInnerBody.optJSONObject(i));
allCouponList.add(tempUni);
if (tempUni.getStatus().trim().equals("active"))
couponList.add(tempUni);
}
WarplyManagerHelper.setMarketCoupons(allCouponList);
}
}
} catch (Exception e) {
......@@ -2187,7 +2193,8 @@ public class WarplyManager {
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(coupon.getExpiration());
} catch (ParseException e) {
} catch (
ParseException e) {
e.printStackTrace();
}
coupon.setExpirationDate(newDate);
......
......@@ -90,6 +90,7 @@ import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel;
import ly.warp.sdk.services.WarplyHealthService;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
......@@ -552,6 +553,21 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
} catch (Exception e) {
e.printStackTrace();
}
} else if (parts[1].equals("unified_coupon_activated")) {
WarplyUnifiedActivatedEventModel unifiedActivated = new WarplyUnifiedActivatedEventModel();
unifiedActivated.setActivated(true);
EventBus.getDefault().post(new WarplyEventBusManager(unifiedActivated));
try {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_unified_activated");
analyticsEvent.setParameter("name", parts[2]);
analyticsEvent.setParameter("type", parts[3]);
analyticsEvent.setParameter("successful", parts[4]);
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
} catch (Exception e) {
e.printStackTrace();
}
} else if (parts[1].equals("time_spent_on_loyalty_sdk")) {
try {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
......
......@@ -88,6 +88,7 @@
<string name="cos_dlg_negative_button">Απόρριψη</string>
<string name="cos_dlg_positive_button2">ΟΚ</string>
<string name="cos_dlg_positive_button_text">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο My Rewards!</string>
<string name="cos_dlg_positive_button_text2">Το δώρο σου ενεργοποιήθηκε επιτυχώς στο καλάθι του SuperMarket Deals!</string>
<string name="cos_dlg_reject_text">Το δώρο θα επιστραφεί και δεν θα μπορεί να ενεργοποιηθεί ξανά.</string>
<string name="cos_dlg_return_text">Έλαβες πίσω το δώρο σου, κουπόνι αξίας 100€ για τα Intersport</string>
<string name="cos_dlg_negative_button2">Άκυρο</string>
......