Panagiotis Triantafyllou

new keys

...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { ...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
36 public void onWarplyReady() { 36 public void onWarplyReady() {
37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
39 - .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990 39 + .setGuid("7000000870"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -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-cosbeta95' 5 + PUBLISH_VERSION = '4.5.4-cosbeta96'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
...@@ -62,9 +62,9 @@ dependencies { ...@@ -62,9 +62,9 @@ dependencies {
62 implementation 'com.google.firebase:firebase-messaging' 62 implementation 'com.google.firebase:firebase-messaging'
63 63
64 //------------------------------ GMS -----------------------------// 64 //------------------------------ GMS -----------------------------//
65 - api 'com.google.android.gms:play-services-base:18.0.1' 65 + api 'com.google.android.gms:play-services-base:18.1.0'
66 - implementation 'com.google.android.gms:play-services-location:19.0.1' 66 + implementation 'com.google.android.gms:play-services-location:21.0.0'
67 - implementation 'com.google.android.gms:play-services-maps:18.0.2' 67 + implementation 'com.google.android.gms:play-services-maps:18.1.0'
68 api 'com.google.maps.android:android-maps-utils:0.5' 68 api 'com.google.maps.android:android-maps-utils:0.5'
69 69
70 //------------------------------ Work Manager -----------------------------// 70 //------------------------------ Work Manager -----------------------------//
......
...@@ -5,6 +5,7 @@ import android.content.Context; ...@@ -5,6 +5,7 @@ import android.content.Context;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.graphics.Bitmap; 6 import android.graphics.Bitmap;
7 import android.graphics.Color; 7 import android.graphics.Color;
8 +import android.net.Uri;
8 import android.os.Build; 9 import android.os.Build;
9 import android.os.Bundle; 10 import android.os.Bundle;
10 import android.text.Html; 11 import android.text.Html;
...@@ -33,6 +34,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; ...@@ -33,6 +34,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper;
33 import ly.warp.sdk.R; 34 import ly.warp.sdk.R;
34 import ly.warp.sdk.io.models.Coupon; 35 import ly.warp.sdk.io.models.Coupon;
35 import ly.warp.sdk.io.models.Couponset; 36 import ly.warp.sdk.io.models.Couponset;
37 +import ly.warp.sdk.io.models.Merchant;
36 import ly.warp.sdk.services.EventCouponsService; 38 import ly.warp.sdk.services.EventCouponsService;
37 import ly.warp.sdk.utils.WarplyManagerHelper; 39 import ly.warp.sdk.utils.WarplyManagerHelper;
38 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 40 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
...@@ -51,10 +53,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -51,10 +53,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
51 private ImageView mIvBack, mIvCouponPhoto, mIvBarcode; 53 private ImageView mIvBack, mIvCouponPhoto, mIvBarcode;
52 private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate, 54 private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate,
53 mTvTermsValue, mTvFullBarcode; 55 mTvTermsValue, mTvFullBarcode;
54 - private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms; 56 + private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite;
55 private Coupon mCoupon; 57 private Coupon mCoupon;
56 private Couponset mCouponset; 58 private Couponset mCouponset;
57 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false; 59 private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false;
60 + private Merchant mMerchant;
58 61
59 // =========================================================== 62 // ===========================================================
60 // Methods for/from SuperClass/Interfaces 63 // Methods for/from SuperClass/Interfaces
...@@ -78,6 +81,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -78,6 +81,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
78 mIvCouponPhoto = findViewById(R.id.imageView6); 81 mIvCouponPhoto = findViewById(R.id.imageView6);
79 mIvBarcode = findViewById(R.id.iv_barcode); 82 mIvBarcode = findViewById(R.id.iv_barcode);
80 mLlShops = findViewById(R.id.ll_shops); 83 mLlShops = findViewById(R.id.ll_shops);
84 + mLlWebsite = findViewById(R.id.ll_website);
81 mLlBarcodeShown = findViewById(R.id.ll_show_barcode); 85 mLlBarcodeShown = findViewById(R.id.ll_show_barcode);
82 mLlBarcodeContainer = findViewById(R.id.ll_barcode_container_items); 86 mLlBarcodeContainer = findViewById(R.id.ll_barcode_container_items);
83 mLlTerms = findViewById(R.id.ll_terms_inner); 87 mLlTerms = findViewById(R.id.ll_terms_inner);
...@@ -129,9 +133,20 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -129,9 +133,20 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
129 133
130 Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class); 134 Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class);
131 intent.putExtra("couponset", (Serializable) mCouponset); 135 intent.putExtra("couponset", (Serializable) mCouponset);
136 + intent.putExtra("merchant", (Serializable) mMerchant);
132 startActivity(intent); 137 startActivity(intent);
133 return; 138 return;
134 } 139 }
140 + if (view.getId() == R.id.ll_website) {
141 + WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
142 +
143 + if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
144 + Intent intent = new Intent(Intent.ACTION_VIEW);
145 + intent.setData(Uri.parse(mMerchant.getWebsite()));
146 + startActivity(intent);
147 + }
148 + return;
149 + }
135 if (view.getId() == R.id.ll_show_barcode) { 150 if (view.getId() == R.id.ll_show_barcode) {
136 if (mIsBarcodeShown) { 151 if (mIsBarcodeShown) {
137 mLlBarcodeContainer.setVisibility(View.GONE); 152 mLlBarcodeContainer.setVisibility(View.GONE);
...@@ -175,6 +190,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -175,6 +190,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
175 // =========================================================== 190 // ===========================================================
176 191
177 private void initViews() { 192 private void initViews() {
193 + mLlBarcodeShown.setVisibility(View.GONE);
194 + mLlBarcodeContainer.setVisibility(View.GONE);
195 + mIvBarcode.setVisibility(View.GONE);
196 +
178 mTvCouponCode.setText(mCoupon.getCoupon()); 197 mTvCouponCode.setText(mCoupon.getCoupon());
179 mTvCouponTitle.setText(mCoupon.getName()); 198 mTvCouponTitle.setText(mCoupon.getName());
180 // mTvCouponSubtitle.setText(mCoupon.getDescription()); 199 // mTvCouponSubtitle.setText(mCoupon.getDescription());
...@@ -189,6 +208,24 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -189,6 +208,24 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
189 } 208 }
190 209
191 if (mCouponset != null) { 210 if (mCouponset != null) {
211 + if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
212 + for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
213 + if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
214 + mMerchant = merchant;
215 + break;
216 + }
217 + }
218 +
219 +// if (mMerchant != null) {
220 +// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("show_map") && (mMerchant.getExtraFields().optBoolean("show_map") || mMerchant.getExtraFields().optString("show_map").equals("true"))) {
221 + mLlShops.setVisibility(View.VISIBLE);
222 +// }
223 +// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("eshop") && (mMerchant.getExtraFields().optBoolean("eshop") || mMerchant.getExtraFields().optString("eshop").equals("true"))) {
224 +// mLlWebsite.setVisibility(View.VISIBLE);
225 +// }
226 +// }
227 + }
228 +
192 mTvCouponSubtitle.setText(mCouponset.getShortDescription()); 229 mTvCouponSubtitle.setText(mCouponset.getShortDescription());
193 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 230 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
194 mTvTermsValue.setText(Html.fromHtml(mCouponset.getTerms(), Html.FROM_HTML_MODE_COMPACT)); 231 mTvTermsValue.setText(Html.fromHtml(mCouponset.getTerms(), Html.FROM_HTML_MODE_COMPACT));
...@@ -225,6 +262,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -225,6 +262,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
225 // mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); 262 // mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
226 mLlGiftIt.setOnClickListener(this); 263 mLlGiftIt.setOnClickListener(this);
227 mLlShops.setOnClickListener(this); 264 mLlShops.setOnClickListener(this);
265 + mLlWebsite.setOnClickListener(this);
228 mLlBarcodeShown.setOnClickListener(this); 266 mLlBarcodeShown.setOnClickListener(this);
229 mLlTerms.setOnClickListener(this); 267 mLlTerms.setOnClickListener(this);
230 268
...@@ -268,6 +306,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -268,6 +306,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
268 306
269 } catch (Exception e) { 307 } catch (Exception e) {
270 e.printStackTrace(); 308 e.printStackTrace();
309 + mLlBarcodeShown.setVisibility(View.GONE);
310 + mLlBarcodeContainer.setVisibility(View.GONE);
271 mIvBarcode.setVisibility(View.GONE); 311 mIvBarcode.setVisibility(View.GONE);
272 } 312 }
273 } 313 }
......
...@@ -16,6 +16,7 @@ import android.widget.LinearLayout; ...@@ -16,6 +16,7 @@ import android.widget.LinearLayout;
16 import android.widget.TextView; 16 import android.widget.TextView;
17 17
18 import androidx.annotation.NonNull; 18 import androidx.annotation.NonNull;
19 +import androidx.appcompat.app.AlertDialog;
19 import androidx.core.app.ActivityCompat; 20 import androidx.core.app.ActivityCompat;
20 import androidx.core.content.ContextCompat; 21 import androidx.core.content.ContextCompat;
21 import androidx.fragment.app.FragmentActivity; 22 import androidx.fragment.app.FragmentActivity;
...@@ -68,6 +69,8 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -68,6 +69,8 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
68 private ClusterManager<Merchant> mClusterManager; 69 private ClusterManager<Merchant> mClusterManager;
69 SupportMapFragment mMapView; 70 SupportMapFragment mMapView;
70 private MerchantList mMerchantList = new MerchantList(); 71 private MerchantList mMerchantList = new MerchantList();
72 + private AlertDialog mAlertDialogNoShopsAvailable;
73 + private Merchant mMerchant;
71 74
72 // =========================================================== 75 // ===========================================================
73 // Methods for/from SuperClass/Interfaces 76 // Methods for/from SuperClass/Interfaces
...@@ -79,6 +82,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -79,6 +82,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
79 setContentView(R.layout.activity_shops); 82 setContentView(R.layout.activity_shops);
80 83
81 mCouponset = (Couponset) getIntent().getSerializableExtra("couponset"); 84 mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
85 + mMerchant = (Merchant) getIntent().getSerializableExtra("merchant");
82 86
83 mIvBack = findViewById(R.id.iv_shops_back); 87 mIvBack = findViewById(R.id.iv_shops_back);
84 mMapView = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mv_shops); 88 mMapView = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mv_shops);
...@@ -254,11 +258,38 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -254,11 +258,38 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
254 // Methods 258 // Methods
255 // =========================================================== 259 // ===========================================================
256 260
261 + private void showNoShopsAvailableDialog() {
262 + mAlertDialogNoShopsAvailable = new AlertDialog.Builder(this)
263 + .setTitle(R.string.cos_dlg_no_shops_title)
264 + .setMessage(R.string.cos_dlg_no_shops)
265 + .setPositiveButton(R.string.cos_dlg_no_shops_positive, (dialogPositive, whichPositive) -> {
266 + dialogPositive.dismiss();
267 + openWebsite();
268 +
269 + })
270 + .setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> {
271 + dialogNegative.dismiss();
272 + onBackPressed();
273 + })
274 + .show();
275 + }
276 +
277 + private void openWebsite() {
278 + WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
279 +
280 + if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
281 + Intent intent = new Intent(Intent.ACTION_VIEW);
282 + intent.setData(Uri.parse(mMerchant.getWebsite()));
283 + startActivity(intent);
284 + }
285 + }
286 +
257 private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() { 287 private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() {
258 @Override 288 @Override
259 public void onSuccess(MerchantList result) { 289 public void onSuccess(MerchantList result) {
260 mMerchantList.clear(); 290 mMerchantList.clear();
261 mMerchantList.addAll(result); 291 mMerchantList.addAll(result);
292 +
262 new Handler(Looper.getMainLooper()).post(() -> { 293 new Handler(Looper.getMainLooper()).post(() -> {
263 // if (mClusterManager != null) { 294 // if (mClusterManager != null) {
264 // mMap.clear(); 295 // mMap.clear();
...@@ -269,6 +300,18 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -269,6 +300,18 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
269 // mClusterManager.cluster(); 300 // mClusterManager.cluster();
270 // } 301 // }
271 302
303 + int nonNullCoords = 0;
304 + for (Merchant merchCoords : result) {
305 + if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
306 + nonNullCoords++;
307 + }
308 + }
309 +
310 + if (result.size() == 0 || nonNullCoords == 0) {
311 + showNoShopsAvailableDialog();
312 + return;
313 + }
314 +
272 for (Merchant merch : result) { 315 for (Merchant merch : result) {
273 mMap.addMarker(new MarkerOptions() 316 mMap.addMarker(new MarkerOptions()
274 .position(new LatLng(merch.getLatitude(), merch.getLongitude())) 317 .position(new LatLng(merch.getLatitude(), merch.getLongitude()))
......
...@@ -210,8 +210,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { ...@@ -210,8 +210,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
210 this.description = json.optString(DESCRIPTION); 210 this.description = json.optString(DESCRIPTION);
211 this.short_description = json.optString(SHORT_DESCRIPTION); 211 this.short_description = json.optString(SHORT_DESCRIPTION);
212 this.region = json.optString(REGION); 212 this.region = json.optString(REGION);
213 - this.latitude = json.optDouble(LAT); 213 + this.latitude = json.isNull(LAT) ? 0.0 : json.optDouble(LAT);
214 - this.longitude = json.optDouble(LON); 214 + this.longitude = json.isNull(LON) ? 0.0 : json.optDouble(LON);
215 this.image = json.optString(IMAGE); 215 this.image = json.optString(IMAGE);
216 this.extra_fields = json.optJSONObject(EXTRA_FIELDS); 216 this.extra_fields = json.optJSONObject(EXTRA_FIELDS);
217 this.active = json.optBoolean(ACTIVE); 217 this.active = json.optBoolean(ACTIVE);
......
...@@ -1224,6 +1224,7 @@ public class WarplyManagerHelper { ...@@ -1224,6 +1224,7 @@ public class WarplyManagerHelper {
1224 } 1224 }
1225 1225
1226 public static void setMerchantList(MerchantList merchantList) { 1226 public static void setMerchantList(MerchantList merchantList) {
1227 + mMerchantList.clear();
1227 mMerchantList = merchantList; 1228 mMerchantList = merchantList;
1228 } 1229 }
1229 1230
......
...@@ -19,6 +19,7 @@ import java.text.ParseException; ...@@ -19,6 +19,7 @@ import java.text.ParseException;
19 import java.text.SimpleDateFormat; 19 import java.text.SimpleDateFormat;
20 import java.util.ArrayList; 20 import java.util.ArrayList;
21 import java.util.Date; 21 import java.util.Date;
22 +import java.util.Locale;
22 import java.util.concurrent.TimeUnit; 23 import java.util.concurrent.TimeUnit;
23 24
24 import io.reactivex.Observable; 25 import io.reactivex.Observable;
...@@ -121,7 +122,7 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte ...@@ -121,7 +122,7 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
121 122
122 JSONObject extraFields = WarpJSONParser.getJSONFromString(couponItem.getTransactionMetadata()); 123 JSONObject extraFields = WarpJSONParser.getJSONFromString(couponItem.getTransactionMetadata());
123 124
124 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 125 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, MMM dd yyyy HH:mm:ss", Locale.US);
125 Date newDate = new Date(); 126 Date newDate = new Date();
126 try { 127 try {
127 newDate = simpleDateFormat.parse(couponItem.getDate()); 128 newDate = simpleDateFormat.parse(couponItem.getDate());
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
93 <string name="cos_dlg_negative_button2">Άκυρο</string> 93 <string name="cos_dlg_negative_button2">Άκυρο</string>
94 <string name="cos_profile_preferences">+Προτιμήσεις</string> 94 <string name="cos_profile_preferences">+Προτιμήσεις</string>
95 <string name="cos_shops">Δες τα καταστήματα</string> 95 <string name="cos_shops">Δες τα καταστήματα</string>
96 + <string name="cos_website">Δες το eshop</string>
96 <string name="cos_coupon_shops_title">Καταστήματα</string> 97 <string name="cos_coupon_shops_title">Καταστήματα</string>
97 <string name="cos_coupon_gift">Kάνε δώρο</string> 98 <string name="cos_coupon_gift">Kάνε δώρο</string>
98 <string name="cos_coupon_share_gift_title">Επίλεξε το κινητό από το οποίο θα γίνει η αποστολή και συμπλήρωσε το COSMOTE κινητό που θα λάβει το δώρο.</string> 99 <string name="cos_coupon_share_gift_title">Επίλεξε το κινητό από το οποίο θα γίνει η αποστολή και συμπλήρωσε το COSMOTE κινητό που θα λάβει το δώρο.</string>
...@@ -144,6 +145,9 @@ ...@@ -144,6 +145,9 @@
144 <string name="cos_share_no_assets">Για την αποστολή του δώρου σου χρειάζεται να έχεις κινητό COSMOTE.</string> 145 <string name="cos_share_no_assets">Για την αποστολή του δώρου σου χρειάζεται να έχεις κινητό COSMOTE.</string>
145 <string name="cos_dlg_coupon_depleted_title">H προσφορά δεν είναι πλέον διαθέσιμη</string> 146 <string name="cos_dlg_coupon_depleted_title">H προσφορά δεν είναι πλέον διαθέσιμη</string>
146 <string name="cos_dlg_coupon_depleted_message">Μείνε συντονισμένος για νέες προσφορές και κουπόνια.</string> 147 <string name="cos_dlg_coupon_depleted_message">Μείνε συντονισμένος για νέες προσφορές και κουπόνια.</string>
148 + <string name="cos_dlg_no_shops">Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.</string>
149 + <string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string>
150 + <string name="cos_dlg_no_shops_positive">Δες το eshop</string>
147 151
148 <string-array name="coupons_array"> 152 <string-array name="coupons_array">
149 <item>Κουπόνια</item> 153 <item>Κουπόνια</item>
......