Panagiotis Triantafyllou

new version

Showing 23 changed files with 1338 additions and 93 deletions
...@@ -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-cosbeta35' 5 + PUBLISH_VERSION = '4.5.4-cosbeta36'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 android:screenOrientation="portrait" /> 28 android:screenOrientation="portrait" />
29 29
30 <activity 30 <activity
31 - android:name="ly.warp.sdk.activities.LoyaltyActivity" 31 + android:name="ly.warp.sdk.activities.LoyaltyAnalysisActivity"
32 android:exported="false" 32 android:exported="false"
33 android:screenOrientation="portrait" /> 33 android:screenOrientation="portrait" />
34 34
......
...@@ -73,6 +73,7 @@ import ly.warp.sdk.io.volley.toolbox.Volley; ...@@ -73,6 +73,7 @@ import ly.warp.sdk.io.volley.toolbox.Volley;
73 import ly.warp.sdk.receivers.WarplyBeaconsApplication; 73 import ly.warp.sdk.receivers.WarplyBeaconsApplication;
74 import ly.warp.sdk.utils.GCMRegistrar; 74 import ly.warp.sdk.utils.GCMRegistrar;
75 import ly.warp.sdk.utils.ObjectSerializer; 75 import ly.warp.sdk.utils.ObjectSerializer;
76 +import ly.warp.sdk.utils.WarpJSONParser;
76 import ly.warp.sdk.utils.WarpUtils; 77 import ly.warp.sdk.utils.WarpUtils;
77 import ly.warp.sdk.utils.WarplyDeviceInfoCollector; 78 import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
78 import ly.warp.sdk.utils.WarplyInitializer; 79 import ly.warp.sdk.utils.WarplyInitializer;
...@@ -540,7 +541,7 @@ public enum Warply { ...@@ -540,7 +541,7 @@ public enum Warply {
540 // " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" + 541 // " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" +
541 // " \"businessAdditionalId\": \"\",\n" + 542 // " \"businessAdditionalId\": \"\",\n" +
542 // " \"dataCategory\": \"Data\",\n" + 543 // " \"dataCategory\": \"Data\",\n" +
543 -// " \"dataValue\": \"None\",\n" + 544 +// " \"dataValue\": \"233\",\n" +
544 // " \"discount\": \"None\",\n" + 545 // " \"discount\": \"None\",\n" +
545 // " \"eligibleAssets\": [\n" + 546 // " \"eligibleAssets\": [\n" +
546 // " \"306945218770\",\n" + 547 // " \"306945218770\",\n" +
...@@ -988,9 +989,24 @@ public enum Warply { ...@@ -988,9 +989,24 @@ public enum Warply {
988 objectSerializer.serialize(result, File.separator + requestSignature); 989 objectSerializer.serialize(result, File.separator + requestSignature);
989 warplyPreferences.saveInboxLastCachedTimeStamp(requestSignature, System.currentTimeMillis()); 990 warplyPreferences.saveInboxLastCachedTimeStamp(requestSignature, System.currentTimeMillis());
990 991
992 + CampaignList campaignLoyaltyList = new CampaignList();
993 + campaignLoyaltyList.clear();
994 + for (Campaign camp : result) {
995 + try {
996 + JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
997 + if (extraFields != null) {
998 + if (extraFields.length() == 0 || !extraFields.has("ccms_offer")) {
999 + campaignLoyaltyList.add(camp);
1000 + }
1001 + }
1002 + } catch (Exception exception) {
1003 + campaignLoyaltyList.add(camp);
1004 + }
1005 + }
1006 +
991 INSTANCE.mLastReceivedCampaigns = result; 1007 INSTANCE.mLastReceivedCampaigns = result;
992 if (receiver != null) { 1008 if (receiver != null) {
993 - receiver.onSuccess(result); 1009 + receiver.onSuccess(/*result*/campaignLoyaltyList);
994 } 1010 }
995 } 1011 }
996 } 1012 }
...@@ -1950,7 +1966,7 @@ public enum Warply { ...@@ -1950,7 +1966,7 @@ public enum Warply {
1950 url = buildWarplyAuthRequestUrl(path, true); 1966 url = buildWarplyAuthRequestUrl(path, true);
1951 else if (path.equals("campaigns")) 1967 else if (path.equals("campaigns"))
1952 url = buildWarplyRequestUrl(null); 1968 url = buildWarplyRequestUrl(null);
1953 - else if(path.equals("campaignsPersonalized")) 1969 + else if (path.equals("campaignsPersonalized"))
1954 url = buildWarplyRequestUrl(null, true); 1970 url = buildWarplyRequestUrl(null, true);
1955 else 1971 else
1956 url = buildWarplyAuthRequestUrl(path, false); 1972 url = buildWarplyAuthRequestUrl(path, false);
......
1 package ly.warp.sdk.activities; 1 package ly.warp.sdk.activities;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 +import android.graphics.Typeface;
4 import android.os.Bundle; 5 import android.os.Bundle;
5 import android.view.View; 6 import android.view.View;
6 import android.widget.ImageView; 7 import android.widget.ImageView;
8 +import android.widget.LinearLayout;
9 +import android.widget.RelativeLayout;
10 +import android.widget.TextView;
11 +
12 +import androidx.core.content.ContextCompat;
13 +import androidx.recyclerview.widget.LinearLayoutManager;
14 +import androidx.recyclerview.widget.RecyclerView;
7 15
8 import ly.warp.sdk.R; 16 import ly.warp.sdk.R;
17 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
18 +import ly.warp.sdk.io.models.Couponset;
19 +import ly.warp.sdk.io.models.SharingCoupon;
20 +import ly.warp.sdk.io.models.SharingList;
21 +import ly.warp.sdk.io.request.WarplySharingHistoryRequest;
22 +import ly.warp.sdk.utils.WarpUtils;
23 +import ly.warp.sdk.utils.WarplyManagerHelper;
24 +import ly.warp.sdk.utils.managers.WarplyManager;
25 +import ly.warp.sdk.views.adapters.ExpiredCouponAdapter;
26 +import ly.warp.sdk.views.adapters.SharedCouponAdapter;
9 27
10 28
11 public class LoyaltyAnalysisActivity extends Activity implements View.OnClickListener { 29 public class LoyaltyAnalysisActivity extends Activity implements View.OnClickListener {
...@@ -19,6 +37,13 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis ...@@ -19,6 +37,13 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
19 // =========================================================== 37 // ===========================================================
20 38
21 private ImageView mIvBack; 39 private ImageView mIvBack;
40 + private TextView mTvCouponsValueAll;
41 + private RecyclerView mRvExpiredCoupons, mRvSharedCoupons;
42 + private ExpiredCouponAdapter mAdapterExpiredCoupons;
43 + private SharedCouponAdapter mAdapterSharedCoupons;
44 + private LinearLayout mLlExpiredTab, mLlSharedTab;
45 + private RelativeLayout mRlExpiredView, mRlSharedView;
46 + private SharingList mSharedCoupons = new SharingList();
22 47
23 // =========================================================== 48 // ===========================================================
24 // Methods for/from SuperClass/Interfaces 49 // Methods for/from SuperClass/Interfaces
...@@ -30,6 +55,13 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis ...@@ -30,6 +55,13 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
30 setContentView(R.layout.activity_loyalty_analysis); 55 setContentView(R.layout.activity_loyalty_analysis);
31 56
32 mIvBack = findViewById(R.id.iv_loyalty_analysis_close); 57 mIvBack = findViewById(R.id.iv_loyalty_analysis_close);
58 + mTvCouponsValueAll = findViewById(R.id.tv_expired_coupons_title);
59 + mRvExpiredCoupons = findViewById(R.id.rv_expired_coupons);
60 + mLlExpiredTab = findViewById(R.id.cl_tab_coupon_analysis).findViewById(R.id.ll_tab_expired);
61 + mLlSharedTab = findViewById(R.id.cl_tab_coupon_analysis).findViewById(R.id.ll_tab_shared);
62 + mRlExpiredView = findViewById(R.id.rl_expired_view);
63 + mRlSharedView = findViewById(R.id.rl_shared_view);
64 + mRvSharedCoupons = findViewById(R.id.rv_shared_coupons);
33 65
34 initViews(); 66 initViews();
35 } 67 }
...@@ -37,12 +69,51 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis ...@@ -37,12 +69,51 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
37 @Override 69 @Override
38 public void onResume() { 70 public void onResume() {
39 super.onResume(); 71 super.onResume();
72 + mSharedCoupons.clear();
73 +
74 + new Thread(() -> {
75 + if (!Thread.currentThread().isInterrupted()) {
76 + WarplyManager.getSharingHistory(new WarplySharingHistoryRequest()
77 + , mSharingHistoryCallback);
78 + }
79 + Thread.currentThread().interrupt();
80 + }).start();
40 } 81 }
41 82
42 @Override 83 @Override
43 public void onClick(View view) { 84 public void onClick(View view) {
44 if (view.getId() == R.id.iv_loyalty_analysis_close) { 85 if (view.getId() == R.id.iv_loyalty_analysis_close) {
45 onBackPressed(); 86 onBackPressed();
87 + return;
88 + }
89 + if (view.getId() == R.id.ll_tab_expired) {
90 + mLlExpiredTab.setBackgroundResource(R.drawable.bottom_border_gradient2);
91 + TextView expiredTab = findViewById(R.id.tv_expired_tab);
92 + expiredTab.setTextColor(ContextCompat.getColor(this, R.color.cos_cyan4));
93 + expiredTab.setTypeface(null, Typeface.BOLD);
94 +
95 + mLlSharedTab.setBackgroundResource(R.drawable.bottom_border_transparent);
96 + TextView sharedTab = findViewById(R.id.tv_shared_tab);
97 + sharedTab.setTextColor(ContextCompat.getColor(this, R.color.cos_dark_grey));
98 + sharedTab.setTypeface(null, Typeface.NORMAL);
99 +
100 + mRlSharedView.setVisibility(View.GONE);
101 + mRlExpiredView.setVisibility(View.VISIBLE);
102 + return;
103 + }
104 + if (view.getId() == R.id.ll_tab_shared) {
105 + mLlSharedTab.setBackgroundResource(R.drawable.bottom_border_gradient2);
106 + TextView sharedTab = findViewById(R.id.tv_shared_tab);
107 + sharedTab.setTextColor(ContextCompat.getColor(this, R.color.cos_cyan4));
108 + sharedTab.setTypeface(null, Typeface.BOLD);
109 +
110 + mLlExpiredTab.setBackgroundResource(R.drawable.bottom_border_transparent);
111 + TextView expiredTab = findViewById(R.id.tv_expired_tab);
112 + expiredTab.setTextColor(ContextCompat.getColor(this, R.color.cos_dark_grey));
113 + expiredTab.setTypeface(null, Typeface.NORMAL);
114 +
115 + mRlExpiredView.setVisibility(View.GONE);
116 + mRlSharedView.setVisibility(View.VISIBLE);
46 } 117 }
47 } 118 }
48 119
...@@ -52,10 +123,60 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis ...@@ -52,10 +123,60 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
52 123
53 private void initViews() { 124 private void initViews() {
54 mIvBack.setOnClickListener(this); 125 mIvBack.setOnClickListener(this);
126 + mLlExpiredTab.setOnClickListener(this);
127 + mLlSharedTab.setOnClickListener(this);
128 +
129 + mTvCouponsValueAll.setText(String.format(getString(R.string.cos_deals_win_title), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())));
130 +
131 + if (WarplyManagerHelper.getCouponExpiredList() != null && WarplyManagerHelper.getCouponExpiredList().size() > 0) {
132 + mRvExpiredCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
133 + mAdapterExpiredCoupons = new ExpiredCouponAdapter(this, WarplyManagerHelper.getCouponExpiredList());
134 + mRvExpiredCoupons.setAdapter(mAdapterExpiredCoupons);
135 +// mAdapterCoupons.getPositionClicks()
136 +// .doOnNext(coupon -> {
137 +// Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class);
138 +// intent.putExtra("coupon", (Serializable) coupon);
139 +// startActivity(intent);
140 +// })
141 +// .doOnError(error -> {
142 +// })
143 +// .subscribe();
144 + }
55 } 145 }
56 146
57 // =========================================================== 147 // ===========================================================
58 // Inner and Anonymous Classes 148 // Inner and Anonymous Classes
59 // =========================================================== 149 // ===========================================================
60 150
151 + private CallbackReceiver<SharingList> mSharingHistoryCallback = new CallbackReceiver<SharingList>() {
152 + @Override
153 + public void onSuccess(SharingList result) {
154 + if (result != null && result.size() > 0) {
155 + if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
156 + for (SharingCoupon shCoupon : result) {
157 + for (Couponset cpnset : WarplyManagerHelper.getCouponsets()) {
158 + if (shCoupon.getCouponsetUuid().equals(cpnset.getUuid())) {
159 + SharingCoupon newShCoupon = new SharingCoupon();
160 + newShCoupon = shCoupon;
161 + newShCoupon.setName(cpnset.getName());
162 + mSharedCoupons.add(newShCoupon);
163 + break;
164 + }
165 + }
166 + }
167 + }
168 + }
169 +
170 + runOnUiThread(() -> {
171 + mRvSharedCoupons.setLayoutManager(new LinearLayoutManager(LoyaltyAnalysisActivity.this, LinearLayoutManager.VERTICAL, false));
172 + mAdapterSharedCoupons = new SharedCouponAdapter(LoyaltyAnalysisActivity.this, mSharedCoupons);
173 + mRvSharedCoupons.setAdapter(mAdapterSharedCoupons);
174 + });
175 + }
176 +
177 + @Override
178 + public void onFailure(int errorCode) {
179 + WarpUtils.log("SHARED_COUPONS_ERROR " + String.valueOf(errorCode));
180 + }
181 + };
61 } 182 }
......
...@@ -125,8 +125,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { ...@@ -125,8 +125,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
125 return; 125 return;
126 } 126 }
127 if (view.getId() == R.id.cl_deals_win) { 127 if (view.getId() == R.id.cl_deals_win) {
128 - //TODO: Loyalty history 128 + Intent intent = new Intent(LoyaltyWallet.this, LoyaltyAnalysisActivity.class);
129 - 129 + startActivity(intent);
130 return; 130 return;
131 } 131 }
132 if (view.getId() == R.id.cl_mygifts) { 132 if (view.getId() == R.id.cl_mygifts) {
......
...@@ -16,13 +16,17 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -16,13 +16,17 @@ import androidx.recyclerview.widget.RecyclerView;
16 16
17 import org.json.JSONObject; 17 import org.json.JSONObject;
18 18
19 +import java.io.Serializable;
20 +
19 import ly.warp.sdk.R; 21 import ly.warp.sdk.R;
20 import ly.warp.sdk.activities.GiftsForYouActivity; 22 import ly.warp.sdk.activities.GiftsForYouActivity;
21 import ly.warp.sdk.activities.LoyaltyWallet; 23 import ly.warp.sdk.activities.LoyaltyWallet;
22 import ly.warp.sdk.activities.MoreForYouActivity; 24 import ly.warp.sdk.activities.MoreForYouActivity;
25 +import ly.warp.sdk.activities.TelcoActivity;
23 import ly.warp.sdk.activities.WarpViewActivity; 26 import ly.warp.sdk.activities.WarpViewActivity;
24 import ly.warp.sdk.io.models.Campaign; 27 import ly.warp.sdk.io.models.Campaign;
25 import ly.warp.sdk.io.models.CampaignList; 28 import ly.warp.sdk.io.models.CampaignList;
29 +import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
26 import ly.warp.sdk.utils.WarpJSONParser; 30 import ly.warp.sdk.utils.WarpJSONParser;
27 import ly.warp.sdk.utils.WarplyManagerHelper; 31 import ly.warp.sdk.utils.WarplyManagerHelper;
28 import ly.warp.sdk.views.adapters.ProfileCampaignAdapter; 32 import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
...@@ -103,6 +107,19 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { ...@@ -103,6 +107,19 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
103 mRecyclerGifts.setAdapter(mAdapterGifts); 107 mRecyclerGifts.setAdapter(mAdapterGifts);
104 mAdapterGifts.getPositionClicks() 108 mAdapterGifts.getPositionClicks()
105 .doOnNext(gift -> { 109 .doOnNext(gift -> {
110 + try {
111 + JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields());
112 + if (extraFields != null) {
113 + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
114 + WarplyManagerHelper.openTelco(getContext(), gift);
115 + return;
116 + }
117 + }
118 + } catch (Exception exception) {
119 + startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
120 + return;
121 + }
122 +
106 if (gift.getType().equals("coupon")) { 123 if (gift.getType().equals("coupon")) {
107 WarplyManagerHelper.openCouponset(getContext(), gift); 124 WarplyManagerHelper.openCouponset(getContext(), gift);
108 } else 125 } else
...@@ -130,6 +147,19 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { ...@@ -130,6 +147,19 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
130 mRecyclerMore.setAdapter(mAdapterMore); 147 mRecyclerMore.setAdapter(mAdapterMore);
131 mAdapterMore.getPositionClicks() 148 mAdapterMore.getPositionClicks()
132 .doOnNext(more -> { 149 .doOnNext(more -> {
150 + try {
151 + JSONObject extraFields = WarpJSONParser.getJSONFromString(more.getExtraFields());
152 + if (extraFields != null) {
153 + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
154 + WarplyManagerHelper.openTelco(getContext(), more);
155 + return;
156 + }
157 + }
158 + } catch (Exception exception) {
159 + startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more)));
160 + return;
161 + }
162 +
133 if (more.getType().equals("coupon")) { 163 if (more.getType().equals("coupon")) {
134 WarplyManagerHelper.openCouponset(getContext(), more); 164 WarplyManagerHelper.openCouponset(getContext(), more);
135 } else 165 } else
......
1 +/*
2 + * Copyright 2010-2013 Warply Ltd. All rights reserved.
3 + *
4 + * Redistribution and use in source and binary forms, without modification, are
5 + * permitted provided that the following conditions are met:
6 + *
7 + * 1. Redistributions of source code must retain the above copyright notice,
8 + * this list of conditions and the following disclaimer.
9 + *
10 + * 2. Redistributions in binary form must reproduce the above copyright notice,
11 + * this list of conditions and the following disclaimer in the documentation
12 + * and/or other materials provided with the distribution.
13 + *
14 + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
15 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17 + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 + */
25 +
26 +package ly.warp.sdk.io.callbacks;
27 +
28 +import org.json.JSONArray;
29 +import org.json.JSONObject;
30 +
31 +import ly.warp.sdk.io.models.SharingList;
32 +
33 +/**
34 + * Created by Panagiotis Triantafyllou on 19-July-22.
35 + */
36 +
37 +public class SharingHook implements CallbackReceiver<JSONObject> {
38 +
39 + private final CallbackReceiver<SharingList> mListener;
40 + private final String mRequestSignature;
41 +
42 + public SharingHook(CallbackReceiver<SharingList> listener, String requestSignature) {
43 + this.mListener = listener;
44 + this.mRequestSignature = requestSignature;
45 + }
46 +
47 + @Override
48 + public void onSuccess(JSONObject result) {
49 + if (mListener != null) {
50 + int status = result.optInt("status", 2);
51 + if (status == 1) {
52 + JSONArray jArrayResult = result.optJSONArray("result");
53 + if (jArrayResult == null) {
54 + mListener.onFailure(2);
55 + return;
56 + }
57 + mListener.onSuccess(new SharingList(result, mRequestSignature));
58 + } else
59 + mListener.onFailure(status);
60 + }
61 +
62 + }
63 +
64 + @Override
65 + public void onFailure(int errorCode) {
66 + if (mListener != null)
67 + mListener.onFailure(errorCode);
68 + }
69 +}
1 +/*
2 + * Copyright 2010-2013 Warply Ltd. All rights reserved.
3 + *
4 + * Redistribution and use in source and binary forms, without modification, are
5 + * permitted provided that the following conditions are met:
6 + *
7 + * 1. Redistributions of source code must retain the above copyright notice,
8 + * this list of conditions and the following disclaimer.
9 + *
10 + * 2. Redistributions in binary form must reproduce the above copyright notice,
11 + * this list of conditions and the following disclaimer in the documentation
12 + * and/or other materials provided with the distribution.
13 + *
14 + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
15 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17 + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 + */
25 +
26 +package ly.warp.sdk.io.models;
27 +
28 +import android.os.Parcel;
29 +import android.os.Parcelable;
30 +
31 +import org.json.JSONException;
32 +import org.json.JSONObject;
33 +
34 +import java.io.Serializable;
35 +
36 +import ly.warp.sdk.utils.WarpUtils;
37 +import ly.warp.sdk.utils.constants.WarpConstants;
38 +
39 +/**
40 + * Created by Panagiotis Triantafyllou on 19-July-22.
41 + */
42 +
43 +public class SharingCoupon implements Parcelable, Serializable {
44 +
45 + private static final long serialVersionUID = -4754964462459705285L;
46 +
47 + /* Constants used to export the campaign in JSON formal and vice versa */
48 +
49 + private static final String TRANSACTION_METADATA = "transaction_metadata";
50 + private static final String SHARING_TYPE = "sharing_type";
51 + private static final String DISCOUNT = "discount";
52 + private static final String DATE = "date";
53 + private static final String COUPONSET_UUID = "couponset_uuid";
54 + private static final String NAME = "name";
55 +
56 + /* Member variables of the Campaign object */
57 +
58 + private String transactionMetadata = "";
59 + private String sharingType = "";
60 + private String discount = "";
61 + private String date = "";
62 + private String couponsetUuid = "";
63 + private String name = "";
64 +
65 + /**
66 + * Basic constructor used to create an object from a String, representing a
67 + * JSON Object
68 + *
69 + * @param json The String, representing the JSON Object
70 + * @throws JSONException Thrown if the String cannot be converted to JSON
71 + */
72 + public SharingCoupon(String json) throws JSONException {
73 + this(new JSONObject(json));
74 + }
75 +
76 + public SharingCoupon() {
77 + this.transactionMetadata = "";
78 + this.sharingType = "";
79 + this.discount = "";
80 + this.date = "";
81 + this.couponsetUuid = "";
82 + this.name = "";
83 + }
84 +
85 + /**
86 + * Constructor used to create an Object from a given JSON Object
87 + *
88 + * @param json JSON Object used to create the Coupon
89 + */
90 + public SharingCoupon(JSONObject json) {
91 + if (json != null) {
92 + this.discount = json.optString(DISCOUNT);
93 + this.couponsetUuid = json.optString(COUPONSET_UUID);
94 + this.date = json.optString(DATE);
95 + this.sharingType = json.optString(SHARING_TYPE);
96 + this.transactionMetadata = json.optString(TRANSACTION_METADATA);
97 + this.name = json.optString(NAME);
98 + }
99 + }
100 +
101 + public SharingCoupon(Parcel source) {
102 + this.discount = source.readString();
103 + this.couponsetUuid = source.readString();
104 + this.date = source.readString();
105 + this.sharingType = source.readString();
106 + this.transactionMetadata = source.readString();
107 + this.name = source.readString();
108 + }
109 +
110 + @Override
111 + public void writeToParcel(Parcel dest, int flags) {
112 + dest.writeString(this.discount);
113 + dest.writeString(this.couponsetUuid);
114 + dest.writeString(this.date);
115 + dest.writeString(this.sharingType);
116 + dest.writeString(this.transactionMetadata);
117 + dest.writeString(this.name);
118 + }
119 +
120 + /**
121 + * Converts the Coupon into a JSON Object
122 + *
123 + * @return The JSON Object created from this Coupon
124 + */
125 + public JSONObject toJSONObject() {
126 + JSONObject jObj = new JSONObject();
127 + try {
128 + jObj.putOpt(DISCOUNT, this.discount);
129 + jObj.putOpt(COUPONSET_UUID, this.couponsetUuid);
130 + jObj.putOpt(DATE, this.date);
131 + jObj.putOpt(SHARING_TYPE, this.sharingType);
132 + jObj.putOpt(TRANSACTION_METADATA, this.transactionMetadata);
133 + jObj.putOpt(NAME, this.name);
134 + } catch (JSONException e) {
135 + if (WarpConstants.DEBUG) {
136 + e.printStackTrace();
137 + }
138 + }
139 + return jObj;
140 + }
141 +
142 + /**
143 + * String representation of the Coupon, as a JSON object
144 + *
145 + * @return A String representation of JSON object
146 + */
147 + public String toString() {
148 + if (toJSONObject() != null)
149 + return toJSONObject().toString();
150 + return null;
151 + }
152 +
153 + /**
154 + * String representation of the Coupon, as a human readable JSON object
155 + *
156 + * @return A human readable String representation of JSON object
157 + */
158 + public String toHumanReadableString() {
159 + String humanReadableString = null;
160 + try {
161 + humanReadableString = toJSONObject().toString(2);
162 + } catch (JSONException e) {
163 + WarpUtils.warn("Failed converting Coupon JSON object to String", e);
164 + }
165 + return humanReadableString;
166 + }
167 +
168 + // ================================================================================
169 + // Getters
170 + // ================================================================================
171 +
172 +
173 + public String getTransactionMetadata() {
174 + return transactionMetadata;
175 + }
176 +
177 + public void setTransactionMetadata(String transactionMetadata) {
178 + this.transactionMetadata = transactionMetadata;
179 + }
180 +
181 + public String getSharingType() {
182 + return sharingType;
183 + }
184 +
185 + public void setSharingType(String sharingType) {
186 + this.sharingType = sharingType;
187 + }
188 +
189 + public String getDiscount() {
190 + return discount;
191 + }
192 +
193 + public void setDiscount(String discount) {
194 + this.discount = discount;
195 + }
196 +
197 + public String getDate() {
198 + return date;
199 + }
200 +
201 + public void setDate(String date) {
202 + this.date = date;
203 + }
204 +
205 + public String getCouponsetUuid() {
206 + return couponsetUuid;
207 + }
208 +
209 + public void setCouponsetUuid(String couponsetUuid) {
210 + this.couponsetUuid = couponsetUuid;
211 + }
212 +
213 + public String getName() {
214 + return name;
215 + }
216 +
217 + public void setName(String name) {
218 + this.name = name;
219 + }
220 +
221 + @Override
222 + public int describeContents() {
223 + return 0;
224 + }
225 +
226 + public static final Creator<SharingCoupon> CREATOR = new Creator<SharingCoupon>() {
227 + public SharingCoupon createFromParcel(Parcel source) {
228 + return new SharingCoupon(source);
229 + }
230 +
231 + public SharingCoupon[] newArray(int size) {
232 + return new SharingCoupon[size];
233 + }
234 + };
235 +}
1 +/*
2 + * Copyright 2010-2013 Warply Ltd. All rights reserved.
3 + *
4 + * Redistribution and use in source and binary forms, without modification, are
5 + * permitted provided that the following conditions are met:
6 + *
7 + * 1. Redistributions of source code must retain the above copyright notice,
8 + * this list of conditions and the following disclaimer.
9 + *
10 + * 2. Redistributions in binary form must reproduce the above copyright notice,
11 + * this list of conditions and the following disclaimer in the documentation
12 + * and/or other materials provided with the distribution.
13 + *
14 + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
15 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17 + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 + */
25 +
26 +package ly.warp.sdk.io.models;
27 +
28 +import androidx.annotation.NonNull;
29 +
30 +import org.json.JSONArray;
31 +import org.json.JSONObject;
32 +
33 +import java.util.ArrayList;
34 +
35 +/**
36 + * Created by Panagiotis Triantafyllou on 19-July-22.
37 + */
38 +
39 +public class SharingList extends ArrayList<SharingCoupon> {
40 +
41 + /**
42 + * Generated for serialized class
43 + */
44 + private static final long serialVersionUID = -188843583823948267L;
45 +
46 + private static final String JSON_KEY_RESULT = "result";
47 +
48 + private String mRequestSignature = "";
49 +
50 + private SharingList(String requestSignature) {
51 + this.mRequestSignature = requestSignature;
52 + }
53 +
54 + public SharingList() {
55 + super();
56 + }
57 +
58 + /**
59 + * Constructor used to create the CouponList from a JSON Object.
60 + *
61 + * @param couponListJSONObject The JSON Object, used to create the CouponList
62 + */
63 + public SharingList(JSONObject couponListJSONObject, String requestSignature) {
64 + this(requestSignature);
65 +
66 + if (couponListJSONObject == null)
67 + return;
68 +
69 + JSONArray jArray = couponListJSONObject.optJSONArray(JSON_KEY_RESULT);
70 + if (jArray != null) {
71 + for (int i = 0, lim = jArray.length(); i < lim; ++i) {
72 + add(new SharingCoupon(jArray.optJSONObject(i)));
73 + }
74 + }
75 + }
76 +
77 + @NonNull
78 + public String getRequestSignature() {
79 + return mRequestSignature;
80 + }
81 +}
1 +package ly.warp.sdk.io.request;
2 +
3 +import android.util.Base64;
4 +
5 +import org.json.JSONException;
6 +import org.json.JSONObject;
7 +
8 +import java.io.UnsupportedEncodingException;
9 +import java.security.MessageDigest;
10 +import java.security.NoSuchAlgorithmException;
11 +import java.util.HashMap;
12 +
13 +import ly.warp.sdk.utils.constants.WarpConstants;
14 +
15 +/**
16 + * Created by Panagiotis Triantafyllou on 19-July-22.
17 + */
18 +
19 +public class WarplySharingHistoryRequest {
20 +
21 + // ===========================================================
22 + // Constants
23 + // ===========================================================
24 +
25 + private final String KEY_ACTION = "action";
26 + private final String KEY_ACTION_VALUE = "sharing_history";
27 +
28 + // ===========================================================
29 + // Fields
30 + // ===========================================================
31 +
32 + private HashMap<String, String> mFilters;
33 + private long mCacheUpdateInterval = 0;
34 +
35 + // ===========================================================
36 + // Constructor
37 + // ===========================================================
38 +
39 + /**
40 + * Default constructor of WarplySharingHistoryRequest, initializes an empty filters HashMap
41 + */
42 + public WarplySharingHistoryRequest() {
43 + mFilters = new HashMap<>();
44 + }
45 +
46 + public WarplySharingHistoryRequest(WarplySharingHistoryRequest copy) {
47 + if (copy != null) {
48 + this.mFilters = copy.mFilters;
49 + this.mCacheUpdateInterval = copy.mCacheUpdateInterval;
50 + }
51 + }
52 +
53 + // ===========================================================
54 + // Methods for/from SuperClass/Interfaces
55 + // ===========================================================
56 +
57 + @Override
58 + public boolean equals(Object object) {
59 + if (object instanceof WarplySharingHistoryRequest) {
60 + WarplySharingHistoryRequest other = (WarplySharingHistoryRequest) object;
61 + return other == this || (this.mFilters == other.mFilters || (this.mFilters != null && this.mFilters.equals(other.mFilters)));
62 + }
63 + return false;
64 + }
65 +
66 + @Override
67 + public int hashCode() {
68 + return mFilters.hashCode();
69 + }
70 +
71 + // ===========================================================
72 + // Methods
73 + // ===========================================================
74 +
75 + // ===========================================================
76 + // Getter & Setter
77 + // ===========================================================
78 +
79 + /**
80 + * Call this to get how often the cached data will be updated.
81 + *
82 + * @return mCacheUpdateInterval
83 + */
84 + public long getCacheUpdateInterval() {
85 + return mCacheUpdateInterval;
86 + }
87 +
88 + /**
89 + * Call this to set how often the cached data will be updated.
90 + *
91 + * @param updateInterval The time that data will be cached
92 + * @return WarplySharingHistoryRequest
93 + */
94 + public WarplySharingHistoryRequest setCacheUpdateInterval(long updateInterval) {
95 +
96 + this.mCacheUpdateInterval = updateInterval;
97 + if (mCacheUpdateInterval < 0) {
98 + mCacheUpdateInterval = 0;
99 + }
100 + return this;
101 + }
102 +
103 + /**
104 + * Call this to check if the Application uses Cache
105 + *
106 + * @return <p>true - the Application is using Cache</p>
107 + * <p>false - the Application is not using Cache</p>
108 + */
109 + public boolean isUseCache() {
110 + return mCacheUpdateInterval > 0;
111 + }
112 +
113 + /**
114 + * Call this to check whether the cached data need to be updated
115 + *
116 + * @param useCache <p>true - the Application is using Cache</p>
117 + * <p>false - the Application is not using Cache</p>
118 + * @return WarplySharingHistoryRequest
119 + */
120 + public WarplySharingHistoryRequest setUseCache(boolean useCache) {
121 +
122 + if (useCache) {
123 + mCacheUpdateInterval = mCacheUpdateInterval > 0 ? mCacheUpdateInterval
124 + : WarpConstants.INBOX_UPDATE_INTERVAL;
125 + } else {
126 + mCacheUpdateInterval = 0;
127 + }
128 + return this;
129 + }
130 +
131 + /**
132 + * Call this to build the offers Json object
133 + *
134 + * @return bodyJsonObject
135 + */
136 + public JSONObject toJson() {
137 + JSONObject bodyJsonObject = new JSONObject();
138 + try {
139 + bodyJsonObject.putOpt(KEY_ACTION, KEY_ACTION_VALUE);
140 + } catch (JSONException e) {
141 + if (WarpConstants.DEBUG)
142 + e.printStackTrace();
143 + }
144 + return bodyJsonObject;
145 + }
146 +
147 + public String getSignature() {
148 + String signature = mFilters != null && mFilters.size() > 0 ? String.valueOf(mFilters.hashCode()) : "default_sharing_history_request";
149 + try {
150 + byte[] hash = MessageDigest.getInstance("SHA-256").digest(signature.getBytes("UTF-8"));
151 + signature = Base64.encodeToString(hash, Base64.NO_WRAP);
152 + } catch (NullPointerException | NoSuchAlgorithmException
153 + | UnsupportedEncodingException e) {
154 + e.printStackTrace();
155 + }
156 + return signature;
157 + }
158 +}
...@@ -45,6 +45,7 @@ import ly.warp.sdk.R; ...@@ -45,6 +45,7 @@ import ly.warp.sdk.R;
45 import ly.warp.sdk.Warply; 45 import ly.warp.sdk.Warply;
46 import ly.warp.sdk.activities.CouponsetInfoActivity; 46 import ly.warp.sdk.activities.CouponsetInfoActivity;
47 import ly.warp.sdk.activities.GiftsForYouActivity; 47 import ly.warp.sdk.activities.GiftsForYouActivity;
48 +import ly.warp.sdk.activities.TelcoActivity;
48 import ly.warp.sdk.activities.WarpViewActivity; 49 import ly.warp.sdk.activities.WarpViewActivity;
49 import ly.warp.sdk.db.WarplyDBHelper; 50 import ly.warp.sdk.db.WarplyDBHelper;
50 import ly.warp.sdk.io.callbacks.CallbackReceiver; 51 import ly.warp.sdk.io.callbacks.CallbackReceiver;
...@@ -85,6 +86,7 @@ public class WarplyManagerHelper { ...@@ -85,6 +86,7 @@ public class WarplyManagerHelper {
85 private static Consumer mConsumer = new Consumer(); 86 private static Consumer mConsumer = new Consumer();
86 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>(); 87 private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
87 private static CouponList mCouponList = new CouponList(); 88 private static CouponList mCouponList = new CouponList();
89 + private static CouponList mCouponListExpired = new CouponList();
88 private static CouponsetsList mCouponsetsList = new CouponsetsList(); 90 private static CouponsetsList mCouponsetsList = new CouponsetsList();
89 private static CustomerStateModel mCustomerStateModel = new CustomerStateModel(); 91 private static CustomerStateModel mCustomerStateModel = new CustomerStateModel();
90 private static CampaignList mCampaignList = new CampaignList(); 92 private static CampaignList mCampaignList = new CampaignList();
...@@ -423,75 +425,6 @@ public class WarplyManagerHelper { ...@@ -423,75 +425,6 @@ public class WarplyManagerHelper {
423 425
424 OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build(); 426 OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build();
425 WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); 427 WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
426 -
427 -// ContexualEventModel ccmsAdded = new ContexualEventModel();
428 -// EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
429 -
430 -// if (list == null || list.size() == 0) {
431 -// CampaignList tempGifts = new CampaignList();
432 -// if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) {
433 -// for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
434 -// try {
435 -// String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
436 -// if (!TextUtils.isEmpty(key)) {
437 -// String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
438 -// if (!(key.equals("ccms_offer") && value.equals("true"))) {
439 -// tempGifts.add(camp);
440 -// }
441 -// }
442 -// } catch (Exception exception) {
443 -// tempGifts.add(camp);
444 -// }
445 -// }
446 -//
447 -// Log.v("Got L:{" + String.valueOf(mCampaignList.size()) + "}", " LOYALTY campaigns");
448 -// Log.v("Got C:{0}", " CCMS campaigns");
449 -// Log.v("Matched M:{0}", " CCMS campaigns");
450 -// Log.v("=====================================", "");
451 -// Log.v("TOTAL: Campaigns Sum=" + String.valueOf(mCampaignList.size()), " campaigns to display");
452 -// mUniqueCampaignList.get("gifts_for_you").removeAll(tempGifts);
453 -// }
454 -// return;
455 -// }
456 -//
457 -// CampaignList tempGifts = new CampaignList();
458 -// if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) {
459 -// int ccmsCount = 0;
460 -// int loyaltyCount = 0;
461 -// for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) {
462 -// try {
463 -// String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next();
464 -// if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) {
465 -// String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key);
466 -// if (!TextUtils.isEmpty(value) && value.equals("true")) {
467 -// for (LoyaltyContextualOfferModel ccms : list) {
468 -// if (ccms.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
469 -// tempGifts.add(camp);
470 -// ccmsCount++;
471 -// break;
472 -// }
473 -// }
474 -// } else {
475 -// tempGifts.add(camp);
476 -// loyaltyCount++;
477 -// }
478 -// } else {
479 -// tempGifts.add(camp);
480 -// loyaltyCount++;
481 -// }
482 -// } catch (Exception exception) {
483 -// tempGifts.add(camp);
484 -// loyaltyCount++;
485 -// }
486 -// }
487 -//
488 -// Log.v("Got L:{" + String.valueOf(mCampaignList.size()) + "}", " LOYALTY campaigns");
489 -// Log.v("Got C:{" + String.valueOf(list.size()) + "}", " CCMS campaigns");
490 -// Log.v("Matched M:{" + String.valueOf(ccmsCount) + "}", " CCMS campaigns");
491 -// Log.v("=====================================", "");
492 -// Log.v("TOTAL: Campaigns Sum=" + String.valueOf(mCampaignList.size() - loyaltyCount + ccmsCount), " campaigns to display");
493 -// mUniqueCampaignList.get("gifts_for_you").retainAll(tempGifts);
494 -// }
495 } 428 }
496 429
497 /** 430 /**
...@@ -571,6 +504,18 @@ public class WarplyManagerHelper { ...@@ -571,6 +504,18 @@ public class WarplyManagerHelper {
571 } 504 }
572 } 505 }
573 506
507 + public static void openTelco(Context context, Campaign item) {
508 + for (LoyaltyContextualOfferModel ccms : mCCMSList) {
509 + if (ccms.getLoyaltyCampaignId().equals(item.getSessionUUID())) {
510 + Intent intent = new Intent(context, TelcoActivity.class);
511 + intent.putExtra("ccms", ccms);
512 + intent.putExtra("loyalty", (Serializable) item);
513 + context.startActivity(intent);
514 + break;
515 + }
516 + }
517 + }
518 +
574 /** 519 /**
575 * Save if customer is nonTelco and if he/she has accepted the consents, 520 * Save if customer is nonTelco and if he/she has accepted the consents,
576 * And his msisdn list 521 * And his msisdn list
...@@ -642,6 +587,15 @@ public class WarplyManagerHelper { ...@@ -642,6 +587,15 @@ public class WarplyManagerHelper {
642 return mCouponList; 587 return mCouponList;
643 } 588 }
644 589
590 + public static CouponList getCouponExpiredList() {
591 + if (mCouponListExpired != null && mCouponListExpired.size() > 0) {
592 + WarpUtils.log("GET_COUPON_EXPIRED_LIST size: " + String.valueOf(mCouponListExpired.size()));
593 + } else {
594 + WarpUtils.log("GET_COUPON_EXPIRED_LIST size: 0");
595 + }
596 + return mCouponListExpired;
597 + }
598 +
645 public static void setConsumer(Consumer consumer) { 599 public static void setConsumer(Consumer consumer) {
646 mConsumer = consumer; 600 mConsumer = consumer;
647 } 601 }
...@@ -699,12 +653,14 @@ public class WarplyManagerHelper { ...@@ -699,12 +653,14 @@ public class WarplyManagerHelper {
699 public static void setCouponList(CouponList couponList) { 653 public static void setCouponList(CouponList couponList) {
700 LoyaltyBadgeModel badge = new LoyaltyBadgeModel(); 654 LoyaltyBadgeModel badge = new LoyaltyBadgeModel();
701 CouponList cpnlist = new CouponList(); 655 CouponList cpnlist = new CouponList();
656 + CouponList cpnlistExpired = new CouponList();
702 float couponValue = 0.0f; 657 float couponValue = 0.0f;
703 int couponCount = 0; 658 int couponCount = 0;
704 for (Coupon coupon : couponList) { 659 for (Coupon coupon : couponList) {
705 if (coupon.getStatus() == 1) { 660 if (coupon.getStatus() == 1) {
706 cpnlist.add(coupon); 661 cpnlist.add(coupon);
707 } else if (coupon.getStatus() == 0) { 662 } else if (coupon.getStatus() == 0) {
663 + cpnlistExpired.add(coupon);
708 try { 664 try {
709 couponCount += 1; 665 couponCount += 1;
710 couponValue += Float.parseFloat(coupon.getDiscount()); 666 couponValue += Float.parseFloat(coupon.getDiscount());
...@@ -718,6 +674,8 @@ public class WarplyManagerHelper { ...@@ -718,6 +674,8 @@ public class WarplyManagerHelper {
718 mLoyaltyBadge = badge; 674 mLoyaltyBadge = badge;
719 mCouponList.clear(); 675 mCouponList.clear();
720 mCouponList.addAll(cpnlist); 676 mCouponList.addAll(cpnlist);
677 + mCouponListExpired.clear();
678 + mCouponListExpired.addAll(cpnlistExpired);
721 } 679 }
722 680
723 public static LoyaltyBadgeModel getLoyaltyBadge() { 681 public static LoyaltyBadgeModel getLoyaltyBadge() {
......
...@@ -47,6 +47,7 @@ import ly.warp.sdk.io.callbacks.NewCampaignsHook; ...@@ -47,6 +47,7 @@ import ly.warp.sdk.io.callbacks.NewCampaignsHook;
47 import ly.warp.sdk.io.callbacks.PacingDetailsHook; 47 import ly.warp.sdk.io.callbacks.PacingDetailsHook;
48 import ly.warp.sdk.io.callbacks.PointsHook; 48 import ly.warp.sdk.io.callbacks.PointsHook;
49 import ly.warp.sdk.io.callbacks.ProductsHook; 49 import ly.warp.sdk.io.callbacks.ProductsHook;
50 +import ly.warp.sdk.io.callbacks.SharingHook;
50 import ly.warp.sdk.io.callbacks.TagsCategoriesHook; 51 import ly.warp.sdk.io.callbacks.TagsCategoriesHook;
51 import ly.warp.sdk.io.callbacks.TagsHook; 52 import ly.warp.sdk.io.callbacks.TagsHook;
52 import ly.warp.sdk.io.callbacks.TransactionsHook; 53 import ly.warp.sdk.io.callbacks.TransactionsHook;
...@@ -69,6 +70,7 @@ import ly.warp.sdk.io.models.NewCampaignList; ...@@ -69,6 +70,7 @@ import ly.warp.sdk.io.models.NewCampaignList;
69 import ly.warp.sdk.io.models.PacingDetails; 70 import ly.warp.sdk.io.models.PacingDetails;
70 import ly.warp.sdk.io.models.PointsList; 71 import ly.warp.sdk.io.models.PointsList;
71 import ly.warp.sdk.io.models.ProductList; 72 import ly.warp.sdk.io.models.ProductList;
73 +import ly.warp.sdk.io.models.SharingList;
72 import ly.warp.sdk.io.models.TagsCategoriesList; 74 import ly.warp.sdk.io.models.TagsCategoriesList;
73 import ly.warp.sdk.io.models.TagsList; 75 import ly.warp.sdk.io.models.TagsList;
74 import ly.warp.sdk.io.models.TransactionsList; 76 import ly.warp.sdk.io.models.TransactionsList;
...@@ -106,6 +108,7 @@ import ly.warp.sdk.io.request.WarplyRefreshTokenRequest; ...@@ -106,6 +108,7 @@ import ly.warp.sdk.io.request.WarplyRefreshTokenRequest;
106 import ly.warp.sdk.io.request.WarplyRegisterRequest; 108 import ly.warp.sdk.io.request.WarplyRegisterRequest;
107 import ly.warp.sdk.io.request.WarplyRequestOTPRequest; 109 import ly.warp.sdk.io.request.WarplyRequestOTPRequest;
108 import ly.warp.sdk.io.request.WarplyResetPasswordRequest; 110 import ly.warp.sdk.io.request.WarplyResetPasswordRequest;
111 +import ly.warp.sdk.io.request.WarplySharingHistoryRequest;
109 import ly.warp.sdk.io.request.WarplyTagsCategoriesRequest; 112 import ly.warp.sdk.io.request.WarplyTagsCategoriesRequest;
110 import ly.warp.sdk.io.request.WarplyTagsRequest; 113 import ly.warp.sdk.io.request.WarplyTagsRequest;
111 import ly.warp.sdk.io.request.WarplyTokenAuthorizeRequest; 114 import ly.warp.sdk.io.request.WarplyTokenAuthorizeRequest;
...@@ -2147,7 +2150,14 @@ public class WarplyManager { ...@@ -2147,7 +2150,14 @@ public class WarplyManager {
2147 } 2150 }
2148 } 2151 }
2149 WarplyManagerHelper.setCouponList(mCouponList); 2152 WarplyManagerHelper.setCouponList(mCouponList);
2150 - receiver.onSuccess(mCouponList); 2153 +
2154 + CouponList mActiveCouponList = new CouponList();
2155 + for (Coupon coupon : mCouponList) {
2156 + if (coupon.getStatus() == 1)
2157 + mActiveCouponList.add(coupon);
2158 + }
2159 +
2160 + receiver.onSuccess(mActiveCouponList);
2151 } 2161 }
2152 2162
2153 @Override 2163 @Override
...@@ -2267,4 +2277,40 @@ public class WarplyManager { ...@@ -2267,4 +2277,40 @@ public class WarplyManager {
2267 } 2277 }
2268 }); 2278 });
2269 } 2279 }
2280 +
2281 + public static void getSharingHistory(WarplySharingHistoryRequest request, final CallbackReceiver<SharingList> receiver) {
2282 + WarpUtils.log("************* WARPLY Sharing History Request ********************");
2283 + WarpUtils.log("[WARP Trace] WARPLY Sharing History Request is active");
2284 + WarpUtils.log("**************************************************");
2285 +
2286 + Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, true, "context", request.toJson(), new SharingHook(new CallbackReceiver<SharingList>() {
2287 + @Override
2288 + public void onSuccess(SharingList response) {
2289 + receiver.onSuccess(response);
2290 + }
2291 +
2292 + @Override
2293 + public void onFailure(int errorCode) {
2294 + if (errorCode == 401) {
2295 + refreshToken(new WarplyRefreshTokenRequest(), new CallbackReceiver<JSONObject>() {
2296 + @Override
2297 + public void onSuccess(JSONObject result) {
2298 + int status = result.optInt("status", 2);
2299 + if (status == 1)
2300 + getSharingHistory(request, receiver);
2301 + else
2302 + receiver.onFailure(status);
2303 + }
2304 +
2305 + @Override
2306 + public void onFailure(int errorCode) {
2307 + receiver.onFailure(errorCode);
2308 + }
2309 + });
2310 + } else
2311 + receiver.onFailure(errorCode);
2312 + }
2313 + },
2314 + request.getSignature()));
2315 + }
2270 } 2316 }
......
1 +package ly.warp.sdk.views.adapters;
2 +
3 +import android.content.Context;
4 +import android.view.LayoutInflater;
5 +import android.view.View;
6 +import android.view.ViewGroup;
7 +import android.widget.ImageView;
8 +import android.widget.TextView;
9 +
10 +import androidx.recyclerview.widget.RecyclerView;
11 +
12 +import java.text.ParseException;
13 +import java.text.SimpleDateFormat;
14 +import java.util.Date;
15 +import java.util.concurrent.TimeUnit;
16 +
17 +import io.reactivex.Observable;
18 +import io.reactivex.subjects.PublishSubject;
19 +import ly.warp.sdk.R;
20 +import ly.warp.sdk.io.models.Coupon;
21 +import ly.warp.sdk.io.models.CouponList;
22 +
23 +public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdapter.ExpiredCouponViewHolder> {
24 +
25 + private Context mContext;
26 + private CouponList mCoupons;
27 + private final PublishSubject<Coupon> onClickSubject = PublishSubject.create();
28 +
29 + public ExpiredCouponAdapter(Context mContext, CouponList campaignList) {
30 + this.mContext = mContext;
31 + this.mCoupons = campaignList;
32 + }
33 +
34 + public class ExpiredCouponViewHolder extends RecyclerView.ViewHolder {
35 + private TextView tvCouponTitle, tvCouponValue, tvCouponDate;
36 +
37 + public ExpiredCouponViewHolder(View view) {
38 + super(view);
39 + tvCouponTitle = view.findViewById(R.id.tv_expired_coupons_title);
40 + tvCouponValue = view.findViewById(R.id.tv_expired_coupons_value);
41 + tvCouponDate = view.findViewById(R.id.tv_expired_coupons_date);
42 + }
43 + }
44 +
45 + @Override
46 + public int getItemCount() {
47 + if (mCoupons == null)
48 + return 0;
49 + else
50 + return mCoupons.size();
51 + }
52 +
53 +
54 + public Coupon getItem(int id) {
55 + return mCoupons.get(id);
56 + }
57 +
58 + public void updateData(CouponList couponList) {
59 + mCoupons.clear();
60 + mCoupons.addAll(couponList);
61 + notifyDataSetChanged();
62 + }
63 +
64 +
65 + @Override
66 + public ExpiredCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
67 + View itemView;
68 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.expired_coupon_layout, parent, false);
69 + return new ExpiredCouponViewHolder(itemView);
70 + }
71 +
72 + @Override
73 + public void onBindViewHolder(final ExpiredCouponViewHolder holder, int position) {
74 + Coupon couponItem = mCoupons.get(position);
75 +
76 + if (couponItem != null) {
77 + holder.tvCouponTitle.setText(couponItem.getName());
78 +
79 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
80 + Date newDate = new Date();
81 + try {
82 + newDate = simpleDateFormat.parse(couponItem.getExpiration());
83 + } catch (ParseException e) {
84 + e.printStackTrace();
85 + }
86 + simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
87 + holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
88 +
89 + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
90 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
91 + }
92 + }
93 +
94 + public Observable<Coupon> getPositionClicks() {
95 + return onClickSubject.cache();
96 + }
97 +
98 + private long getDifferenceDays(Date d1, Date d2) {
99 + long diff = d2.getTime() - d1.getTime();
100 + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
101 + }
102 +}
1 +package ly.warp.sdk.views.adapters;
2 +
3 +import android.content.Context;
4 +import android.view.LayoutInflater;
5 +import android.view.View;
6 +import android.view.ViewGroup;
7 +import android.widget.TextView;
8 +
9 +import androidx.recyclerview.widget.RecyclerView;
10 +
11 +import org.json.JSONObject;
12 +
13 +import java.text.ParseException;
14 +import java.text.SimpleDateFormat;
15 +import java.util.Date;
16 +import java.util.concurrent.TimeUnit;
17 +
18 +import io.reactivex.Observable;
19 +import io.reactivex.subjects.PublishSubject;
20 +import ly.warp.sdk.R;
21 +import ly.warp.sdk.io.models.SharingCoupon;
22 +import ly.warp.sdk.io.models.SharingList;
23 +import ly.warp.sdk.utils.WarpJSONParser;
24 +
25 +public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapter.SharedCouponViewHolder> {
26 +
27 + private Context mContext;
28 + private SharingList mCoupons;
29 + private final PublishSubject<SharingCoupon> onClickSubject = PublishSubject.create();
30 +
31 + public SharedCouponAdapter(Context mContext, SharingList campaignList) {
32 + this.mContext = mContext;
33 + this.mCoupons = campaignList;
34 + }
35 +
36 + public class SharedCouponViewHolder extends RecyclerView.ViewHolder {
37 + private TextView tvCouponTitle, tvCouponValue, tvCouponDate, tvCouponLabel, tvCouponPhone;
38 +
39 + public SharedCouponViewHolder(View view) {
40 + super(view);
41 + tvCouponTitle = view.findViewById(R.id.tv_shared_coupons_title);
42 + tvCouponValue = view.findViewById(R.id.tv_shared_coupons_value);
43 + tvCouponDate = view.findViewById(R.id.tv_shared_coupons_date);
44 + tvCouponLabel = view.findViewById(R.id.tv_shared_coupons_label);
45 + tvCouponPhone = view.findViewById(R.id.tv_shared_coupons_phone);
46 + }
47 + }
48 +
49 + @Override
50 + public int getItemCount() {
51 + if (mCoupons == null)
52 + return 0;
53 + else
54 + return mCoupons.size();
55 + }
56 +
57 +
58 + public SharingCoupon getItem(int id) {
59 + return mCoupons.get(id);
60 + }
61 +
62 + public void updateData(SharingList couponList) {
63 + mCoupons.clear();
64 + mCoupons.addAll(couponList);
65 + notifyDataSetChanged();
66 + }
67 +
68 +
69 + @Override
70 + public SharedCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
71 + View itemView;
72 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.shared_coupon_layout, parent, false);
73 + return new SharedCouponViewHolder(itemView);
74 + }
75 +
76 + @Override
77 + public void onBindViewHolder(final SharedCouponViewHolder holder, int position) {
78 + SharingCoupon couponItem = mCoupons.get(position);
79 +
80 + if (couponItem != null) {
81 + JSONObject extraFields = WarpJSONParser.getJSONFromString(couponItem.getTransactionMetadata());
82 +
83 + holder.tvCouponTitle.setText(couponItem.getName());
84 +
85 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
86 + Date newDate = new Date();
87 + try {
88 + newDate = simpleDateFormat.parse(couponItem.getDate());
89 + } catch (ParseException e) {
90 + e.printStackTrace();
91 + }
92 + simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
93 + holder.tvCouponDate.setText(simpleDateFormat.format(newDate != null ? newDate : ""));
94 +
95 + if (couponItem.getSharingType().equals("sent")) {
96 + holder.tvCouponLabel.setText(R.string.cos_shared_coupon_receiver);
97 + if (extraFields != null && extraFields.has("receiver_msisdn")) {
98 + holder.tvCouponLabel.setText(extraFields.optString("receiver_msisdn"));
99 + }
100 + } else if (couponItem.getSharingType().equals("received")) {
101 + holder.tvCouponLabel.setText(R.string.cos_shared_coupon_sender);
102 + if (extraFields != null && extraFields.has("sender_msisdn")) {
103 + holder.tvCouponLabel.setText(extraFields.optString("sender_msisdn"));
104 + }
105 + }
106 +
107 + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
108 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
109 + }
110 + }
111 +
112 + public Observable<SharingCoupon> getPositionClicks() {
113 + return onClickSubject.cache();
114 + }
115 +
116 + private long getDifferenceDays(Date d1, Date d2) {
117 + long diff = d2.getTime() - d1.getTime();
118 + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
119 + }
120 +}
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item>
4 + <shape android:shape="rectangle">
5 + <gradient
6 + android:angle="180"
7 + android:endColor="@color/cos_cyan2"
8 + android:startColor="@color/cos_green7" />
9 + <corners android:radius="4dp" />
10 + </shape>
11 + </item>
12 +
13 + <item
14 + android:bottom="1dp"
15 + android:end="1dp"
16 + android:start="1dp"
17 + android:top="1dp">
18 + <shape android:shape="rectangle">
19 + <solid android:color="@android:color/white" />
20 + <corners android:radius="4dp" />
21 + </shape>
22 + </item>
23 +
24 +</layer-list>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3 + <item>
4 + <shape android:shape="rectangle">
5 + <gradient
6 + android:angle="180"
7 + android:endColor="@color/cos_cyan2"
8 + android:startColor="@color/cos_green7" />
9 + </shape>
10 + </item>
11 +
12 + <item android:bottom="2dp">
13 + <shape android:shape="rectangle">
14 + <solid android:color="@android:color/white" />
15 + </shape>
16 + </item>
17 +
18 +</layer-list>
...\ No newline at end of file ...\ No newline at end of file
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 <RelativeLayout 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 + xmlns:tools="http://schemas.android.com/tools"
5 + android:id="@+id/rl_analysis_payment"
5 android:layout_width="match_parent" 6 android:layout_width="match_parent"
6 - android:layout_height="match_parent"> 7 + android:layout_height="match_parent"
8 + android:background="@android:color/white">
7 9
8 <androidx.constraintlayout.widget.ConstraintLayout 10 <androidx.constraintlayout.widget.ConstraintLayout
9 - android:id="@+id/cl_bill_header" 11 + android:id="@+id/cl_loyalty_analysis_header"
10 android:layout_width="match_parent" 12 android:layout_width="match_parent"
11 - android:layout_height="80dp" 13 + android:layout_height="50dp"
12 - app:layout_constraintTop_toTopOf="parent"
13 android:background="@android:color/white"> 14 android:background="@android:color/white">
14 15
15 <ImageView 16 <ImageView
16 android:id="@+id/iv_loyalty_analysis_close" 17 android:id="@+id/iv_loyalty_analysis_close"
17 - android:layout_width="21dp" 18 + android:layout_width="20dp"
18 android:layout_height="20dp" 19 android:layout_height="20dp"
19 - android:layout_marginStart="24dp" 20 + android:layout_marginStart="16dp"
20 - android:layout_marginTop="4dp"
21 android:src="@drawable/ic_back" 21 android:src="@drawable/ic_back"
22 + app:layout_constraintBottom_toBottomOf="parent"
22 app:layout_constraintStart_toStartOf="parent" 23 app:layout_constraintStart_toStartOf="parent"
23 - app:layout_constraintTop_toTopOf="parent" 24 + app:layout_constraintTop_toTopOf="parent" />
24 - app:layout_constraintBottom_toBottomOf="parent"/>
25 25
26 <TextView 26 <TextView
27 - android:id="@+id/textView3" 27 + android:layout_width="wrap_content"
28 - android:layout_width="206dp" 28 + android:layout_height="wrap_content"
29 - android:layout_height="32dp" 29 + android:text="@string/cos_analysis"
30 - android:gravity="center"
31 - android:text="@string/cos_loyalty_analysis"
32 android:textColor="@color/grey" 30 android:textColor="@color/grey"
33 android:textSize="17sp" 31 android:textSize="17sp"
34 android:textStyle="bold" 32 android:textStyle="bold"
...@@ -37,4 +35,98 @@ ...@@ -37,4 +35,98 @@
37 app:layout_constraintStart_toStartOf="parent" 35 app:layout_constraintStart_toStartOf="parent"
38 app:layout_constraintTop_toTopOf="parent" /> 36 app:layout_constraintTop_toTopOf="parent" />
39 </androidx.constraintlayout.widget.ConstraintLayout> 37 </androidx.constraintlayout.widget.ConstraintLayout>
38 +
39 + <include
40 + android:id="@+id/cl_tab_coupon_analysis"
41 + layout="@layout/tab_coupon_analysis"
42 + android:layout_width="match_parent"
43 + android:layout_height="wrap_content"
44 + android:layout_below="@+id/cl_loyalty_analysis_header"
45 + android:layout_marginHorizontal="12dp"
46 + android:layout_marginVertical="24dp" />
47 +
48 + <ImageView
49 + android:id="@+id/iv_gift_circle_logo"
50 + android:layout_width="140dp"
51 + android:layout_height="140dp"
52 + android:layout_below="@+id/cl_tab_coupon_analysis"
53 + android:layout_centerHorizontal="true"
54 + android:src="@drawable/ic_gift_circle" />
55 +
56 + <RelativeLayout
57 + android:id="@+id/rl_expired_view"
58 + android:layout_width="match_parent"
59 + android:layout_height="wrap_content"
60 + android:layout_below="@+id/iv_gift_circle_logo"
61 + android:layout_marginTop="32dp"
62 + tools:visibility="gone">
63 +
64 + <LinearLayout
65 + android:id="@+id/ll_expired_coupons_title"
66 + android:layout_width="wrap_content"
67 + android:layout_height="wrap_content"
68 + android:layout_marginHorizontal="12dp"
69 + android:background="@drawable/banner_border_gradient">
70 +
71 + <TextView
72 + android:id="@+id/tv_expired_coupons_title"
73 + android:layout_width="wrap_content"
74 + android:layout_height="wrap_content"
75 + android:layout_marginHorizontal="32dp"
76 + android:layout_marginVertical="8dp"
77 + android:gravity="center"
78 + android:textColor="@color/cos_blue_dark"
79 + android:textSize="16sp"
80 + tools:text="@string/cos_deals_win_title" />
81 + </LinearLayout>
82 +
83 + <TextView
84 + android:id="@+id/tv_expired_title"
85 + android:layout_width="wrap_content"
86 + android:layout_height="wrap_content"
87 + android:layout_below="@+id/ll_expired_coupons_title"
88 + android:layout_centerHorizontal="true"
89 + android:layout_marginTop="32dp"
90 + android:text="@string/cos_analysis2"
91 + android:textColor="@color/cos_blue_dark"
92 + android:textSize="16sp"
93 + android:textStyle="bold" />
94 +
95 + <androidx.recyclerview.widget.RecyclerView
96 + android:id="@+id/rv_expired_coupons"
97 + android:layout_width="match_parent"
98 + android:layout_height="match_parent"
99 + android:layout_below="@+id/tv_expired_title"
100 + android:layout_marginHorizontal="8dp"
101 + android:layout_marginTop="24dp"
102 + android:orientation="vertical" />
103 + </RelativeLayout>
104 +
105 + <RelativeLayout
106 + android:id="@+id/rl_shared_view"
107 + android:layout_width="match_parent"
108 + android:layout_height="wrap_content"
109 + android:layout_below="@+id/iv_gift_circle_logo"
110 + android:layout_marginTop="32dp"
111 + android:visibility="gone">
112 +
113 + <TextView
114 + android:id="@+id/tv_shared_title"
115 + android:layout_width="wrap_content"
116 + android:layout_height="wrap_content"
117 + android:layout_centerHorizontal="true"
118 + android:text="@string/cos_analysis2"
119 + android:textColor="@color/cos_blue_dark"
120 + android:textSize="16sp"
121 + android:textStyle="bold" />
122 +
123 + <androidx.recyclerview.widget.RecyclerView
124 + android:id="@+id/rv_shared_coupons"
125 + android:layout_width="match_parent"
126 + android:layout_height="match_parent"
127 + android:layout_below="@+id/tv_shared_title"
128 + android:layout_marginHorizontal="8dp"
129 + android:layout_marginTop="24dp"
130 + android:orientation="vertical" />
131 + </RelativeLayout>
40 </RelativeLayout> 132 </RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="wrap_content"
6 + android:layout_marginBottom="32dp">
7 +
8 + <TextView
9 + android:id="@+id/tv_expired_coupons_date"
10 + android:layout_width="wrap_content"
11 + android:layout_height="wrap_content"
12 + android:textColor="@color/cos_blue_dark2"
13 + android:textSize="13sp"
14 + android:textStyle="bold"
15 + tools:text="05/05/2022" />
16 +
17 + <LinearLayout
18 + android:id="@+id/ll_expired_info_view"
19 + android:layout_width="match_parent"
20 + android:layout_height="wrap_content"
21 + android:layout_below="@+id/tv_expired_coupons_date"
22 + android:layout_marginTop="8dp"
23 + android:orientation="horizontal"
24 + android:weightSum="1">
25 +
26 + <TextView
27 + android:id="@+id/tv_expired_coupons_title"
28 + android:layout_width="0dp"
29 + android:layout_height="wrap_content"
30 + android:layout_weight="0.5"
31 + android:maxLines="2"
32 + android:textColor="@color/cos_blue_dark2"
33 + android:textFontWeight="600"
34 + android:textSize="16sp"
35 + tools:text="Box" />
36 +
37 + <TextView
38 + android:id="@+id/tv_expired_coupons_value"
39 + android:layout_width="wrap_content"
40 + android:layout_height="wrap_content"
41 + android:layout_weight="0.5"
42 + android:gravity="end"
43 + android:textColor="@color/cos_blue_dark2"
44 + android:textSize="16sp"
45 + android:textStyle="bold"
46 + tools:text="4$" />
47 + </LinearLayout>
48 +
49 + <TextView
50 + android:id="@+id/tv_expired_coupons_label"
51 + android:layout_width="wrap_content"
52 + android:layout_height="wrap_content"
53 + android:layout_below="@+id/ll_expired_info_view"
54 + android:text="@string/cos_expired_coupon_label"
55 + android:textColor="@color/cos_light_grey2"
56 + android:textSize="16sp" />
57 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="wrap_content"
6 + android:layout_marginBottom="32dp">
7 +
8 + <TextView
9 + android:id="@+id/tv_shared_coupons_date"
10 + android:layout_width="wrap_content"
11 + android:layout_height="wrap_content"
12 + android:textColor="@color/cos_blue_dark2"
13 + android:textSize="13sp"
14 + android:textStyle="bold"
15 + tools:text="05/05/2022" />
16 +
17 + <LinearLayout
18 + android:id="@+id/ll_expired_info_view"
19 + android:layout_width="match_parent"
20 + android:layout_height="wrap_content"
21 + android:layout_below="@+id/tv_shared_coupons_date"
22 + android:layout_marginTop="8dp"
23 + android:orientation="horizontal"
24 + android:weightSum="1">
25 +
26 + <TextView
27 + android:id="@+id/tv_shared_coupons_title"
28 + android:layout_width="0dp"
29 + android:layout_height="wrap_content"
30 + android:layout_weight="0.5"
31 + android:maxLines="2"
32 + android:textColor="@color/cos_blue_dark2"
33 + android:textFontWeight="600"
34 + android:textSize="16sp"
35 + tools:text="Box" />
36 +
37 + <TextView
38 + android:id="@+id/tv_shared_coupons_value"
39 + android:layout_width="wrap_content"
40 + android:layout_height="wrap_content"
41 + android:layout_weight="0.5"
42 + android:gravity="end"
43 + android:textColor="@color/cos_blue_dark2"
44 + android:textSize="16sp"
45 + android:textStyle="bold"
46 + tools:text="4$" />
47 + </LinearLayout>
48 +
49 + <TextView
50 + android:id="@+id/tv_shared_coupons_label"
51 + android:layout_width="wrap_content"
52 + android:layout_height="wrap_content"
53 + android:layout_below="@+id/ll_expired_info_view"
54 + android:textColor="@color/cos_light_grey2"
55 + android:textSize="16sp"
56 + tools:text="@string/cos_expired_coupon_label" />
57 +
58 + <TextView
59 + android:id="@+id/tv_shared_coupons_phone"
60 + android:layout_width="wrap_content"
61 + android:layout_height="wrap_content"
62 + android:layout_below="@+id/tv_shared_coupons_label"
63 + android:textColor="@color/cos_light_grey2"
64 + android:textSize="16sp"
65 + tools:text="@string/cos_expired_coupon_label" />
66 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:layout_height="wrap_content"
5 + android:orientation="horizontal"
6 + android:weightSum="1">
7 +
8 + <LinearLayout
9 + android:id="@+id/ll_tab_expired"
10 + android:layout_width="wrap_content"
11 + android:layout_height="32dp"
12 + android:layout_weight="0.2"
13 + android:background="@drawable/bottom_border_gradient2"
14 + android:gravity="center_horizontal">
15 +
16 + <TextView
17 + android:id="@+id/tv_expired_tab"
18 + android:layout_width="wrap_content"
19 + android:layout_height="wrap_content"
20 + android:text="@string/cos_redeemed_coupons_tab"
21 + android:textColor="@color/cos_cyan4"
22 + android:textSize="14sp"
23 + android:textStyle="bold" />
24 + </LinearLayout>
25 +
26 + <LinearLayout
27 + android:id="@+id/ll_tab_shared"
28 + android:layout_width="wrap_content"
29 + android:layout_height="32dp"
30 + android:layout_weight="0.2"
31 + android:background="@drawable/bottom_border_transparent"
32 + android:gravity="center_horizontal">
33 +
34 + <TextView
35 + android:id="@+id/tv_shared_tab"
36 + android:layout_width="wrap_content"
37 + android:layout_height="wrap_content"
38 + android:text="@string/cos_shared_gifts_tab"
39 + android:textColor="@color/cos_dark_grey"
40 + android:textSize="14sp" />
41 + </LinearLayout>
42 +</LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -50,4 +50,9 @@ ...@@ -50,4 +50,9 @@
50 <color name="cos_grey_tr">#00000029</color> 50 <color name="cos_grey_tr">#00000029</color>
51 <color name="cos_grey7">#C0C7CD</color> 51 <color name="cos_grey7">#C0C7CD</color>
52 <color name="cos_grey8">#AEAEAE</color> 52 <color name="cos_grey8">#AEAEAE</color>
53 + <color name="cos_blue_dark">#3C4F5E</color>
54 + <color name="cos_blue_dark2">#435563</color>
55 + <color name="cos_light_grey2">#8B97A3</color>
56 + <color name="cos_cyan4">#2EAFB9</color>
57 + <color name="cos_dark_grey">#394A5B</color>
53 </resources> 58 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
54 <string name="cos_monthly">Μηνιαία</string> 54 <string name="cos_monthly">Μηνιαία</string>
55 <string name="cos_six_months">6Μηνο</string> 55 <string name="cos_six_months">6Μηνο</string>
56 <string name="cos_annual">12Μηνο</string> 56 <string name="cos_annual">12Μηνο</string>
57 - <string name="cos_analysis2">Αναλυτικά</string> 57 + <string name="cos_analysis2">Αναλυτικά:</string>
58 <string name="euro"></string> 58 <string name="euro"></string>
59 <string name="cos_profile_questionnaire">Ερωτηματολόγιο</string> 59 <string name="cos_profile_questionnaire">Ερωτηματολόγιο</string>
60 <string name="cos_active_all_coupons">Ενεργά κουπόνια</string> 60 <string name="cos_active_all_coupons">Ενεργά κουπόνια</string>
...@@ -108,6 +108,11 @@ ...@@ -108,6 +108,11 @@
108 <string name="cos_dlg_activate_telco_subtitle">Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;</string> 108 <string name="cos_dlg_activate_telco_subtitle">Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;</string>
109 <string name="cos_dlg_activate_success_title">Το αίτημά σου ολοκληρώθηκε επιτυχώς!</string> 109 <string name="cos_dlg_activate_success_title">Το αίτημά σου ολοκληρώθηκε επιτυχώς!</string>
110 <string name="cos_dlg_activate_success_subtitle">Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου.</string> 110 <string name="cos_dlg_activate_success_subtitle">Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου.</string>
111 + <string name="cos_expired_coupon_label">Εκπτωτικό κουπόνι</string>
112 + <string name="cos_redeemed_coupons_tab">Εξαργυρωμένα</string>
113 + <string name="cos_shared_gifts_tab">Μοιρασμένα δώρα</string>
114 + <string name="cos_shared_coupon_receiver">Εκπτωτικό κουπόνι προς</string>
115 + <string name="cos_shared_coupon_sender">Έκπτωτικό κουπόνι από</string>
111 116
112 <string-array name="coupons_array"> 117 <string-array name="coupons_array">
113 <item>Κουπόνια</item> 118 <item>Κουπόνια</item>
......