Showing
5 changed files
with
57 additions
and
8 deletions
... | @@ -66,11 +66,11 @@ | ... | @@ -66,11 +66,11 @@ |
66 | android:theme="@style/SDKAppTheme" /> | 66 | android:theme="@style/SDKAppTheme" /> |
67 | 67 | ||
68 | <!-- android:screenOrientation="portrait"--> | 68 | <!-- android:screenOrientation="portrait"--> |
69 | - <activity | 69 | +<!-- <activity--> |
70 | - android:name="ly.warp.sdk.activities.TelematicsActivity" | 70 | +<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"--> |
71 | - android:exported="false" | 71 | +<!-- android:exported="false"--> |
72 | - android:configChanges="orientation|screenSize" | 72 | +<!-- android:configChanges="orientation|screenSize"--> |
73 | - android:theme="@style/SDKAppTheme" /> | 73 | +<!-- android:theme="@style/SDKAppTheme" />--> |
74 | 74 | ||
75 | <activity | 75 | <activity |
76 | android:name="ly.warp.sdk.activities.GiftsForYouActivity" | 76 | android:name="ly.warp.sdk.activities.GiftsForYouActivity" | ... | ... |
... | @@ -4,6 +4,7 @@ import android.app.Activity; | ... | @@ -4,6 +4,7 @@ import android.app.Activity; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.os.Handler; | 6 | import android.os.Handler; |
7 | +import android.os.Looper; | ||
7 | import android.text.SpannableStringBuilder; | 8 | import android.text.SpannableStringBuilder; |
8 | import android.text.Spanned; | 9 | import android.text.Spanned; |
9 | import android.view.View; | 10 | import android.view.View; |
... | @@ -18,8 +19,12 @@ import androidx.recyclerview.widget.LinearLayoutManager; | ... | @@ -18,8 +19,12 @@ import androidx.recyclerview.widget.LinearLayoutManager; |
18 | import androidx.recyclerview.widget.RecyclerView; | 19 | import androidx.recyclerview.widget.RecyclerView; |
19 | 20 | ||
20 | import org.greenrobot.eventbus.EventBus; | 21 | import org.greenrobot.eventbus.EventBus; |
22 | +import org.json.JSONArray; | ||
23 | +import org.json.JSONObject; | ||
21 | 24 | ||
22 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
26 | +import java.util.concurrent.ExecutorService; | ||
27 | +import java.util.concurrent.Executors; | ||
23 | 28 | ||
24 | import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan; | 29 | import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan; |
25 | import io.github.inflationx.calligraphy3.TypefaceUtils; | 30 | import io.github.inflationx.calligraphy3.TypefaceUtils; |
... | @@ -83,6 +88,8 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl | ... | @@ -83,6 +88,8 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl |
83 | mLlShowMoreExpired = findViewById(R.id.ll_show_more_expired); | 88 | mLlShowMoreExpired = findViewById(R.id.ll_show_more_expired); |
84 | mLlShowMoreShared = findViewById(R.id.ll_show_more_shared); | 89 | mLlShowMoreShared = findViewById(R.id.ll_show_more_shared); |
85 | if (WarplyManagerHelper.getMarketCoupons() != null && WarplyManagerHelper.getMarketCoupons().size() > 0) { | 90 | if (WarplyManagerHelper.getMarketCoupons() != null && WarplyManagerHelper.getMarketCoupons().size() > 0) { |
91 | + final ExecutorService executor = Executors.newFixedThreadPool(1); | ||
92 | + executor.submit(() -> { | ||
86 | for (UnifiedCoupon unicoupon : WarplyManagerHelper.getMarketCoupons()) { | 93 | for (UnifiedCoupon unicoupon : WarplyManagerHelper.getMarketCoupons()) { |
87 | if (unicoupon.getCoupons() != null && unicoupon.getCoupons().size() > 0) { | 94 | if (unicoupon.getCoupons() != null && unicoupon.getCoupons().size() > 0) { |
88 | for (Coupon inncoupon : unicoupon.getCoupons()) { | 95 | for (Coupon inncoupon : unicoupon.getCoupons()) { |
... | @@ -93,9 +100,13 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl | ... | @@ -93,9 +100,13 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl |
93 | } | 100 | } |
94 | } | 101 | } |
95 | } | 102 | } |
96 | - } | 103 | + new Handler(Looper.getMainLooper()).post(this::initViews); |
104 | + executor.shutdownNow(); | ||
105 | + }); | ||
106 | + } else { | ||
97 | initViews(); | 107 | initViews(); |
98 | } | 108 | } |
109 | + } | ||
99 | 110 | ||
100 | @Override | 111 | @Override |
101 | public void onResume() { | 112 | public void onResume() { | ... | ... |
... | @@ -100,7 +100,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -100,7 +100,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
100 | private ExpandableLayout mElGifts; | 100 | private ExpandableLayout mElGifts; |
101 | private boolean mIsStayCollapsed = true; | 101 | private boolean mIsStayCollapsed = true; |
102 | private CardView mClExp; | 102 | private CardView mClExp; |
103 | - private boolean mDfyPressed = false; | 103 | + private boolean mDfyPressed = false, mDealsBannerPressed = false; |
104 | 104 | ||
105 | // =========================================================== | 105 | // =========================================================== |
106 | // Methods for/from SuperClass/Interfaces | 106 | // Methods for/from SuperClass/Interfaces |
... | @@ -205,6 +205,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -205,6 +205,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
205 | } | 205 | } |
206 | }); | 206 | }); |
207 | mDfyPressed = false; | 207 | mDfyPressed = false; |
208 | + mDealsBannerPressed = false; | ||
208 | } | 209 | } |
209 | 210 | ||
210 | @Override | 211 | @Override |
... | @@ -236,6 +237,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -236,6 +237,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
236 | return; | 237 | return; |
237 | } | 238 | } |
238 | if (view.getId() == R.id.cl_deals_win_inner_cos) { | 239 | if (view.getId() == R.id.cl_deals_win_inner_cos) { |
240 | + if(!mDealsBannerPressed) { | ||
241 | + mDealsBannerPressed = true; | ||
239 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") | 242 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") |
240 | .concat(":") | 243 | .concat(":") |
241 | .concat("DealsBanner")); | 244 | .concat("DealsBanner")); |
... | @@ -249,6 +252,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -249,6 +252,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
249 | analyticsEvent.setEventName("did_tap_deals_for_you_badge"); | 252 | analyticsEvent.setEventName("did_tap_deals_for_you_badge"); |
250 | analyticsEvent.setParameter("screen", "Loyalty Wallet"); | 253 | analyticsEvent.setParameter("screen", "Loyalty Wallet"); |
251 | EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | 254 | EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); |
255 | + } | ||
252 | return; | 256 | return; |
253 | } | 257 | } |
254 | if (view.getId() == R.id.cl_deals_win_inner) { | 258 | if (view.getId() == R.id.cl_deals_win_inner) { |
... | @@ -292,6 +296,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -292,6 +296,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
292 | } | 296 | } |
293 | if (view.getId() == R.id.cl_mygifts) { | 297 | if (view.getId() == R.id.cl_mygifts) { |
294 | if (!mDfyPressed) { | 298 | if (!mDfyPressed) { |
299 | + mDfyPressed = true; | ||
295 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") | 300 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyWalletScreen") |
296 | .concat(":") | 301 | .concat(":") |
297 | .concat("ActiveDealsBanner")); | 302 | .concat("ActiveDealsBanner")); |
... | @@ -299,7 +304,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -299,7 +304,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
299 | ActiveDFYCouponEventModel activeCouponEventModel = new ActiveDFYCouponEventModel(); | 304 | ActiveDFYCouponEventModel activeCouponEventModel = new ActiveDFYCouponEventModel(); |
300 | activeCouponEventModel.setPressed(true); | 305 | activeCouponEventModel.setPressed(true); |
301 | EventBus.getDefault().post(new WarplyEventBusManager(activeCouponEventModel)); | 306 | EventBus.getDefault().post(new WarplyEventBusManager(activeCouponEventModel)); |
302 | - mDfyPressed = true; | ||
303 | } | 307 | } |
304 | } | 308 | } |
305 | } | 309 | } | ... | ... |
... | @@ -27,11 +27,14 @@ package ly.warp.sdk.io.models; | ... | @@ -27,11 +27,14 @@ package ly.warp.sdk.io.models; |
27 | 27 | ||
28 | import android.os.Parcel; | 28 | import android.os.Parcel; |
29 | import android.os.Parcelable; | 29 | import android.os.Parcelable; |
30 | +import android.view.View; | ||
30 | 31 | ||
31 | import org.json.JSONException; | 32 | import org.json.JSONException; |
32 | import org.json.JSONObject; | 33 | import org.json.JSONObject; |
33 | 34 | ||
34 | import java.io.Serializable; | 35 | import java.io.Serializable; |
36 | +import java.text.ParseException; | ||
37 | +import java.text.SimpleDateFormat; | ||
35 | import java.util.Date; | 38 | import java.util.Date; |
36 | 39 | ||
37 | import ly.warp.sdk.utils.WarpUtils; | 40 | import ly.warp.sdk.utils.WarpUtils; |
... | @@ -87,6 +90,7 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -87,6 +90,7 @@ public class Coupon implements Parcelable, Serializable { |
87 | private String merchantUuid = ""; | 90 | private String merchantUuid = ""; |
88 | private String innerText = ""; | 91 | private String innerText = ""; |
89 | private Date expirationDate = new Date(); | 92 | private Date expirationDate = new Date(); |
93 | + private Date redeemDate = new Date(); | ||
90 | private String discount_type = ""; | 94 | private String discount_type = ""; |
91 | private double final_price = 0.0d; | 95 | private double final_price = 0.0d; |
92 | private String short_description = ""; | 96 | private String short_description = ""; |
... | @@ -110,6 +114,7 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -110,6 +114,7 @@ public class Coupon implements Parcelable, Serializable { |
110 | this.merchantUuid = ""; | 114 | this.merchantUuid = ""; |
111 | this.innerText = ""; | 115 | this.innerText = ""; |
112 | this.expirationDate = new Date(); | 116 | this.expirationDate = new Date(); |
117 | + this.redeemDate = new Date(); | ||
113 | this.discount_type = ""; | 118 | this.discount_type = ""; |
114 | this.final_price = 0.0d; | 119 | this.final_price = 0.0d; |
115 | this.short_description = ""; | 120 | this.short_description = ""; |
... | @@ -147,6 +152,17 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -147,6 +152,17 @@ public class Coupon implements Parcelable, Serializable { |
147 | this.transactionDate = json.optString(TRANSACTION_DATE); | 152 | this.transactionDate = json.optString(TRANSACTION_DATE); |
148 | this.transactionUuid = json.optString(TRANSACTION_UUID); | 153 | this.transactionUuid = json.optString(TRANSACTION_UUID); |
149 | this.changesDates = json.optJSONObject(CHANGES_DATES); | 154 | this.changesDates = json.optJSONObject(CHANGES_DATES); |
155 | + if (this.changesDates != null) { | ||
156 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
157 | + Date newDate = new Date(); | ||
158 | + String tempRedeemDate = this.changesDates.optString("redeemed"); | ||
159 | + try { | ||
160 | + newDate = simpleDateFormat.parse(tempRedeemDate); | ||
161 | + this.redeemDate = newDate; | ||
162 | + } catch (ParseException e) { | ||
163 | + e.printStackTrace(); | ||
164 | + } | ||
165 | + } | ||
150 | this.couponsetUuid = json.optString(COUPONSET_UUID); | 166 | this.couponsetUuid = json.optString(COUPONSET_UUID); |
151 | this.merchantUuid = json.optString(MERCHANT_UUID); | 167 | this.merchantUuid = json.optString(MERCHANT_UUID); |
152 | this.innerText = json.optString(INNER_TEXT); | 168 | this.innerText = json.optString(INNER_TEXT); |
... | @@ -405,6 +421,14 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -405,6 +421,14 @@ public class Coupon implements Parcelable, Serializable { |
405 | this.expirationDate = expirationDate; | 421 | this.expirationDate = expirationDate; |
406 | } | 422 | } |
407 | 423 | ||
424 | + public Date getRedeemDate() { | ||
425 | + return redeemDate; | ||
426 | + } | ||
427 | + | ||
428 | + public void setRedeemDate(Date redeemDate) { | ||
429 | + this.redeemDate = redeemDate; | ||
430 | + } | ||
431 | + | ||
408 | public String getDiscount_type() { | 432 | public String getDiscount_type() { |
409 | return discount_type; | 433 | return discount_type; |
410 | } | 434 | } | ... | ... |
... | @@ -44,11 +44,14 @@ import org.json.JSONObject; | ... | @@ -44,11 +44,14 @@ import org.json.JSONObject; |
44 | 44 | ||
45 | import java.io.Serializable; | 45 | import java.io.Serializable; |
46 | import java.util.ArrayList; | 46 | import java.util.ArrayList; |
47 | +import java.util.Collections; | ||
47 | import java.util.HashMap; | 48 | import java.util.HashMap; |
48 | import java.util.HashSet; | 49 | import java.util.HashSet; |
49 | import java.util.LinkedHashSet; | 50 | import java.util.LinkedHashSet; |
50 | import java.util.Map; | 51 | import java.util.Map; |
51 | import java.util.Set; | 52 | import java.util.Set; |
53 | +import java.util.concurrent.ExecutorService; | ||
54 | +import java.util.concurrent.Executors; | ||
52 | 55 | ||
53 | import ly.warp.sdk.R; | 56 | import ly.warp.sdk.R; |
54 | import ly.warp.sdk.Warply; | 57 | import ly.warp.sdk.Warply; |
... | @@ -72,6 +75,7 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel; | ... | @@ -72,6 +75,7 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel; |
72 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 75 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
73 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; | 76 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; |
74 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 77 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; |
78 | +import ly.warp.sdk.io.models.Merchant; | ||
75 | import ly.warp.sdk.io.models.MerchantList; | 79 | import ly.warp.sdk.io.models.MerchantList; |
76 | import ly.warp.sdk.io.models.PushCampaign; | 80 | import ly.warp.sdk.io.models.PushCampaign; |
77 | import ly.warp.sdk.io.models.UnifiedCoupon; | 81 | import ly.warp.sdk.io.models.UnifiedCoupon; |
... | @@ -1217,8 +1221,14 @@ public class WarplyManagerHelper { | ... | @@ -1217,8 +1221,14 @@ public class WarplyManagerHelper { |
1217 | mLoyaltyBadge = badge; | 1221 | mLoyaltyBadge = badge; |
1218 | mCouponList.clear(); | 1222 | mCouponList.clear(); |
1219 | mCouponList.addAll(cpnlist); | 1223 | mCouponList.addAll(cpnlist); |
1224 | + | ||
1225 | + final ExecutorService executorShops = Executors.newFixedThreadPool(1); | ||
1226 | + executorShops.submit(() -> { | ||
1220 | mCouponListExpired.clear(); | 1227 | mCouponListExpired.clear(); |
1228 | + Collections.sort(cpnlistExpired, (coupon1, coupon2) -> coupon2.getRedeemDate().compareTo(coupon1.getRedeemDate())); | ||
1221 | mCouponListExpired.addAll(cpnlistExpired); | 1229 | mCouponListExpired.addAll(cpnlistExpired); |
1230 | + executorShops.shutdownNow(); | ||
1231 | + }); | ||
1222 | } | 1232 | } |
1223 | 1233 | ||
1224 | public static LoyaltyBadgeModel getLoyaltyBadge() { | 1234 | public static LoyaltyBadgeModel getLoyaltyBadge() { | ... | ... |
-
Please register or login to post a comment