Panagiotis Triantafyllou

native telco flow wip

...@@ -103,6 +103,11 @@ ...@@ -103,6 +103,11 @@
103 android:screenOrientation="portrait" /> 103 android:screenOrientation="portrait" />
104 104
105 <activity 105 <activity
106 + android:name="ly.warp.sdk.activities.TelcoActivity"
107 + android:exported="false"
108 + android:screenOrientation="portrait" />
109 +
110 + <activity
106 android:name="ly.warp.sdk.dexter.PermissionsActivity" 111 android:name="ly.warp.sdk.dexter.PermissionsActivity"
107 android:exported="false" 112 android:exported="false"
108 android:launchMode="singleInstance" 113 android:launchMode="singleInstance"
......
...@@ -71,7 +71,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -71,7 +71,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
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("el"), mCampaignsCallback); 74 +// WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
75 } 75 }
76 }).start(); 76 }).start();
77 } 77 }
......
...@@ -179,6 +179,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -179,6 +179,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
179 try { 179 try {
180 JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); 180 JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields());
181 if (extraFields != null) { 181 if (extraFields != null) {
182 + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
183 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
184 + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
185 + Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
186 + intent.putExtra("ccms", ccms);
187 + startActivity(intent);
188 + break;
189 + }
190 + }
191 + return;
192 + }
182 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 193 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
183 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 194 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
184 if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { 195 if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
...@@ -260,6 +271,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -260,6 +271,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
260 try { 271 try {
261 JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); 272 JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields());
262 if (extraFields != null) { 273 if (extraFields != null) {
274 + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
275 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
276 + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
277 + Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
278 + intent.putExtra("ccms", ccms);
279 + startActivity(intent);
280 + break;
281 + }
282 + }
283 + return;
284 + }
263 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 285 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
264 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 286 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
265 if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { 287 if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
......
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.content.Intent;
4 import android.os.Bundle; 5 import android.os.Bundle;
5 import android.util.Log; 6 import android.util.Log;
6 import android.view.View; 7 import android.view.View;
...@@ -122,6 +123,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -122,6 +123,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
122 try { 123 try {
123 JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); 124 JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields());
124 if (extraFields != null) { 125 if (extraFields != null) {
126 + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
127 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
128 + if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) {
129 + Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class);
130 + intent.putExtra("ccms", ccms);
131 + startActivity(intent);
132 + break;
133 + }
134 + }
135 + return;
136 + }
125 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 137 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
126 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 138 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
127 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { 139 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) {
...@@ -172,6 +184,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -172,6 +184,17 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
172 try { 184 try {
173 JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); 185 JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields());
174 if (extraFields != null) { 186 if (extraFields != null) {
187 + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
188 + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
189 + if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) {
190 + Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class);
191 + intent.putExtra("ccms", ccms);
192 + startActivity(intent);
193 + break;
194 + }
195 + }
196 + return;
197 + }
175 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 198 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
176 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 199 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
177 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { 200 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) {
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.os.Bundle;
5 +import android.text.TextUtils;
6 +import android.view.View;
7 +import android.widget.ImageView;
8 +import android.widget.LinearLayout;
9 +import android.widget.TextView;
10 +
11 +import com.bumptech.glide.Glide;
12 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
13 +
14 +import ly.warp.sdk.R;
15 +import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
16 +
17 +
18 +public class TelcoActivity extends Activity implements View.OnClickListener {
19 +
20 + // ===========================================================
21 + // Constants
22 + // ===========================================================
23 +
24 + // ===========================================================
25 + // Fields
26 + // ===========================================================
27 +
28 + private ImageView mIvBack, mIvCampaignPhoto;
29 + private TextView mTvCampaignTitle, mTvCampaignSubtitle;
30 + private LoyaltyContextualOfferModel mCCMS;
31 + private LinearLayout mLlActivateOffer;
32 +
33 + // ===========================================================
34 + // Methods for/from SuperClass/Interfaces
35 + // ===========================================================
36 +
37 + @Override
38 + public void onCreate(Bundle savedInstanceState) {
39 + super.onCreate(savedInstanceState);
40 + setContentView(R.layout.activity_telco);
41 +
42 + mCCMS = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms");
43 +
44 + mIvBack = findViewById(R.id.iv_telco_back);
45 + mTvCampaignTitle = findViewById(R.id.textView13);
46 + mIvCampaignPhoto = findViewById(R.id.imageView6);
47 + mTvCampaignSubtitle = findViewById(R.id.textView14);
48 + mLlActivateOffer = findViewById(R.id.ll_activate_button);
49 +
50 + initViews();
51 + }
52 +
53 + @Override
54 + public void onResume() {
55 + super.onResume();
56 + }
57 +
58 + @Override
59 + public void onClick(View view) {
60 + if (view.getId() == R.id.iv_telco_back) {
61 + onBackPressed();
62 + return;
63 + }
64 + if (view.getId() == R.id.ll_activate_button) {
65 + //TODO: make submitOrder
66 + }
67 + }
68 +
69 + // ===========================================================
70 + // Methods
71 + // ===========================================================
72 +
73 + private void initViews() {
74 + mTvCampaignTitle.setText(mCCMS.getTitle());
75 + mTvCampaignSubtitle.setText(mCCMS.getSubtitle());
76 +
77 + if (!TextUtils.isEmpty(mCCMS.getImageUrl())) {
78 + Glide.with(this)
79 +// .setDefaultRequestOptions(
80 +// RequestOptions
81 +// .placeholderOf(R.drawable.ic_default_contact_photo)
82 +// .error(R.drawable.ic_default_contact_photo))
83 + .load(mCCMS.getImageUrl())
84 + .diskCacheStrategy(DiskCacheStrategy.DATA)
85 + .into(mIvCampaignPhoto);
86 + } else {
87 + Glide.with(this)
88 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
89 + .into(mIvCampaignPhoto);
90 + }
91 + mIvBack.setOnClickListener(this);
92 + mLlActivateOffer.setOnClickListener(this);
93 + }
94 +
95 + // ===========================================================
96 + // Inner and Anonymous Classes
97 + // ===========================================================
98 +
99 +}
...@@ -3,13 +3,14 @@ package ly.warp.sdk.io.models; ...@@ -3,13 +3,14 @@ package ly.warp.sdk.io.models;
3 import org.json.JSONArray; 3 import org.json.JSONArray;
4 import org.json.JSONObject; 4 import org.json.JSONObject;
5 5
6 +import java.io.Serializable;
6 import java.util.ArrayList; 7 import java.util.ArrayList;
7 8
8 /** 9 /**
9 * Created by Panagiotis Triantafyllou on 20/Απρ/2022. 10 * Created by Panagiotis Triantafyllou on 20/Απρ/2022.
10 */ 11 */
11 12
12 -public class LoyaltyContextualOfferModel { 13 +public class LoyaltyContextualOfferModel implements Serializable {
13 private String sessionId; 14 private String sessionId;
14 private ArrayList<String> eligibleAssets; 15 private ArrayList<String> eligibleAssets;
15 private String id; 16 private String id;
...@@ -115,6 +116,10 @@ public class LoyaltyContextualOfferModel { ...@@ -115,6 +116,10 @@ public class LoyaltyContextualOfferModel {
115 this.wave = jobj.optString("wave"); 116 this.wave = jobj.optString("wave");
116 this.validity = jobj.optString("validity"); 117 this.validity = jobj.optString("validity");
117 this.offerAudienceLevel = jobj.optString("offerAudienceLevel"); 118 this.offerAudienceLevel = jobj.optString("offerAudienceLevel");
119 + this.imageUrl = jobj.optString("imageUrl");
120 + this.title = jobj.optString("title");
121 + this.subtitle = jobj.optString("subtitle");
122 + this.description = jobj.optString("description");
118 } 123 }
119 } 124 }
120 125
......
...@@ -129,7 +129,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte ...@@ -129,7 +129,7 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte
129 else 129 else
130 holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); 130 holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : "")));
131 131
132 - holder.tvCouponValue.setText(couponItem.getDiscount()); 132 + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro));
133 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); 133 holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem));
134 } 134 }
135 } 135 }
......
1 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 + xmlns:app="http://schemas.android.com/apk/res-auto"
3 + xmlns:tools="http://schemas.android.com/tools"
4 + android:layout_width="match_parent"
5 + android:layout_height="match_parent"
6 + android:background="@android:color/white">
7 +
8 + <androidx.constraintlayout.widget.ConstraintLayout
9 + android:id="@+id/cl_loyalty_wallet_header"
10 + android:layout_width="match_parent"
11 + android:layout_height="50dp"
12 + android:background="@android:color/white">
13 +
14 + <ImageView
15 + android:id="@+id/iv_telco_back"
16 + android:layout_width="20dp"
17 + android:layout_height="20dp"
18 + android:layout_marginStart="16dp"
19 + android:src="@drawable/ic_back"
20 + app:layout_constraintBottom_toBottomOf="parent"
21 + app:layout_constraintStart_toStartOf="parent"
22 + app:layout_constraintTop_toTopOf="parent" />
23 +
24 + <TextView
25 + android:layout_width="wrap_content"
26 + android:layout_height="wrap_content"
27 + android:textColor="@color/grey"
28 + android:textSize="17sp"
29 + android:textStyle="bold"
30 + app:layout_constraintBottom_toBottomOf="parent"
31 + app:layout_constraintEnd_toEndOf="parent"
32 + app:layout_constraintStart_toStartOf="parent"
33 + app:layout_constraintTop_toTopOf="parent" />
34 + </androidx.constraintlayout.widget.ConstraintLayout>
35 +
36 + <ScrollView
37 + android:layout_width="match_parent"
38 + android:layout_height="match_parent"
39 + android:fillViewport="true"
40 + android:layout_below="@+id/cl_loyalty_wallet_header">
41 +
42 + <androidx.constraintlayout.widget.ConstraintLayout
43 + android:layout_width="match_parent"
44 + android:layout_height="match_parent"
45 + android:background="@android:color/white">
46 +
47 + <androidx.constraintlayout.widget.ConstraintLayout
48 + android:id="@+id/cl_loyalty_info_view_inner"
49 + android:layout_width="match_parent"
50 + android:layout_height="match_parent"
51 + android:background="@drawable/shape_cos_loyalty_white"
52 + android:paddingBottom="48dp"
53 + app:layout_constraintEnd_toEndOf="parent"
54 + app:layout_constraintStart_toStartOf="parent"
55 + app:layout_constraintTop_toTopOf="parent">
56 +
57 + <com.github.siyamed.shapeimageview.mask.PorterShapeImageView
58 + android:id="@+id/imageView6"
59 + android:layout_width="match_parent"
60 + android:layout_height="224dp"
61 + android:layout_marginTop="4dp"
62 + android:scaleType="centerCrop"
63 + app:layout_constraintStart_toStartOf="parent"
64 + app:layout_constraintTop_toTopOf="parent"
65 + app:siShape="@drawable/shape_top_left_rounded"
66 + tools:src="@drawable/carousel_banner" />
67 +
68 + <TextView
69 + android:id="@+id/textView13"
70 + android:layout_width="match_parent"
71 + android:layout_height="wrap_content"
72 + android:layout_marginTop="32dp"
73 + android:gravity="center"
74 + android:paddingHorizontal="32dp"
75 + android:textColor="#415564"
76 + android:textSize="18sp"
77 + android:textStyle="bold"
78 + app:layout_constraintEnd_toEndOf="parent"
79 + app:layout_constraintHorizontal_bias="0.509"
80 + app:layout_constraintStart_toStartOf="parent"
81 + app:layout_constraintTop_toBottomOf="@+id/imageView6"
82 + tools:text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" />
83 +
84 + <TextView
85 + android:id="@+id/textView14"
86 + android:layout_width="match_parent"
87 + android:layout_height="wrap_content"
88 + android:layout_marginTop="16dp"
89 + android:gravity="center"
90 + android:paddingHorizontal="32dp"
91 + android:textColor="#415564"
92 + android:textSize="16sp"
93 + app:layout_constraintEnd_toEndOf="parent"
94 + app:layout_constraintStart_toStartOf="parent"
95 + app:layout_constraintTop_toBottomOf="@+id/textView13" />
96 +
97 + <LinearLayout
98 + android:id="@+id/ll_activate_button"
99 + android:layout_width="wrap_content"
100 + android:layout_height="wrap_content"
101 + android:layout_marginHorizontal="32dp"
102 + android:background="@drawable/selector_button_green"
103 + android:gravity="center"
104 + android:orientation="horizontal"
105 + android:paddingHorizontal="16dp"
106 + android:paddingVertical="8dp"
107 + app:layout_constraintBottom_toBottomOf="parent"
108 + app:layout_constraintEnd_toEndOf="parent"
109 + app:layout_constraintStart_toStartOf="parent">
110 +
111 + <TextView
112 + android:layout_width="wrap_content"
113 + android:layout_height="wrap_content"
114 + android:gravity="center"
115 + android:text="@string/cos_dlg_positive_button"
116 + android:textColor="@color/white"
117 + android:textFontWeight="600"
118 + android:textSize="17dp" />
119 + </LinearLayout>
120 +
121 + </androidx.constraintlayout.widget.ConstraintLayout>
122 + </androidx.constraintlayout.widget.ConstraintLayout>
123 + </ScrollView>
124 +</RelativeLayout>