Panagiotis Triantafyllou

feedback fixes

......@@ -66,11 +66,11 @@
android:theme="@style/SDKAppTheme" />
<!-- android:screenOrientation="portrait"-->
<activity
android:name="ly.warp.sdk.activities.TelematicsActivity"
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/SDKAppTheme" />
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name="ly.warp.sdk.activities.GiftsForYouActivity"
......
......@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.view.View;
......@@ -18,8 +19,12 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan;
import io.github.inflationx.calligraphy3.TypefaceUtils;
......@@ -83,18 +88,24 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
mLlShowMoreExpired = findViewById(R.id.ll_show_more_expired);
mLlShowMoreShared = findViewById(R.id.ll_show_more_shared);
if (WarplyManagerHelper.getMarketCoupons() != null && WarplyManagerHelper.getMarketCoupons().size() > 0) {
for (UnifiedCoupon unicoupon : WarplyManagerHelper.getMarketCoupons()) {
if (unicoupon.getCoupons() != null && unicoupon.getCoupons().size() > 0) {
for (Coupon inncoupon : unicoupon.getCoupons()) {
if (inncoupon.getStatus() == 0) {
countValue += Float.valueOf(inncoupon.getDiscount());
mExpiredMarketCoupons.add(inncoupon);
final ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(() -> {
for (UnifiedCoupon unicoupon : WarplyManagerHelper.getMarketCoupons()) {
if (unicoupon.getCoupons() != null && unicoupon.getCoupons().size() > 0) {
for (Coupon inncoupon : unicoupon.getCoupons()) {
if (inncoupon.getStatus() == 0) {
countValue += Float.valueOf(inncoupon.getDiscount());
mExpiredMarketCoupons.add(inncoupon);
}
}
}
}
}
new Handler(Looper.getMainLooper()).post(this::initViews);
executor.shutdownNow();
});
} else {
initViews();
}
initViews();
}
@Override
......
......@@ -100,7 +100,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private ExpandableLayout mElGifts;
private boolean mIsStayCollapsed = true;
private CardView mClExp;
private boolean mDfyPressed = false;
private boolean mDfyPressed = false, mDealsBannerPressed = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -205,6 +205,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
});
mDfyPressed = false;
mDealsBannerPressed = false;
}
@Override
......@@ -236,19 +237,22 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
return;
}
if (view.getId() == R.id.cl_deals_win_inner_cos) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("DealsBanner"));
if(!mDealsBannerPressed) {
mDealsBannerPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("DealsBanner"));
WarpUtils.log("DFY coupon banner pressed!");
WarplyDealsAnalysisEventModel warplyDealsAnalysisEventModel = new WarplyDealsAnalysisEventModel();
warplyDealsAnalysisEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(warplyDealsAnalysisEventModel));
WarpUtils.log("DFY coupon banner pressed!");
WarplyDealsAnalysisEventModel warplyDealsAnalysisEventModel = new WarplyDealsAnalysisEventModel();
warplyDealsAnalysisEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(warplyDealsAnalysisEventModel));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_deals_for_you_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_deals_for_you_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
}
return;
}
if (view.getId() == R.id.cl_deals_win_inner) {
......@@ -292,6 +296,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
if (view.getId() == R.id.cl_mygifts) {
if (!mDfyPressed) {
mDfyPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen")
.concat(":")
.concat("ActiveDealsBanner"));
......@@ -299,7 +304,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
ActiveDFYCouponEventModel activeCouponEventModel = new ActiveDFYCouponEventModel();
activeCouponEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(activeCouponEventModel));
mDfyPressed = true;
}
}
}
......
......@@ -27,11 +27,14 @@ package ly.warp.sdk.io.models;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import ly.warp.sdk.utils.WarpUtils;
......@@ -87,6 +90,7 @@ public class Coupon implements Parcelable, Serializable {
private String merchantUuid = "";
private String innerText = "";
private Date expirationDate = new Date();
private Date redeemDate = new Date();
private String discount_type = "";
private double final_price = 0.0d;
private String short_description = "";
......@@ -110,6 +114,7 @@ public class Coupon implements Parcelable, Serializable {
this.merchantUuid = "";
this.innerText = "";
this.expirationDate = new Date();
this.redeemDate = new Date();
this.discount_type = "";
this.final_price = 0.0d;
this.short_description = "";
......@@ -147,6 +152,17 @@ public class Coupon implements Parcelable, Serializable {
this.transactionDate = json.optString(TRANSACTION_DATE);
this.transactionUuid = json.optString(TRANSACTION_UUID);
this.changesDates = json.optJSONObject(CHANGES_DATES);
if (this.changesDates != null) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
String tempRedeemDate = this.changesDates.optString("redeemed");
try {
newDate = simpleDateFormat.parse(tempRedeemDate);
this.redeemDate = newDate;
} catch (ParseException e) {
e.printStackTrace();
}
}
this.couponsetUuid = json.optString(COUPONSET_UUID);
this.merchantUuid = json.optString(MERCHANT_UUID);
this.innerText = json.optString(INNER_TEXT);
......@@ -405,6 +421,14 @@ public class Coupon implements Parcelable, Serializable {
this.expirationDate = expirationDate;
}
public Date getRedeemDate() {
return redeemDate;
}
public void setRedeemDate(Date redeemDate) {
this.redeemDate = redeemDate;
}
public String getDiscount_type() {
return discount_type;
}
......
......@@ -44,11 +44,14 @@ import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
......@@ -72,6 +75,7 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.models.PushCampaign;
import ly.warp.sdk.io.models.UnifiedCoupon;
......@@ -1217,8 +1221,14 @@ public class WarplyManagerHelper {
mLoyaltyBadge = badge;
mCouponList.clear();
mCouponList.addAll(cpnlist);
mCouponListExpired.clear();
mCouponListExpired.addAll(cpnlistExpired);
final ExecutorService executorShops = Executors.newFixedThreadPool(1);
executorShops.submit(() -> {
mCouponListExpired.clear();
Collections.sort(cpnlistExpired, (coupon1, coupon2) -> coupon2.getRedeemDate().compareTo(coupon1.getRedeemDate()));
mCouponListExpired.addAll(cpnlistExpired);
executorShops.shutdownNow();
});
}
public static LoyaltyBadgeModel getLoyaltyBadge() {
......