Panagiotis Triantafyllou

new keys

......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("6012049322"), //6012049321, 6012049322, 6012049323
.setGuid("6012049321"), //6012049321, 6012049322, 6012049323
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta61'
PUBLISH_VERSION = '4.5.4-cosbeta62'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -12,6 +12,11 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
......@@ -49,9 +54,21 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
mCouponList = new CouponList(getIntent().getSerializableExtra("couponlist").toString(), true);
CouponList cpnlist = new CouponList();
for (Coupon cpn : mCouponList) {
if (cpn.getStatus() == 1)
if (cpn.getStatus() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(cpn.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
cpn.setExpirationDate(newDate);
cpnlist.add(cpn);
}
}
Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
mCouponList.clear();
mCouponList.addAll(cpnlist);
}
......
......@@ -37,6 +37,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
import ly.warp.sdk.io.models.ActiveDFYCouponModel;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.utils.WarpUtils;
......@@ -185,11 +186,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getCouponsAdded() != null) {
CouponList tempCouponList = new CouponList();
CouponList cpnlist = new CouponList();
tempCouponList.clear();
tempCouponList.addAll(WarplyManagerHelper.getCouponList());
for (Coupon cpn : tempCouponList) {
if (cpn.getStatus() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(cpn.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
cpn.setExpirationDate(newDate);
cpnlist.add(cpn);
}
}
Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
runOnUiThread(() -> {
if (tempCouponList != null && tempCouponList.size() > 0) {
mAdapterCoupons = new ActiveCouponAdapter(this, tempCouponList);
if (cpnlist != null && cpnlist.size() > 0) {
mAdapterCoupons = new ActiveCouponAdapter(this, cpnlist);
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
......@@ -225,7 +244,24 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
}
if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) {
mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList());
CouponList cpnlist = new CouponList();
for (Coupon cpn : WarplyManagerHelper.getCouponList()) {
if (cpn.getStatus() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(cpn.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
cpn.setExpirationDate(newDate);
cpnlist.add(cpn);
}
}
Collections.sort(cpnlist, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
mAdapterCoupons = new ActiveCouponAdapter(this, cpnlist);
mRecyclerCoupons.setAdapter(mAdapterCoupons);
mAdapterCoupons.getPositionClicks()
.doOnNext(coupon -> {
......@@ -305,7 +341,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
try {
Date toDate = dateFormat.parse(date2);
Date fromDate = dateFormat.parse(date1);
long diff = TimeUnit.MILLISECONDS.toDays(fromDate.getTime() - toDate.getTime());
long diff = TimeUnit.MILLISECONDS.toDays(fromDate.getTime() - toDate.getTime()) + 1;
mTvActiveDate.setText(String.format(getString(R.string.cos_active_coupon_date), String.valueOf(diff)));
mTvActiveDate.setVisibility(View.VISIBLE);
} catch (ParseException e) {
......
......@@ -168,18 +168,41 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close);
dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
if (mConsumer != null) {
try {
JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata());
if (profMeta != null) {
JSONArray msisdnList = new JSONArray();
msisdnList = profMeta.optJSONArray(MSISDN_LIST);
if (msisdnList != null && msisdnList.length() > 0) {
for (int i = 0; i < msisdnList.length(); i++) {
// if (mConsumer != null) {
// try {
// JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata());
// if (profMeta != null) {
// JSONArray msisdnList = new JSONArray();
// msisdnList = profMeta.optJSONArray(MSISDN_LIST);
// if (msisdnList != null && msisdnList.length() > 0) {
// for (int i = 0; i < msisdnList.length(); i++) {
// LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null);
// TextView textView = (TextView) v.findViewById(R.id.tv_phone_share);
// textView.setText(msisdnList.optString(i));
// textView.setOnClickListener(view -> {
// TextView tv = (TextView) view;
// mSender = tv.getText().toString();
// bottomSheetDialog.dismiss();
// askActivateDialog();
// });
// parent.addView(v, 0, new ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.WRAP_CONTENT));
// }
// }
// }
// } catch (JSONException e) {
// e.printStackTrace();
// }
// }
if (mCCMS.getEligibleAssets() != null && mCCMS.getEligibleAssets().size() > 0) {
for (int i = 0; i < mCCMS.getEligibleAssets().size(); i++) {
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null);
TextView textView = (TextView) v.findViewById(R.id.tv_phone_share);
textView.setText(msisdnList.optString(i));
textView.setText(mCCMS.getEligibleAssets().get(i));
textView.setOnClickListener(view -> {
TextView tv = (TextView) view;
mSender = tv.getText().toString();
......@@ -191,11 +214,6 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
ViewGroup.LayoutParams.WRAP_CONTENT));
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
bottomSheetDialog.show();
}
......
......@@ -32,6 +32,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.Date;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.constants.WarpConstants;
......@@ -81,6 +82,7 @@ public class Coupon implements Parcelable, Serializable {
private String couponsetUuid = "";
private String merchantUuid = "";
private String innerText = "";
private Date expirationDate = new Date();
/**
* Basic constructor used to create an object from a String, representing a
......@@ -347,6 +349,14 @@ public class Coupon implements Parcelable, Serializable {
this.innerText = innerText;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
@Override
public int describeContents() {
return 0;
......
......@@ -879,6 +879,7 @@ public class WarplyManagerHelper {
* Set the List with active D4Y coupons
*/
public static void setActiveDFYCoupons(ArrayList<ActiveDFYCouponModel> dfyCoupons) {
mDfyCoupons.clear();
mDfyCoupons = dfyCoupons;
}
......
......@@ -28,7 +28,6 @@ public class WarplyEventBusManager {
private LoyaltyContextualOfferModel ccms;
protected HashMap<String, Object> mWarplyEventBusManager = new HashMap();
private WarplyPacingEventModel pacing;
private WarplyPacingCardEventModel pacingCard;
private WarplyPacingCardServiceEnabledModel pacingService;
private WarplyDealsAnalysisEventModel dealsAnalysis;
private WarplyCCMSEnabledModel ccmsActivated;
......@@ -94,10 +93,6 @@ public class WarplyEventBusManager {
public WarplyEventBusManager(WarplyPacingEventModel pacing) {
this.pacing = pacing;
}
// public WarplyEventBusManager(WarplyPacingCardEventModel pacingCard) {
// this.pacingCard = pacingCard;
// }
//
// public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) {
// this.pacingService = pacingService;
......@@ -157,10 +152,6 @@ public class WarplyEventBusManager {
return mWarplyEventBusManager;
}
public WarplyPacingCardEventModel getPacingCard() {
return pacingCard;
}
public WarplyPacingCardServiceEnabledModel getPacingService() {
return pacingService;
}
......
......@@ -37,9 +37,12 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
......@@ -780,6 +783,7 @@ public class WarplyManager {
WarpUtils.log("[WARP Trace] WARPLY Verify Ticket Request is active");
WarpUtils.log("**************************************************");
WarpUtils.setUserTag(Warply.getWarplyContext(), "");
Warply.postReceiveMicroappData(false, "verify", request.toJson(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
......@@ -2282,9 +2286,20 @@ public class WarplyManager {
CouponList mActiveCouponList = new CouponList();
for (Coupon coupon : mCouponList) {
if (coupon.getStatus() == 1)
if (coupon.getStatus() == 1) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(coupon.getExpiration());
} catch (ParseException e) {
e.printStackTrace();
}
coupon.setExpirationDate(newDate);
mActiveCouponList.add(coupon);
}
}
Collections.sort(mActiveCouponList, (coupon1, coupon2) -> coupon1.getExpirationDate().compareTo(coupon2.getExpirationDate()));
receiver.onSuccess(mActiveCouponList);
}
......