Panagiotis Triantafyllou

new inbox

...@@ -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-cosbeta36' 5 + PUBLISH_VERSION = '4.5.4-cosbeta37i'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -70,8 +70,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -70,8 +70,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
70 new Thread(() -> { 70 new Thread(() -> {
71 if (!Thread.currentThread().isInterrupted()) { 71 if (!Thread.currentThread().isInterrupted()) {
72 // WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver); 72 // WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver);
73 - Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver); 73 +// Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
74 -// WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback); 74 + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
75 } 75 }
76 }).start(); 76 }).start();
77 } 77 }
...@@ -207,9 +207,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -207,9 +207,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
207 } 207 }
208 }; 208 };
209 209
210 - private CallbackReceiver<NewCampaignList> mCampaignsCallback = new CallbackReceiver<NewCampaignList>() { 210 + private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() {
211 @Override 211 @Override
212 - public void onSuccess(NewCampaignList result) { 212 + public void onSuccess(CampaignList result) {
213 WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); 213 WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
214 } 214 }
215 215
......
...@@ -27,6 +27,9 @@ package ly.warp.sdk.io.callbacks; ...@@ -27,6 +27,9 @@ package ly.warp.sdk.io.callbacks;
27 27
28 import org.json.JSONObject; 28 import org.json.JSONObject;
29 29
30 +import ly.warp.sdk.io.models.Campaign;
31 +import ly.warp.sdk.io.models.CampaignList;
32 +import ly.warp.sdk.io.models.NewCampaign;
30 import ly.warp.sdk.io.models.NewCampaignList; 33 import ly.warp.sdk.io.models.NewCampaignList;
31 34
32 /** 35 /**
...@@ -35,10 +38,10 @@ import ly.warp.sdk.io.models.NewCampaignList; ...@@ -35,10 +38,10 @@ import ly.warp.sdk.io.models.NewCampaignList;
35 38
36 public class NewCampaignsHook implements CallbackReceiver<JSONObject> { 39 public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
37 40
38 - private final CallbackReceiver<NewCampaignList> mListener; 41 + private final CallbackReceiver<CampaignList> mListener;
39 private final String mRequestSignature; 42 private final String mRequestSignature;
40 43
41 - public NewCampaignsHook(CallbackReceiver<NewCampaignList> listener, String requestSignature) { 44 + public NewCampaignsHook(CallbackReceiver<CampaignList> listener, String requestSignature) {
42 this.mListener = listener; 45 this.mListener = listener;
43 this.mRequestSignature = requestSignature; 46 this.mRequestSignature = requestSignature;
44 } 47 }
...@@ -48,7 +51,36 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> { ...@@ -48,7 +51,36 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> {
48 if (mListener != null) { 51 if (mListener != null) {
49 int status = result.optInt("status", 2); 52 int status = result.optInt("status", 2);
50 if (status == 1) { 53 if (status == 1) {
51 - mListener.onSuccess(new NewCampaignList(result, mRequestSignature)); 54 + NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature);
55 + CampaignList tempCampaigns = new CampaignList();
56 + for (NewCampaign newCamp : cmpList) {
57 + Campaign camp = new Campaign();
58 + camp.setIndexUrl(newCamp.getIndexUrl());
59 + camp.setLogoUrl(newCamp.getLogoUrl());
60 + camp.setMessage(newCamp.getMessage());
61 + camp.setOfferCategory(newCamp.getCommunicationCategory());
62 + camp.setSessionUUID(newCamp.getCommunicationUUID());
63 + camp.setTitle(newCamp.getTitle());
64 + camp.setSubtitle(newCamp.getSubtitle());
65 + camp.setSorting(newCamp.getSorting());
66 + camp.setNew(newCamp.getIsNew());
67 + camp.setType(newCamp.getCampaignType());
68 + try {
69 + camp.setExtraFields(newCamp.getExtraFields().toString());
70 + } catch (NullPointerException e) {
71 + camp.setExtraFields("");
72 + e.printStackTrace();
73 + }
74 +
75 + try {
76 + camp.setCampaignTypeSettings(newCamp.getSettings().toString());
77 + } catch (NullPointerException e) {
78 + camp.setCampaignTypeSettings("");
79 + e.printStackTrace();
80 + }
81 + tempCampaigns.add(camp);
82 + }
83 + mListener.onSuccess(tempCampaigns);
52 } else 84 } else
53 mListener.onFailure(status); 85 mListener.onFailure(status);
54 } 86 }
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 android:id="@+id/cl_bill_payment" 4 android:id="@+id/cl_bill_payment"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 - android:layout_height="match_parent"> 6 + android:layout_height="match_parent"
7 + android:background="@android:color/white"
8 + android:orientation="vertical">
7 9
8 <androidx.constraintlayout.widget.ConstraintLayout 10 <androidx.constraintlayout.widget.ConstraintLayout
9 android:id="@+id/cl_bill_header" 11 android:id="@+id/cl_bill_header"
10 android:layout_width="match_parent" 12 android:layout_width="match_parent"
11 android:layout_height="80dp" 13 android:layout_height="80dp"
12 - android:background="@android:color/white" 14 + android:background="@android:color/white">
13 - app:layout_constraintTop_toTopOf="parent">
14 15
15 <ImageView 16 <ImageView
16 android:id="@+id/iv_coupons_close" 17 android:id="@+id/iv_coupons_close"
...@@ -38,23 +39,21 @@ ...@@ -38,23 +39,21 @@
38 app:layout_constraintTop_toTopOf="parent" /> 39 app:layout_constraintTop_toTopOf="parent" />
39 </androidx.constraintlayout.widget.ConstraintLayout> 40 </androidx.constraintlayout.widget.ConstraintLayout>
40 41
41 - <androidx.constraintlayout.widget.ConstraintLayout 42 + <RelativeLayout
42 android:layout_width="match_parent" 43 android:layout_width="match_parent"
43 android:layout_height="match_parent" 44 android:layout_height="match_parent"
44 - android:layout_below="@+id/cl_bill_header" 45 + android:background="@drawable/shape_cos_loyalty"
45 - android:layout_marginTop="1dp" 46 + android:orientation="vertical">
46 - android:background="@drawable/shape_cos_loyalty">
47 47
48 <androidx.recyclerview.widget.RecyclerView 48 <androidx.recyclerview.widget.RecyclerView
49 android:id="@+id/rv_active_coupons" 49 android:id="@+id/rv_active_coupons"
50 android:layout_width="match_parent" 50 android:layout_width="match_parent"
51 - android:layout_height="0dp" 51 + android:layout_height="wrap_content"
52 - android:paddingTop="44dp" 52 + android:layout_marginTop="4dp"
53 - app:layout_constraintBottom_toBottomOf="parent" 53 + android:clipToPadding="false"
54 - app:layout_constraintEnd_toEndOf="parent" 54 + android:orientation="vertical"
55 - app:layout_constraintStart_toStartOf="parent" 55 + android:paddingTop="44dp" />
56 - app:layout_constraintTop_toTopOf="parent" /> 56 + </RelativeLayout>
57 - </androidx.constraintlayout.widget.ConstraintLayout>
58 57
59 <TextView 58 <TextView
60 android:id="@+id/tv_no_coupons" 59 android:id="@+id/tv_no_coupons"
...@@ -66,4 +65,4 @@ ...@@ -66,4 +65,4 @@
66 android:textSize="18sp" 65 android:textSize="18sp"
67 android:textStyle="bold" 66 android:textStyle="bold"
68 android:visibility="gone" /> 67 android:visibility="gone" />
69 -</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
68 +</LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
......