Panagiotis Triantafyllou

new version

...@@ -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-cosbeta21' 5 + PUBLISH_VERSION = '4.5.4-cosbeta22'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
...@@ -56,6 +56,8 @@ dependencies { ...@@ -56,6 +56,8 @@ dependencies {
56 //------------------------------ GMS -----------------------------// 56 //------------------------------ GMS -----------------------------//
57 api 'com.google.android.gms:play-services-base:18.0.1' 57 api 'com.google.android.gms:play-services-base:18.0.1'
58 api 'com.google.android.gms:play-services-location:19.0.1' 58 api 'com.google.android.gms:play-services-location:19.0.1'
59 + api 'com.google.android.gms:play-services-maps:18.0.2'
60 + api 'com.google.maps.android:android-maps-utils:0.5'
59 61
60 //------------------------------ Work Manager -----------------------------// 62 //------------------------------ Work Manager -----------------------------//
61 api 'androidx.work:work-runtime:2.7.1' 63 api 'androidx.work:work-runtime:2.7.1'
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
10 10
11 <application> 11 <application>
12 + <meta-data
13 + android:name="com.google.android.geo.API_KEY"
14 + android:value="@string/google_maps_key" />
15 +
12 <!-- For Huawei Push --> 16 <!-- For Huawei Push -->
13 <meta-data 17 <meta-data
14 android:name="push_kit_auto_init_enabled" 18 android:name="push_kit_auto_init_enabled"
...@@ -89,6 +93,16 @@ ...@@ -89,6 +93,16 @@
89 android:screenOrientation="portrait" /> 93 android:screenOrientation="portrait" />
90 94
91 <activity 95 <activity
96 + android:name="ly.warp.sdk.activities.ShopsActivity"
97 + android:exported="false"
98 + android:screenOrientation="portrait" />
99 +
100 + <activity
101 + android:name="ly.warp.sdk.activities.CouponShareActivity"
102 + android:exported="false"
103 + android:screenOrientation="portrait" />
104 +
105 + <activity
92 android:name="ly.warp.sdk.dexter.PermissionsActivity" 106 android:name="ly.warp.sdk.dexter.PermissionsActivity"
93 android:exported="false" 107 android:exported="false"
94 android:launchMode="singleInstance" 108 android:launchMode="singleInstance"
......
...@@ -75,6 +75,7 @@ import ly.warp.sdk.utils.ObjectSerializer; ...@@ -75,6 +75,7 @@ import ly.warp.sdk.utils.ObjectSerializer;
75 import ly.warp.sdk.utils.WarpUtils; 75 import ly.warp.sdk.utils.WarpUtils;
76 import ly.warp.sdk.utils.WarplyDeviceInfoCollector; 76 import ly.warp.sdk.utils.WarplyDeviceInfoCollector;
77 import ly.warp.sdk.utils.WarplyInitializer; 77 import ly.warp.sdk.utils.WarplyInitializer;
78 +import ly.warp.sdk.utils.WarplyManagerHelper;
78 import ly.warp.sdk.utils.WarplyPreferences; 79 import ly.warp.sdk.utils.WarplyPreferences;
79 import ly.warp.sdk.utils.WarplyProperty; 80 import ly.warp.sdk.utils.WarplyProperty;
80 import ly.warp.sdk.utils.constants.WarpConstants; 81 import ly.warp.sdk.utils.constants.WarpConstants;
...@@ -476,6 +477,7 @@ public enum Warply { ...@@ -476,6 +477,7 @@ public enum Warply {
476 477
477 INSTANCE.mLastReceivedCampaigns = result; 478 INSTANCE.mLastReceivedCampaigns = result;
478 if (receiver != null) { 479 if (receiver != null) {
480 + WarplyManagerHelper.setUniqueCampaignList(result);
479 receiver.onSuccess(result); 481 receiver.onSuccess(result);
480 } 482 }
481 } 483 }
......
...@@ -194,8 +194,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -194,8 +194,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
194 } 194 }
195 } 195 }
196 196
197 - WarplyManagerHelper.setUniqueCampaignList(result);
198 -
199 // Thread.currentThread().interrupt(); 197 // Thread.currentThread().interrupt();
200 198
201 WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest() 199 WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest()
......
...@@ -24,6 +24,8 @@ import java.util.Date; ...@@ -24,6 +24,8 @@ import java.util.Date;
24 24
25 import ly.warp.sdk.R; 25 import ly.warp.sdk.R;
26 import ly.warp.sdk.io.models.Coupon; 26 import ly.warp.sdk.io.models.Coupon;
27 +import ly.warp.sdk.io.models.Couponset;
28 +import ly.warp.sdk.utils.WarplyManagerHelper;
27 29
28 30
29 public class CouponInfoActivity extends Activity implements View.OnClickListener { 31 public class CouponInfoActivity extends Activity implements View.OnClickListener {
...@@ -37,9 +39,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -37,9 +39,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
37 // =========================================================== 39 // ===========================================================
38 40
39 private ImageView mIvBack, mIvCouponPhoto, mIvBarcode; 41 private ImageView mIvBack, mIvCouponPhoto, mIvBarcode;
40 - private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate, mTvBarcodeCode; 42 + private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate;
41 private LinearLayout mLlGiftIt, mLlShops; 43 private LinearLayout mLlGiftIt, mLlShops;
42 private Coupon mCoupon; 44 private Coupon mCoupon;
45 + private Couponset mCouponset;
43 46
44 // =========================================================== 47 // ===========================================================
45 // Methods for/from SuperClass/Interfaces 48 // Methods for/from SuperClass/Interfaces
...@@ -78,16 +81,15 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -78,16 +81,15 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
78 return; 81 return;
79 } 82 }
80 if (view.getId() == R.id.ll_gift_it) { 83 if (view.getId() == R.id.ll_gift_it) {
81 - Intent intent = new Intent(android.content.Intent.ACTION_SEND); 84 + Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class);
82 - intent.setType("text/plain"); 85 + intent.putExtra("coupon", (Serializable) mCoupon);
83 - intent.putExtra(android.content.Intent.EXTRA_TEXT, "Link: https://cosmote.page.link /referal\n\nΧρησιμοποίησε τον κωδικό " + mTvCouponCode.getText().toString() + " για εκπτωτικό κουπόνι 4€ στο BOX: XMAS4"); 86 + startActivity(intent);
84 - startActivity(Intent.createChooser(intent, "Άνοιγμα με"));
85 return; 87 return;
86 } 88 }
87 if (view.getId() == R.id.ll_shops) { 89 if (view.getId() == R.id.ll_shops) {
88 -// Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class); 90 + Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class);
89 -// intent.putExtra("coupon", (Serializable) mCoupon); 91 + intent.putExtra("couponset", (Serializable) mCouponset);
90 -// startActivity(intent); 92 + startActivity(intent);
91 } 93 }
92 } 94 }
93 95
...@@ -100,6 +102,15 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -100,6 +102,15 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
100 mTvCouponTitle.setText(mCoupon.getName()); 102 mTvCouponTitle.setText(mCoupon.getName());
101 mTvCouponSubtitle.setText(mCoupon.getDescription()); 103 mTvCouponSubtitle.setText(mCoupon.getDescription());
102 104
105 + if (WarplyManagerHelper.getCouponsets() != null && WarplyManagerHelper.getCouponsets().size() > 0) {
106 + for (Couponset couponset : WarplyManagerHelper.getCouponsets()) {
107 + if (couponset.getUuid().equals(mCoupon.getCouponsetUuid())) {
108 + mCouponset = couponset;
109 + break;
110 + }
111 + }
112 + }
113 +
103 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 114 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
104 Date newDate = new Date(); 115 Date newDate = new Date();
105 try { 116 try {
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.app.Dialog;
5 +import android.os.Bundle;
6 +import android.text.TextUtils;
7 +import android.util.Log;
8 +import android.view.View;
9 +import android.widget.ImageView;
10 +import android.widget.LinearLayout;
11 +import android.widget.TextView;
12 +
13 +import com.bumptech.glide.Glide;
14 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
15 +
16 +import ly.warp.sdk.R;
17 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
18 +import ly.warp.sdk.io.models.Consumer;
19 +import ly.warp.sdk.io.models.Coupon;
20 +import ly.warp.sdk.io.request.WarplyConsumerRequest;
21 +import ly.warp.sdk.utils.managers.WarplyManager;
22 +
23 +
24 +public class CouponShareActivity extends Activity implements View.OnClickListener {
25 +
26 + // ===========================================================
27 + // Constants
28 + // ===========================================================
29 +
30 + // ===========================================================
31 + // Fields
32 + // ===========================================================
33 +
34 + private ImageView mIvBack, mIvCouponPhoto;
35 + private TextView mTvCouponTitle;
36 + private Coupon mCoupon;
37 + private Consumer mConsumer;
38 +
39 + // ===========================================================
40 + // Methods for/from SuperClass/Interfaces
41 + // ===========================================================
42 +
43 + @Override
44 + public void onCreate(Bundle savedInstanceState) {
45 + super.onCreate(savedInstanceState);
46 + setContentView(R.layout.activity_coupon_share);
47 +
48 + mCoupon = (Coupon) getIntent().getSerializableExtra("coupon");
49 +
50 + mIvBack = findViewById(R.id.iv_coupon_share_back);
51 + mTvCouponTitle = findViewById(R.id.textView13);
52 + mIvCouponPhoto = findViewById(R.id.imageView6);
53 +
54 + initViews();
55 + }
56 +
57 + @Override
58 + public void onResume() {
59 + super.onResume();
60 +
61 + new Thread(() -> {
62 + if (!Thread.currentThread().isInterrupted()) {
63 + WarplyManager.getConsumer(new WarplyConsumerRequest()
64 + , mConsumerCallback);
65 + }
66 + Thread.currentThread().interrupt();
67 + }).start();
68 + }
69 +
70 + @Override
71 + public void onClick(View view) {
72 + if (view.getId() == R.id.iv_coupon_share_back) {
73 + onBackPressed();
74 + return;
75 + }
76 +// if (view.getId() == R.id.ll_gift_it) {
77 +// showSharingDialog();
78 +// return;
79 +// }
80 + }
81 +
82 + // ===========================================================
83 + // Methods
84 + // ===========================================================
85 +
86 + private void initViews() {
87 + mTvCouponTitle.setText(mCoupon.getName());
88 +
89 + if (!TextUtils.isEmpty(mCoupon.getImage())) {
90 + Glide.with(this)
91 +// .setDefaultRequestOptions(
92 +// RequestOptions
93 +// .placeholderOf(R.drawable.ic_default_contact_photo)
94 +// .error(R.drawable.ic_default_contact_photo))
95 + .load(mCoupon.getImage())
96 + .diskCacheStrategy(DiskCacheStrategy.DATA)
97 + .into(mIvCouponPhoto);
98 + } else {
99 + Glide.with(this)
100 + .load(R.drawable.ic_cosmote_logo_horizontal_grey)
101 + .into(mIvCouponPhoto);
102 + }
103 + mIvBack.setOnClickListener(this);
104 + }
105 +
106 + private void showSharingDialog() {
107 + Dialog dialog = new Dialog(this, R.style.PopUpDialog);
108 + dialog.setContentView(R.layout.dl_dialog);
109 + dialog.getWindow().setBackgroundDrawableResource(R.drawable.banner_border_white);
110 + dialog.show();
111 +
112 +// TextView mTvDlTitle = dialog.findViewById(R.id.tv_dl_subtitle);
113 +// LinearLayout mLlRedeem = dialog.findViewById(R.id.ll_dl_redeem);
114 +//
115 +// mTvDlTitle.setText(String.format(getResources().getString(R.string.cos_dl_title), parameter));
116 +
117 +// mLlRedeem.setOnClickListener(view -> {
118 +// if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) {
119 +// if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) {
120 +// startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(mUniqueCampaignList.get("lucky_draw").get(0))));
121 +// dialog.dismiss();
122 +// }
123 +// }
124 +// });
125 + }
126 +
127 + private final CallbackReceiver<Consumer> mConsumerCallback = new CallbackReceiver<Consumer>() {
128 + @Override
129 + public void onSuccess(Consumer result) {
130 + mConsumer = result;
131 + }
132 +
133 + @Override
134 + public void onFailure(int errorCode) {
135 + Log.v("COUPON_SHARE_ACTIVITY", String.valueOf(errorCode));
136 + }
137 + };
138 +
139 + // ===========================================================
140 + // Inner and Anonymous Classes
141 + // ===========================================================
142 +
143 +}
1 +package ly.warp.sdk.activities;
2 +
3 +import android.Manifest;
4 +import android.content.pm.PackageManager;
5 +import android.os.Bundle;
6 +import android.os.Handler;
7 +import android.os.Looper;
8 +import android.util.Log;
9 +import android.view.View;
10 +import android.widget.ImageView;
11 +
12 +import androidx.annotation.NonNull;
13 +import androidx.core.app.ActivityCompat;
14 +import androidx.core.content.ContextCompat;
15 +import androidx.fragment.app.FragmentActivity;
16 +
17 +import com.google.android.gms.maps.CameraUpdate;
18 +import com.google.android.gms.maps.CameraUpdateFactory;
19 +import com.google.android.gms.maps.GoogleMap;
20 +import com.google.android.gms.maps.OnMapReadyCallback;
21 +import com.google.android.gms.maps.SupportMapFragment;
22 +import com.google.maps.android.clustering.Cluster;
23 +import com.google.maps.android.clustering.ClusterManager;
24 +
25 +import java.util.ArrayList;
26 +
27 +import ly.warp.sdk.R;
28 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
29 +import ly.warp.sdk.io.models.Couponset;
30 +import ly.warp.sdk.io.models.Merchant;
31 +import ly.warp.sdk.io.models.MerchantList;
32 +import ly.warp.sdk.io.request.WarplyMerchantsRequest;
33 +import ly.warp.sdk.utils.constants.WarpConstants;
34 +import ly.warp.sdk.utils.managers.WarplyManager;
35 +
36 +
37 +public class ShopsActivity extends FragmentActivity implements View.OnClickListener,
38 + OnMapReadyCallback, GoogleMap.OnMapLoadedCallback, ClusterManager.OnClusterClickListener<Merchant> {
39 +
40 + // ===========================================================
41 + // Constants
42 + // ===========================================================
43 +
44 + public final static float DEFAULT_LOCATION_ZOOM = 6.2f;
45 +
46 + // ===========================================================
47 + // Fields
48 + // ===========================================================
49 +
50 + private ImageView mIvBack;
51 + private Couponset mCouponset;
52 + private GoogleMap mMap;
53 + private ClusterManager<Merchant> mClusterManager;
54 + SupportMapFragment mMapView;
55 +
56 + // ===========================================================
57 + // Methods for/from SuperClass/Interfaces
58 + // ===========================================================
59 +
60 + @Override
61 + public void onCreate(Bundle savedInstanceState) {
62 + super.onCreate(savedInstanceState);
63 + setContentView(R.layout.activity_shops);
64 +
65 + mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
66 +
67 + mIvBack = findViewById(R.id.iv_shops_back);
68 + mMapView = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mv_shops);
69 + mMapView.getMapAsync(this);
70 + }
71 +
72 + @Override
73 + public void onResume() {
74 + super.onResume();
75 + }
76 +
77 + @Override
78 + public void onClick(View view) {
79 + if (view.getId() == R.id.iv_shops_back) {
80 + onBackPressed();
81 + }
82 + }
83 +
84 + @Override
85 + public void onMapReady(@NonNull GoogleMap googleMap) {
86 + mMap = googleMap;
87 +
88 + if (ActivityCompat.checkSelfPermission(this,
89 + Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
90 + && ActivityCompat.checkSelfPermission(this,
91 + Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
92 + if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
93 + mMap.setMyLocationEnabled(true);
94 + }
95 + } else {
96 + mMap.setMyLocationEnabled(false);
97 + }
98 +
99 + mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
100 + mMap.setMinZoomPreference(DEFAULT_LOCATION_ZOOM);
101 + mMap.setLatLngBoundsForCameraTarget(WarpConstants.GREECE_BOUNDS);
102 + mMap.getUiSettings().setZoomControlsEnabled(true);
103 + mMap.getUiSettings().setZoomGesturesEnabled(true);
104 + mMap.getUiSettings().setCompassEnabled(false);
105 + mMap.getUiSettings().setMyLocationButtonEnabled(false);
106 + mMap.getUiSettings().setMapToolbarEnabled(false);
107 + mMap.getUiSettings().setTiltGesturesEnabled(false);
108 + mMap.getUiSettings().setRotateGesturesEnabled(false);
109 + mMap.setOnMapLoadedCallback(this);
110 + }
111 +
112 + @Override
113 + public void onMapLoaded() {
114 + if (mMap != null) {
115 + CameraUpdate camUpdate;
116 + camUpdate = CameraUpdateFactory.newLatLngBounds(WarpConstants.GREECE_BOUNDS, 48);
117 + mMap.animateCamera(camUpdate);
118 + }
119 +
120 + if (mClusterManager == null) {
121 + mClusterManager = new ClusterManager<>(this, mMap);
122 + mClusterManager.setOnClusterClickListener(this);
123 + mMap.setOnMarkerClickListener(mClusterManager);
124 + }
125 +
126 + if (mCouponset != null) {
127 + ArrayList<String> uuids = new ArrayList<>();
128 + uuids.add(mCouponset.getMerchantUuid());
129 + new Thread(() -> {
130 + if (!Thread.currentThread().isInterrupted()) {
131 + WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
132 + .setIsMultilingual(true)
133 + .setParentUuids(uuids)
134 + , mMerchantsCallback);
135 + }
136 + Thread.currentThread().interrupt();
137 + }).start();
138 + }
139 + }
140 +
141 + @Override
142 + public boolean onClusterClick(Cluster<Merchant> cluster) {
143 + if (mMap != null) {
144 + mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(cluster.getPosition(),
145 + (float) Math.floor(mMap.getCameraPosition().zoom + 1)), 300, null);
146 +
147 +// mMap.clear();
148 +// mClusterManager.clearItems();
149 +// mClusterManager.addItems(cluster.getItems());
150 +// mClusterManager.cluster();
151 + }
152 + return true;
153 + }
154 +
155 +
156 + // ===========================================================
157 + // Methods
158 + // ===========================================================
159 +
160 + private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() {
161 + @Override
162 + public void onSuccess(MerchantList result) {
163 + new Handler(Looper.getMainLooper()).post(() -> {
164 + if (mClusterManager != null) {
165 + mMap.clear();
166 + mClusterManager.clearItems();
167 + if (result != null) {
168 + mClusterManager.addItems(result);
169 + }
170 + mClusterManager.cluster();
171 + }
172 + });
173 + }
174 +
175 + @Override
176 + public void onFailure(int errorCode) {
177 + Log.v("SHOPS_ACTIVITY", String.valueOf(errorCode));
178 + }
179 + };
180 +
181 + // ===========================================================
182 + // Inner and Anonymous Classes
183 + // ===========================================================
184 +
185 +}
...@@ -72,6 +72,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -72,6 +72,7 @@ public class Couponset implements Parcelable, Serializable {
72 private static final String CATEGORY = "category"; 72 private static final String CATEGORY = "category";
73 private static final String TERMS = "terms"; 73 private static final String TERMS = "terms";
74 private static final String AVAILABILITY = "availability"; 74 private static final String AVAILABILITY = "availability";
75 + private static final String MERCHANT_UUID = "merchant_uuid";
75 76
76 77
77 /* Member variables of the Campaign object */ 78 /* Member variables of the Campaign object */
...@@ -100,6 +101,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -100,6 +101,7 @@ public class Couponset implements Parcelable, Serializable {
100 private String category = ""; 101 private String category = "";
101 private String terms = ""; 102 private String terms = "";
102 private int availability = 0; 103 private int availability = 0;
104 + private String merchantUuid = "";
103 105
104 /** 106 /**
105 * Basic constructor used to create an object from a String, representing a 107 * Basic constructor used to create an object from a String, representing a
...@@ -150,6 +152,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -150,6 +152,7 @@ public class Couponset implements Parcelable, Serializable {
150 this.category = json.optString(CATEGORY); 152 this.category = json.optString(CATEGORY);
151 this.terms = json.optString(TERMS); 153 this.terms = json.optString(TERMS);
152 this.availability = json.optInt(AVAILABILITY); 154 this.availability = json.optInt(AVAILABILITY);
155 + this.merchantUuid = json.optString(MERCHANT_UUID);
153 } 156 }
154 } 157 }
155 158
...@@ -176,6 +179,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -176,6 +179,7 @@ public class Couponset implements Parcelable, Serializable {
176 this.category = source.readString(); 179 this.category = source.readString();
177 this.terms = source.readString(); 180 this.terms = source.readString();
178 this.availability = source.readInt(); 181 this.availability = source.readInt();
182 + this.merchantUuid = source.readString();
179 } 183 }
180 184
181 @Override 185 @Override
...@@ -202,6 +206,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -202,6 +206,7 @@ public class Couponset implements Parcelable, Serializable {
202 dest.writeString(this.category); 206 dest.writeString(this.category);
203 dest.writeString(this.terms); 207 dest.writeString(this.terms);
204 dest.writeInt(this.availability); 208 dest.writeInt(this.availability);
209 + dest.writeString(this.merchantUuid);
205 } 210 }
206 211
207 /** 212 /**
...@@ -236,6 +241,7 @@ public class Couponset implements Parcelable, Serializable { ...@@ -236,6 +241,7 @@ public class Couponset implements Parcelable, Serializable {
236 jObj.putOpt(CATEGORY, this.category); 241 jObj.putOpt(CATEGORY, this.category);
237 jObj.putOpt(TERMS, this.terms); 242 jObj.putOpt(TERMS, this.terms);
238 jObj.putOpt(AVAILABILITY, this.availability); 243 jObj.putOpt(AVAILABILITY, this.availability);
244 + jObj.putOpt(MERCHANT_UUID, this.merchantUuid);
239 } catch (JSONException e) { 245 } catch (JSONException e) {
240 if (WarpConstants.DEBUG) { 246 if (WarpConstants.DEBUG) {
241 e.printStackTrace(); 247 e.printStackTrace();
...@@ -371,6 +377,10 @@ public class Couponset implements Parcelable, Serializable { ...@@ -371,6 +377,10 @@ public class Couponset implements Parcelable, Serializable {
371 return availability; 377 return availability;
372 } 378 }
373 379
380 + public String getMerchantUuid() {
381 + return merchantUuid;
382 + }
383 +
374 @Override 384 @Override
375 public int describeContents() { 385 public int describeContents() {
376 return 0; 386 return 0;
......
...@@ -28,6 +28,9 @@ package ly.warp.sdk.io.models; ...@@ -28,6 +28,9 @@ package ly.warp.sdk.io.models;
28 import android.os.Parcel; 28 import android.os.Parcel;
29 import android.os.Parcelable; 29 import android.os.Parcelable;
30 30
31 +import com.google.android.gms.maps.model.LatLng;
32 +import com.google.maps.android.clustering.ClusterItem;
33 +
31 import org.json.JSONArray; 34 import org.json.JSONArray;
32 import org.json.JSONException; 35 import org.json.JSONException;
33 import org.json.JSONObject; 36 import org.json.JSONObject;
...@@ -42,7 +45,7 @@ import ly.warp.sdk.utils.constants.WarpConstants; ...@@ -42,7 +45,7 @@ import ly.warp.sdk.utils.constants.WarpConstants;
42 * Created by Panagiotis Triantafyllou on 07-Dec-21. 45 * Created by Panagiotis Triantafyllou on 07-Dec-21.
43 */ 46 */
44 47
45 -public class Merchant implements Parcelable, Serializable { 48 +public class Merchant implements Parcelable, Serializable, ClusterItem {
46 49
47 private static final long serialVersionUID = -4754964462459705285L; 50 private static final long serialVersionUID = -4754964462459705285L;
48 51
...@@ -131,6 +134,7 @@ public class Merchant implements Parcelable, Serializable { ...@@ -131,6 +134,7 @@ public class Merchant implements Parcelable, Serializable {
131 private JSONObject working_hours = new JSONObject(); 134 private JSONObject working_hours = new JSONObject();
132 private JSONArray tags = new JSONArray(); 135 private JSONArray tags = new JSONArray();
133 private JSONObject product = new JSONObject(); 136 private JSONObject product = new JSONObject();
137 + private LatLng coordinates;
134 138
135 /** 139 /**
136 * Basic constructor used to create an object from a String, representing a 140 * Basic constructor used to create an object from a String, representing a
...@@ -190,6 +194,7 @@ public class Merchant implements Parcelable, Serializable { ...@@ -190,6 +194,7 @@ public class Merchant implements Parcelable, Serializable {
190 this.working_hours = json.optJSONObject(WORKING_HOURS); 194 this.working_hours = json.optJSONObject(WORKING_HOURS);
191 this.tags = json.optJSONArray(TAGS); 195 this.tags = json.optJSONArray(TAGS);
192 this.product = json.optJSONObject(PRODUCT); 196 this.product = json.optJSONObject(PRODUCT);
197 + coordinates = new LatLng(this.latitude, this.longitude);
193 } 198 }
194 } 199 }
195 200
...@@ -228,6 +233,7 @@ public class Merchant implements Parcelable, Serializable { ...@@ -228,6 +233,7 @@ public class Merchant implements Parcelable, Serializable {
228 this.distance = source.readInt(); 233 this.distance = source.readInt();
229 this.default_shown = source.readByte() != 0; 234 this.default_shown = source.readByte() != 0;
230 this.hidden = source.readByte() != 0; 235 this.hidden = source.readByte() != 0;
236 + this.coordinates = new LatLng(this.latitude, this.longitude);
231 } 237 }
232 238
233 @Override 239 @Override
...@@ -266,6 +272,7 @@ public class Merchant implements Parcelable, Serializable { ...@@ -266,6 +272,7 @@ public class Merchant implements Parcelable, Serializable {
266 dest.writeInt(this.distance); 272 dest.writeInt(this.distance);
267 dest.writeByte((byte) (this.default_shown ? 1 : 0)); 273 dest.writeByte((byte) (this.default_shown ? 1 : 0));
268 dest.writeByte((byte) (this.hidden ? 1 : 0)); 274 dest.writeByte((byte) (this.hidden ? 1 : 0));
275 + dest.writeParcelable(coordinates, flags);
269 } 276 }
270 277
271 /** 278 /**
...@@ -539,4 +546,19 @@ public class Merchant implements Parcelable, Serializable { ...@@ -539,4 +546,19 @@ public class Merchant implements Parcelable, Serializable {
539 546
540 return listData; 547 return listData;
541 } 548 }
549 +
550 + @Override
551 + public LatLng getPosition() {
552 + return coordinates;
553 + }
554 +
555 + @Override
556 + public String getTitle() {
557 + return null;
558 + }
559 +
560 + @Override
561 + public String getSnippet() {
562 + return null;
563 + }
542 } 564 }
......
...@@ -39,6 +39,7 @@ public class WarplyMerchantsRequest { ...@@ -39,6 +39,7 @@ public class WarplyMerchantsRequest {
39 private final String KEY_UUID = "uuid"; 39 private final String KEY_UUID = "uuid";
40 private final String KEY_CENTER = "center"; 40 private final String KEY_CENTER = "center";
41 private final String KEY_DISTANCE = "distance"; 41 private final String KEY_DISTANCE = "distance";
42 + private final String KEY_PARENT_UUIDS = "parent_uuids";
42 43
43 // =========================================================== 44 // ===========================================================
44 // Fields 45 // Fields
...@@ -54,6 +55,7 @@ public class WarplyMerchantsRequest { ...@@ -54,6 +55,7 @@ public class WarplyMerchantsRequest {
54 private int mDistance = 0; 55 private int mDistance = 0;
55 private ArrayList<Double> mCenter = new ArrayList<>(); 56 private ArrayList<Double> mCenter = new ArrayList<>();
56 private String mLanguage = WarplyProperty.getLanguage(Warply.getWarplyContext()); 57 private String mLanguage = WarplyProperty.getLanguage(Warply.getWarplyContext());
58 + private ArrayList<String> mParentUuids = new ArrayList<>();
57 59
58 // =========================================================== 60 // ===========================================================
59 // Constructor 61 // Constructor
...@@ -99,6 +101,11 @@ public class WarplyMerchantsRequest { ...@@ -99,6 +101,11 @@ public class WarplyMerchantsRequest {
99 // Getter & Setter 101 // Getter & Setter
100 // =========================================================== 102 // ===========================================================
101 103
104 + public WarplyMerchantsRequest setParentUuids(ArrayList<String> uuids) {
105 + mParentUuids = uuids;
106 + return this;
107 + }
108 +
102 public WarplyMerchantsRequest setIsMultilingual(boolean multilingual) { 109 public WarplyMerchantsRequest setIsMultilingual(boolean multilingual) {
103 mIsMultilingual = multilingual; 110 mIsMultilingual = multilingual;
104 return this; 111 return this;
...@@ -214,6 +221,11 @@ public class WarplyMerchantsRequest { ...@@ -214,6 +221,11 @@ public class WarplyMerchantsRequest {
214 bodyJsonObject.putOpt(KEY_DISTANCE, mDistance); 221 bodyJsonObject.putOpt(KEY_DISTANCE, mDistance);
215 } else 222 } else
216 bodyJsonObject.putOpt(KEY_LOCATION, JSONObject.NULL); 223 bodyJsonObject.putOpt(KEY_LOCATION, JSONObject.NULL);
224 + if (mParentUuids == null || mParentUuids.size() == 0) {
225 + bodyJsonObject.putOpt(KEY_PARENT_UUIDS, JSONObject.NULL);
226 + } else {
227 + bodyJsonObject.putOpt(KEY_PARENT_UUIDS, new JSONArray(mParentUuids));
228 + }
217 bodyJsonObject.putOpt(KEY_TAGS, mTags != null && mTags.size() > 0 ? new JSONArray(mTags) : JSONObject.NULL); 229 bodyJsonObject.putOpt(KEY_TAGS, mTags != null && mTags.size() > 0 ? new JSONArray(mTags) : JSONObject.NULL);
218 if (!TextUtils.isEmpty(mUuid)) 230 if (!TextUtils.isEmpty(mUuid))
219 bodyJsonObject.putOpt(KEY_UUID, mUuid); 231 bodyJsonObject.putOpt(KEY_UUID, mUuid);
......
...@@ -27,6 +27,7 @@ public class WarplyUserCouponsRequest { ...@@ -27,6 +27,7 @@ public class WarplyUserCouponsRequest {
27 private final String KEY_ACTION_VALUE = "get_user_coupons"; 27 private final String KEY_ACTION_VALUE = "get_user_coupons";
28 private final String KEY_FETCH_DATA = "fetch_data"; 28 private final String KEY_FETCH_DATA = "fetch_data";
29 private final String KEY_FETCH_VALUE = "transaction"; 29 private final String KEY_FETCH_VALUE = "transaction";
30 + private final String KEY_FETCH_VALUE2 = "communication";
30 31
31 // =========================================================== 32 // ===========================================================
32 // Fields 33 // Fields
...@@ -142,6 +143,7 @@ public class WarplyUserCouponsRequest { ...@@ -142,6 +143,7 @@ public class WarplyUserCouponsRequest {
142 bodyJsonObject.putOpt(KEY_ACTION, KEY_ACTION_VALUE); 143 bodyJsonObject.putOpt(KEY_ACTION, KEY_ACTION_VALUE);
143 JSONArray fetch = new JSONArray(); 144 JSONArray fetch = new JSONArray();
144 fetch.put(KEY_FETCH_VALUE); 145 fetch.put(KEY_FETCH_VALUE);
146 + fetch.put(KEY_FETCH_VALUE2);
145 bodyJsonObject.putOpt(KEY_FETCH_DATA, fetch); 147 bodyJsonObject.putOpt(KEY_FETCH_DATA, fetch);
146 } catch (JSONException e) { 148 } catch (JSONException e) {
147 if (WarpConstants.DEBUG) 149 if (WarpConstants.DEBUG)
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
25 25
26 package ly.warp.sdk.utils.constants; 26 package ly.warp.sdk.utils.constants;
27 27
28 +import com.google.android.gms.maps.model.LatLng;
29 +import com.google.android.gms.maps.model.LatLngBounds;
30 +
28 public class WarpConstants { 31 public class WarpConstants {
29 32
30 /** 33 /**
...@@ -75,6 +78,11 @@ public class WarpConstants { ...@@ -75,6 +78,11 @@ public class WarpConstants {
75 public static final int RANDOM_MAX = 60; 78 public static final int RANDOM_MAX = 60;
76 public static final int JOB_SERVICE_ID = 10001; 79 public static final int JOB_SERVICE_ID = 10001;
77 80
81 + public static final LatLngBounds GREECE_BOUNDS = new LatLngBounds(
82 + new LatLng(34.75261, 19.33079),
83 + new LatLng(41.97761, 28.62522)
84 + );
85 +
78 /* Result codes */ 86 /* Result codes */
79 87
80 public static final int RESULT_CODE_SUCCESS = 1; 88 public static final int RESULT_CODE_SUCCESS = 1;
......
...@@ -165,6 +165,7 @@ ...@@ -165,6 +165,7 @@
165 android:layout_marginTop="64dp" 165 android:layout_marginTop="64dp"
166 android:background="@drawable/selector_button_green" 166 android:background="@drawable/selector_button_green"
167 android:gravity="center" 167 android:gravity="center"
168 + android:visibility="gone"
168 android:orientation="horizontal" 169 android:orientation="horizontal"
169 app:layout_constraintEnd_toEndOf="parent" 170 app:layout_constraintEnd_toEndOf="parent"
170 app:layout_constraintStart_toStartOf="parent" 171 app:layout_constraintStart_toStartOf="parent"
...@@ -189,7 +190,6 @@ ...@@ -189,7 +190,6 @@
189 android:background="@drawable/selector_button_grey" 190 android:background="@drawable/selector_button_grey"
190 android:gravity="center" 191 android:gravity="center"
191 android:orientation="horizontal" 192 android:orientation="horizontal"
192 - android:visibility="gone"
193 app:layout_constraintEnd_toEndOf="parent" 193 app:layout_constraintEnd_toEndOf="parent"
194 app:layout_constraintStart_toStartOf="parent" 194 app:layout_constraintStart_toStartOf="parent"
195 app:layout_constraintTop_toBottomOf="@+id/ll_gift_it"> 195 app:layout_constraintTop_toBottomOf="@+id/ll_gift_it">
......
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_coupon_share_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:text="@string/cos_coupon_gift"
28 + android:textColor="@color/grey"
29 + android:textSize="17sp"
30 + android:textStyle="bold"
31 + app:layout_constraintBottom_toBottomOf="parent"
32 + app:layout_constraintEnd_toEndOf="parent"
33 + app:layout_constraintStart_toStartOf="parent"
34 + app:layout_constraintTop_toTopOf="parent" />
35 + </androidx.constraintlayout.widget.ConstraintLayout>
36 +
37 + <ScrollView
38 + android:layout_width="match_parent"
39 + android:layout_height="match_parent"
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:text="@string/cos_coupon_share_gift_title"
92 + android:textColor="#415564"
93 + android:textSize="16sp"
94 + app:layout_constraintEnd_toEndOf="parent"
95 + app:layout_constraintStart_toStartOf="parent"
96 + app:layout_constraintTop_toBottomOf="@+id/textView13" />
97 +
98 + <RelativeLayout
99 + android:id="@+id/ll_share_view"
100 + android:layout_width="match_parent"
101 + android:layout_height="wrap_content"
102 + app:layout_constraintEnd_toEndOf="parent"
103 + app:layout_constraintStart_toStartOf="parent"
104 + app:layout_constraintTop_toBottomOf="@+id/textView14">
105 +
106 + <TextView
107 + android:id="@+id/tv_phone"
108 + android:layout_width="wrap_content"
109 + android:layout_height="wrap_content"
110 + android:layout_alignParentStart="true"
111 + android:layout_centerVertical="true"
112 + android:text="@string/cos_coupon_share_sender"
113 + android:textColor="@color/grey"
114 + android:textSize="16sp" />
115 +
116 + <ImageView
117 + android:id="@+id/iv_arrow_down"
118 + android:layout_width="wrap_content"
119 + android:layout_height="wrap_content"
120 + android:layout_alignParentEnd="true"
121 + android:layout_centerVertical="true"
122 + android:tint="@color/blue_dark"
123 + android:rotation="90"
124 + android:src="@drawable/ic_arrow_right_white"/>
125 + </RelativeLayout>
126 + </androidx.constraintlayout.widget.ConstraintLayout>
127 + </androidx.constraintlayout.widget.ConstraintLayout>
128 + </ScrollView>
129 +</RelativeLayout>
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_shops_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:text="@string/cos_coupon_shops_title"
28 + android:textColor="@color/grey"
29 + android:textSize="17sp"
30 + android:textStyle="bold"
31 + app:layout_constraintBottom_toBottomOf="parent"
32 + app:layout_constraintEnd_toEndOf="parent"
33 + app:layout_constraintStart_toStartOf="parent"
34 + app:layout_constraintTop_toTopOf="parent" />
35 + </androidx.constraintlayout.widget.ConstraintLayout>
36 +
37 + <RelativeLayout
38 + android:id="@+id/cl_loyalty_info_view_inner"
39 + android:layout_width="match_parent"
40 + android:layout_height="match_parent"
41 + android:layout_below="@+id/cl_loyalty_wallet_header">
42 +
43 + <fragment
44 + android:id="@+id/mv_shops"
45 + class="com.google.android.gms.maps.SupportMapFragment"
46 + android:layout_width="match_parent"
47 + android:layout_height="match_parent" />
48 + </RelativeLayout>
49 +</RelativeLayout>
1 <resources> 1 <resources>
2 + <string name="google_maps_key">AIzaSyB-K6OiUDT_X0zp2jYjqHg54ThxEuZtr9I</string>
3 +
2 <string name="rate_dialog_title">Rate App</string> 4 <string name="rate_dialog_title">Rate App</string>
3 <string name="rate_dialog_message">If you enjoy using this app, would you mind taking a moment to rate it? It won\'t take more than a minute. Thanks for your support!</string> 5 <string name="rate_dialog_message">If you enjoy using this app, would you mind taking a moment to rate it? It won\'t take more than a minute. Thanks for your support!</string>
4 <string name="rate_dialog_positive">Rate Now</string> 6 <string name="rate_dialog_positive">Rate Now</string>
...@@ -87,6 +89,10 @@ ...@@ -87,6 +89,10 @@
87 <string name="cos_dlg_negative_button2">Άκυρο</string> 89 <string name="cos_dlg_negative_button2">Άκυρο</string>
88 <string name="cos_profile_preferences">+Προτιμήσεις</string> 90 <string name="cos_profile_preferences">+Προτιμήσεις</string>
89 <string name="cos_shops">Δες τα καταστήματα</string> 91 <string name="cos_shops">Δες τα καταστήματα</string>
92 + <string name="cos_coupon_shops_title">Καταστήματα</string>
93 + <string name="cos_coupon_gift">Κάντο δώρο!</string>
94 + <string name="cos_coupon_share_gift_title">Επίλεξε τον αριθμό από τον οποίο θα στείλεις το δώρο και καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string>
95 + <string name="cos_coupon_share_sender">Αποστολέας</string>
90 96
91 <string-array name="coupons_array"> 97 <string-array name="coupons_array">
92 <item>Κουπόνια</item> 98 <item>Κουπόνια</item>
......