Panagiotis Triantafyllou

new inbox

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta36'
PUBLISH_VERSION = '4.5.4-cosbeta37i'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -70,8 +70,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
// WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver);
Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
// WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
// Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
}
}).start();
}
......@@ -207,9 +207,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
};
private CallbackReceiver<NewCampaignList> mCampaignsCallback = new CallbackReceiver<NewCampaignList>() {
private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() {
@Override
public void onSuccess(NewCampaignList result) {
public void onSuccess(CampaignList result) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
}
......
......@@ -27,6 +27,9 @@ package ly.warp.sdk.io.callbacks;
import org.json.JSONObject;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.NewCampaign;
import ly.warp.sdk.io.models.NewCampaignList;
/**
......@@ -35,10 +38,10 @@ import ly.warp.sdk.io.models.NewCampaignList;
public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
private final CallbackReceiver<NewCampaignList> mListener;
private final CallbackReceiver<CampaignList> mListener;
private final String mRequestSignature;
public NewCampaignsHook(CallbackReceiver<NewCampaignList> listener, String requestSignature) {
public NewCampaignsHook(CallbackReceiver<CampaignList> listener, String requestSignature) {
this.mListener = listener;
this.mRequestSignature = requestSignature;
}
......@@ -48,7 +51,36 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
if (mListener != null) {
int status = result.optInt("status", 2);
if (status == 1) {
mListener.onSuccess(new NewCampaignList(result, mRequestSignature));
NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature);
CampaignList tempCampaigns = new CampaignList();
for (NewCampaign newCamp : cmpList) {
Campaign camp = new Campaign();
camp.setIndexUrl(newCamp.getIndexUrl());
camp.setLogoUrl(newCamp.getLogoUrl());
camp.setMessage(newCamp.getMessage());
camp.setOfferCategory(newCamp.getCommunicationCategory());
camp.setSessionUUID(newCamp.getCommunicationUUID());
camp.setTitle(newCamp.getTitle());
camp.setSubtitle(newCamp.getSubtitle());
camp.setSorting(newCamp.getSorting());
camp.setNew(newCamp.getIsNew());
camp.setType(newCamp.getCampaignType());
try {
camp.setExtraFields(newCamp.getExtraFields().toString());
} catch (NullPointerException e) {
camp.setExtraFields("");
e.printStackTrace();
}
try {
camp.setCampaignTypeSettings(newCamp.getSettings().toString());
} catch (NullPointerException e) {
camp.setCampaignTypeSettings("");
e.printStackTrace();
}
tempCampaigns.add(camp);
}
mListener.onSuccess(tempCampaigns);
} else
mListener.onFailure(status);
}
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cl_bill_payment"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_bill_header"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@android:color/white"
app:layout_constraintTop_toTopOf="parent">
android:background="@android:color/white">
<ImageView
android:id="@+id/iv_coupons_close"
......@@ -38,23 +39,21 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/cl_bill_header"
android:layout_marginTop="1dp"
android:background="@drawable/shape_cos_loyalty">
android:background="@drawable/shape_cos_loyalty"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_active_coupons"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingTop="44dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingTop="44dp" />
</RelativeLayout>
<TextView
android:id="@+id/tv_no_coupons"
......@@ -66,4 +65,4 @@
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone" />
</RelativeLayout>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
......