Showing
9 changed files
with
131 additions
and
43 deletions
| ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | 
| 36 | public void onWarplyReady() { | 36 | public void onWarplyReady() { | 
| 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 
| 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 
| 39 | - .setGuid("6012049322"), //6012049321, 6012049322, 6012049323 | 39 | + .setGuid("6012049321"), //6012049321, 6012049322, 6012049323 | 
| 40 | mLoginReceiver); | 40 | mLoginReceiver); | 
| 41 | } else { | 41 | } else { | 
| 42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... | 
| ... | @@ -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-cosbeta61' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta62' | 
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 
| 7 | } | 7 | } | 
| 8 | 8 | ... | ... | 
| ... | @@ -12,6 +12,11 @@ import androidx.recyclerview.widget.LinearLayoutManager; | ... | @@ -12,6 +12,11 @@ import androidx.recyclerview.widget.LinearLayoutManager; | 
| 12 | import androidx.recyclerview.widget.RecyclerView; | 12 | import androidx.recyclerview.widget.RecyclerView; | 
| 13 | 13 | ||
| 14 | import java.io.Serializable; | 14 | import java.io.Serializable; | 
| 15 | +import java.text.ParseException; | ||
| 16 | +import java.text.SimpleDateFormat; | ||
| 17 | +import java.util.Collections; | ||
| 18 | +import java.util.Comparator; | ||
| 19 | +import java.util.Date; | ||
| 15 | 20 | ||
| 16 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 21 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 
| 17 | import ly.warp.sdk.R; | 22 | import ly.warp.sdk.R; | 
| ... | @@ -49,9 +54,21 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe | ... | @@ -49,9 +54,21 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe | 
| 49 | mCouponList = new CouponList(getIntent().getSerializableExtra("couponlist").toString(), true); | 54 | mCouponList = new CouponList(getIntent().getSerializableExtra("couponlist").toString(), true); | 
| 50 | CouponList cpnlist = new CouponList(); | 55 | CouponList cpnlist = new CouponList(); | 
| 51 | for (Coupon cpn : mCouponList) { | 56 | for (Coupon cpn : mCouponList) { | 
| 52 | - if (cpn.getStatus() == 1) | 57 | + if (cpn.getStatus() == 1) { | 
| 58 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
| 59 | + Date newDate = new Date(); | ||
| 60 | + try { | ||
| 61 | + newDate = simpleDateFormat.parse(cpn.getExpiration()); | ||
| 62 | + } catch (ParseException e) { | ||
| 63 | + e.printStackTrace(); | ||
| 64 | + } | ||
| 65 | + cpn.setExpirationDate(newDate); | ||
| 53 | cpnlist.add(cpn); | 66 | cpnlist.add(cpn); | 
| 67 | + } | ||
| 54 | } | 68 | } | 
| 69 | + | ||
| 70 | + Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); | ||
| 71 | + | ||
| 55 | mCouponList.clear(); | 72 | mCouponList.clear(); | 
| 56 | mCouponList.addAll(cpnlist); | 73 | mCouponList.addAll(cpnlist); | 
| 57 | } | 74 | } | ... | ... | 
| ... | @@ -37,6 +37,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; | ... | @@ -37,6 +37,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 
| 37 | import ly.warp.sdk.R; | 37 | import ly.warp.sdk.R; | 
| 38 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; | 38 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; | 
| 39 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; | 39 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; | 
| 40 | +import ly.warp.sdk.io.models.Coupon; | ||
| 40 | import ly.warp.sdk.io.models.CouponList; | 41 | import ly.warp.sdk.io.models.CouponList; | 
| 41 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 42 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 
| 42 | import ly.warp.sdk.utils.WarpUtils; | 43 | import ly.warp.sdk.utils.WarpUtils; | 
| ... | @@ -185,11 +186,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -185,11 +186,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | 
| 185 | public void onMessageEvent(WarplyEventBusManager event) { | 186 | public void onMessageEvent(WarplyEventBusManager event) { | 
| 186 | if (event.getCouponsAdded() != null) { | 187 | if (event.getCouponsAdded() != null) { | 
| 187 | CouponList tempCouponList = new CouponList(); | 188 | CouponList tempCouponList = new CouponList(); | 
| 189 | + CouponList cpnlist = new CouponList(); | ||
| 188 | tempCouponList.clear(); | 190 | tempCouponList.clear(); | 
| 189 | tempCouponList.addAll(WarplyManagerHelper.getCouponList()); | 191 | tempCouponList.addAll(WarplyManagerHelper.getCouponList()); | 
| 192 | + | ||
| 193 | + for (Coupon cpn : tempCouponList) { | ||
| 194 | + if (cpn.getStatus() == 1) { | ||
| 195 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
| 196 | + Date newDate = new Date(); | ||
| 197 | + try { | ||
| 198 | + newDate = simpleDateFormat.parse(cpn.getExpiration()); | ||
| 199 | + } catch (ParseException e) { | ||
| 200 | + e.printStackTrace(); | ||
| 201 | + } | ||
| 202 | + cpn.setExpirationDate(newDate); | ||
| 203 | + cpnlist.add(cpn); | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); | ||
| 208 | + | ||
| 190 | runOnUiThread(() -> { | 209 | runOnUiThread(() -> { | 
| 191 | - if (tempCouponList != null && tempCouponList.size() > 0) { | 210 | + if (cpnlist != null && cpnlist.size() > 0) { | 
| 192 | - mAdapterCoupons = new ActiveCouponAdapter(this, tempCouponList); | 211 | + mAdapterCoupons = new ActiveCouponAdapter(this, cpnlist); | 
| 193 | mRecyclerCoupons.setAdapter(mAdapterCoupons); | 212 | mRecyclerCoupons.setAdapter(mAdapterCoupons); | 
| 194 | mAdapterCoupons.getPositionClicks() | 213 | mAdapterCoupons.getPositionClicks() | 
| 195 | .doOnNext(coupon -> { | 214 | .doOnNext(coupon -> { | 
| ... | @@ -225,7 +244,24 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -225,7 +244,24 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | 
| 225 | } | 244 | } | 
| 226 | 245 | ||
| 227 | if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) { | 246 | if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) { | 
| 228 | - mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList()); | 247 | + CouponList cpnlist = new CouponList(); | 
| 248 | + for (Coupon cpn : WarplyManagerHelper.getCouponList()) { | ||
| 249 | + if (cpn.getStatus() == 1) { | ||
| 250 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
| 251 | + Date newDate = new Date(); | ||
| 252 | + try { | ||
| 253 | + newDate = simpleDateFormat.parse(cpn.getExpiration()); | ||
| 254 | + } catch (ParseException e) { | ||
| 255 | + e.printStackTrace(); | ||
| 256 | + } | ||
| 257 | + cpn.setExpirationDate(newDate); | ||
| 258 | + cpnlist.add(cpn); | ||
| 259 | + } | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); | ||
| 263 | + | ||
| 264 | + mAdapterCoupons = new ActiveCouponAdapter(this, cpnlist); | ||
| 229 | mRecyclerCoupons.setAdapter(mAdapterCoupons); | 265 | mRecyclerCoupons.setAdapter(mAdapterCoupons); | 
| 230 | mAdapterCoupons.getPositionClicks() | 266 | mAdapterCoupons.getPositionClicks() | 
| 231 | .doOnNext(coupon -> { | 267 | .doOnNext(coupon -> { | 
| ... | @@ -305,7 +341,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -305,7 +341,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | 
| 305 | try { | 341 | try { | 
| 306 | Date toDate = dateFormat.parse(date2); | 342 | Date toDate = dateFormat.parse(date2); | 
| 307 | Date fromDate = dateFormat.parse(date1); | 343 | Date fromDate = dateFormat.parse(date1); | 
| 308 | - long diff = TimeUnit.MILLISECONDS.toDays(fromDate.getTime() - toDate.getTime()); | 344 | + long diff = TimeUnit.MILLISECONDS.toDays(fromDate.getTime() - toDate.getTime()) + 1; | 
| 309 | mTvActiveDate.setText(String.format(getString(R.string.cos_active_coupon_date), String.valueOf(diff))); | 345 | mTvActiveDate.setText(String.format(getString(R.string.cos_active_coupon_date), String.valueOf(diff))); | 
| 310 | mTvActiveDate.setVisibility(View.VISIBLE); | 346 | mTvActiveDate.setVisibility(View.VISIBLE); | 
| 311 | } catch (ParseException e) { | 347 | } catch (ParseException e) { | ... | ... | 
| ... | @@ -168,32 +168,50 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -168,32 +168,50 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | 
| 168 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); | 168 | ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); | 
| 169 | dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); | 169 | dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); | 
| 170 | 170 | ||
| 171 | - if (mConsumer != null) { | 171 | +// if (mConsumer != null) { | 
| 172 | - try { | 172 | +// try { | 
| 173 | - JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata()); | 173 | +// JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata()); | 
| 174 | - if (profMeta != null) { | 174 | +// if (profMeta != null) { | 
| 175 | - JSONArray msisdnList = new JSONArray(); | 175 | +// JSONArray msisdnList = new JSONArray(); | 
| 176 | - msisdnList = profMeta.optJSONArray(MSISDN_LIST); | 176 | +// msisdnList = profMeta.optJSONArray(MSISDN_LIST); | 
| 177 | - if (msisdnList != null && msisdnList.length() > 0) { | 177 | +// if (msisdnList != null && msisdnList.length() > 0) { | 
| 178 | - for (int i = 0; i < msisdnList.length(); i++) { | 178 | +// for (int i = 0; i < msisdnList.length(); i++) { | 
| 179 | - LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | 179 | +// LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | 
| 180 | - LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null); | 180 | +// LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null); | 
| 181 | - TextView textView = (TextView) v.findViewById(R.id.tv_phone_share); | 181 | +// TextView textView = (TextView) v.findViewById(R.id.tv_phone_share); | 
| 182 | - textView.setText(msisdnList.optString(i)); | 182 | +// textView.setText(msisdnList.optString(i)); | 
| 183 | - textView.setOnClickListener(view -> { | 183 | +// textView.setOnClickListener(view -> { | 
| 184 | - TextView tv = (TextView) view; | 184 | +// TextView tv = (TextView) view; | 
| 185 | - mSender = tv.getText().toString(); | 185 | +// mSender = tv.getText().toString(); | 
| 186 | - bottomSheetDialog.dismiss(); | 186 | +// bottomSheetDialog.dismiss(); | 
| 187 | - askActivateDialog(); | 187 | +// askActivateDialog(); | 
| 188 | - }); | 188 | +// }); | 
| 189 | - parent.addView(v, 0, new ViewGroup.LayoutParams( | 189 | +// parent.addView(v, 0, new ViewGroup.LayoutParams( | 
| 190 | - ViewGroup.LayoutParams.MATCH_PARENT, | 190 | +// ViewGroup.LayoutParams.MATCH_PARENT, | 
| 191 | - ViewGroup.LayoutParams.WRAP_CONTENT)); | 191 | +// ViewGroup.LayoutParams.WRAP_CONTENT)); | 
| 192 | - } | 192 | +// } | 
| 193 | - } | 193 | +// } | 
| 194 | - } | 194 | +// } | 
| 195 | - } catch (JSONException e) { | 195 | +// } catch (JSONException e) { | 
| 196 | - e.printStackTrace(); | 196 | +// e.printStackTrace(); | 
| 197 | +// } | ||
| 198 | +// } | ||
| 199 | + | ||
| 200 | + if (mCCMS.getEligibleAssets() != null && mCCMS.getEligibleAssets().size() > 0) { | ||
| 201 | + for (int i = 0; i < mCCMS.getEligibleAssets().size(); i++) { | ||
| 202 | + LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||
| 203 | + LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null); | ||
| 204 | + TextView textView = (TextView) v.findViewById(R.id.tv_phone_share); | ||
| 205 | + textView.setText(mCCMS.getEligibleAssets().get(i)); | ||
| 206 | + textView.setOnClickListener(view -> { | ||
| 207 | + TextView tv = (TextView) view; | ||
| 208 | + mSender = tv.getText().toString(); | ||
| 209 | + bottomSheetDialog.dismiss(); | ||
| 210 | + askActivateDialog(); | ||
| 211 | + }); | ||
| 212 | + parent.addView(v, 0, new ViewGroup.LayoutParams( | ||
| 213 | + ViewGroup.LayoutParams.MATCH_PARENT, | ||
| 214 | + ViewGroup.LayoutParams.WRAP_CONTENT)); | ||
| 197 | } | 215 | } | 
| 198 | } | 216 | } | 
| 199 | 217 | ... | ... | 
| ... | @@ -32,6 +32,7 @@ import org.json.JSONException; | ... | @@ -32,6 +32,7 @@ import org.json.JSONException; | 
| 32 | import org.json.JSONObject; | 32 | import org.json.JSONObject; | 
| 33 | 33 | ||
| 34 | import java.io.Serializable; | 34 | import java.io.Serializable; | 
| 35 | +import java.util.Date; | ||
| 35 | 36 | ||
| 36 | import ly.warp.sdk.utils.WarpUtils; | 37 | import ly.warp.sdk.utils.WarpUtils; | 
| 37 | import ly.warp.sdk.utils.constants.WarpConstants; | 38 | import ly.warp.sdk.utils.constants.WarpConstants; | 
| ... | @@ -81,6 +82,7 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -81,6 +82,7 @@ public class Coupon implements Parcelable, Serializable { | 
| 81 | private String couponsetUuid = ""; | 82 | private String couponsetUuid = ""; | 
| 82 | private String merchantUuid = ""; | 83 | private String merchantUuid = ""; | 
| 83 | private String innerText = ""; | 84 | private String innerText = ""; | 
| 85 | + private Date expirationDate = new Date(); | ||
| 84 | 86 | ||
| 85 | /** | 87 | /** | 
| 86 | * Basic constructor used to create an object from a String, representing a | 88 | * Basic constructor used to create an object from a String, representing a | 
| ... | @@ -347,6 +349,14 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -347,6 +349,14 @@ public class Coupon implements Parcelable, Serializable { | 
| 347 | this.innerText = innerText; | 349 | this.innerText = innerText; | 
| 348 | } | 350 | } | 
| 349 | 351 | ||
| 352 | + public Date getExpirationDate() { | ||
| 353 | + return expirationDate; | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + public void setExpirationDate(Date expirationDate) { | ||
| 357 | + this.expirationDate = expirationDate; | ||
| 358 | + } | ||
| 359 | + | ||
| 350 | @Override | 360 | @Override | 
| 351 | public int describeContents() { | 361 | public int describeContents() { | 
| 352 | return 0; | 362 | return 0; | ... | ... | 
| ... | @@ -879,6 +879,7 @@ public class WarplyManagerHelper { | ... | @@ -879,6 +879,7 @@ public class WarplyManagerHelper { | 
| 879 | * Set the List with active D4Y coupons | 879 | * Set the List with active D4Y coupons | 
| 880 | */ | 880 | */ | 
| 881 | public static void setActiveDFYCoupons(ArrayList<ActiveDFYCouponModel> dfyCoupons) { | 881 | public static void setActiveDFYCoupons(ArrayList<ActiveDFYCouponModel> dfyCoupons) { | 
| 882 | + mDfyCoupons.clear(); | ||
| 882 | mDfyCoupons = dfyCoupons; | 883 | mDfyCoupons = dfyCoupons; | 
| 883 | } | 884 | } | 
| 884 | 885 | ... | ... | 
| ... | @@ -28,7 +28,6 @@ public class WarplyEventBusManager { | ... | @@ -28,7 +28,6 @@ public class WarplyEventBusManager { | 
| 28 | private LoyaltyContextualOfferModel ccms; | 28 | private LoyaltyContextualOfferModel ccms; | 
| 29 | protected HashMap<String, Object> mWarplyEventBusManager = new HashMap(); | 29 | protected HashMap<String, Object> mWarplyEventBusManager = new HashMap(); | 
| 30 | private WarplyPacingEventModel pacing; | 30 | private WarplyPacingEventModel pacing; | 
| 31 | - private WarplyPacingCardEventModel pacingCard; | ||
| 32 | private WarplyPacingCardServiceEnabledModel pacingService; | 31 | private WarplyPacingCardServiceEnabledModel pacingService; | 
| 33 | private WarplyDealsAnalysisEventModel dealsAnalysis; | 32 | private WarplyDealsAnalysisEventModel dealsAnalysis; | 
| 34 | private WarplyCCMSEnabledModel ccmsActivated; | 33 | private WarplyCCMSEnabledModel ccmsActivated; | 
| ... | @@ -94,10 +93,6 @@ public class WarplyEventBusManager { | ... | @@ -94,10 +93,6 @@ public class WarplyEventBusManager { | 
| 94 | public WarplyEventBusManager(WarplyPacingEventModel pacing) { | 93 | public WarplyEventBusManager(WarplyPacingEventModel pacing) { | 
| 95 | this.pacing = pacing; | 94 | this.pacing = pacing; | 
| 96 | } | 95 | } | 
| 97 | - | ||
| 98 | -// public WarplyEventBusManager(WarplyPacingCardEventModel pacingCard) { | ||
| 99 | -// this.pacingCard = pacingCard; | ||
| 100 | -// } | ||
| 101 | // | 96 | // | 
| 102 | // public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) { | 97 | // public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) { | 
| 103 | // this.pacingService = pacingService; | 98 | // this.pacingService = pacingService; | 
| ... | @@ -157,10 +152,6 @@ public class WarplyEventBusManager { | ... | @@ -157,10 +152,6 @@ public class WarplyEventBusManager { | 
| 157 | return mWarplyEventBusManager; | 152 | return mWarplyEventBusManager; | 
| 158 | } | 153 | } | 
| 159 | 154 | ||
| 160 | - public WarplyPacingCardEventModel getPacingCard() { | ||
| 161 | - return pacingCard; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | public WarplyPacingCardServiceEnabledModel getPacingService() { | 155 | public WarplyPacingCardServiceEnabledModel getPacingService() { | 
| 165 | return pacingService; | 156 | return pacingService; | 
| 166 | } | 157 | } | ... | ... | 
| ... | @@ -37,9 +37,12 @@ import org.json.JSONArray; | ... | @@ -37,9 +37,12 @@ import org.json.JSONArray; | 
| 37 | import org.json.JSONException; | 37 | import org.json.JSONException; | 
| 38 | import org.json.JSONObject; | 38 | import org.json.JSONObject; | 
| 39 | 39 | ||
| 40 | +import java.text.ParseException; | ||
| 41 | +import java.text.SimpleDateFormat; | ||
| 40 | import java.util.ArrayList; | 42 | import java.util.ArrayList; | 
| 41 | import java.util.Collections; | 43 | import java.util.Collections; | 
| 42 | import java.util.Comparator; | 44 | import java.util.Comparator; | 
| 45 | +import java.util.Date; | ||
| 43 | 46 | ||
| 44 | import ly.warp.sdk.R; | 47 | import ly.warp.sdk.R; | 
| 45 | import ly.warp.sdk.Warply; | 48 | import ly.warp.sdk.Warply; | 
| ... | @@ -780,6 +783,7 @@ public class WarplyManager { | ... | @@ -780,6 +783,7 @@ public class WarplyManager { | 
| 780 | WarpUtils.log("[WARP Trace] WARPLY Verify Ticket Request is active"); | 783 | WarpUtils.log("[WARP Trace] WARPLY Verify Ticket Request is active"); | 
| 781 | WarpUtils.log("**************************************************"); | 784 | WarpUtils.log("**************************************************"); | 
| 782 | 785 | ||
| 786 | + WarpUtils.setUserTag(Warply.getWarplyContext(), ""); | ||
| 783 | Warply.postReceiveMicroappData(false, "verify", request.toJson(), new CallbackReceiver<JSONObject>() { | 787 | Warply.postReceiveMicroappData(false, "verify", request.toJson(), new CallbackReceiver<JSONObject>() { | 
| 784 | @Override | 788 | @Override | 
| 785 | public void onSuccess(JSONObject result) { | 789 | public void onSuccess(JSONObject result) { | 
| ... | @@ -2282,10 +2286,21 @@ public class WarplyManager { | ... | @@ -2282,10 +2286,21 @@ public class WarplyManager { | 
| 2282 | 2286 | ||
| 2283 | CouponList mActiveCouponList = new CouponList(); | 2287 | CouponList mActiveCouponList = new CouponList(); | 
| 2284 | for (Coupon coupon : mCouponList) { | 2288 | for (Coupon coupon : mCouponList) { | 
| 2285 | - if (coupon.getStatus() == 1) | 2289 | + if (coupon.getStatus() == 1) { | 
| 2290 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); | ||
| 2291 | + Date newDate = new Date(); | ||
| 2292 | + try { | ||
| 2293 | + newDate = simpleDateFormat.parse(coupon.getExpiration()); | ||
| 2294 | + } catch (ParseException e) { | ||
| 2295 | + e.printStackTrace(); | ||
| 2296 | + } | ||
| 2297 | + coupon.setExpirationDate(newDate); | ||
| 2286 | mActiveCouponList.add(coupon); | 2298 | mActiveCouponList.add(coupon); | 
| 2299 | + } | ||
| 2287 | } | 2300 | } | 
| 2288 | 2301 | ||
| 2302 | + Collections.sort(mActiveCouponList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate())); | ||
| 2303 | + | ||
| 2289 | receiver.onSuccess(mActiveCouponList); | 2304 | receiver.onSuccess(mActiveCouponList); | 
| 2290 | } | 2305 | } | 
| 2291 | 2306 | ... | ... | 
- 
Please register or login to post a comment