Panagiotis Triantafyllou

new keys

......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
.setGuid("7000000870"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta95'
PUBLISH_VERSION = '4.5.4-cosbeta96'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -62,9 +62,9 @@ dependencies {
implementation 'com.google.firebase:firebase-messaging'
//------------------------------ GMS -----------------------------//
api 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.google.android.gms:play-services-location:19.0.1'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
api 'com.google.android.gms:play-services-base:18.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
api 'com.google.maps.android:android-maps-utils:0.5'
//------------------------------ Work Manager -----------------------------//
......
......@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
......@@ -33,6 +34,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.services.EventCouponsService;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
......@@ -51,10 +53,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
private ImageView mIvBack, mIvCouponPhoto, mIvBarcode;
private TextView mTvTerms, mTvCouponCode, mTvCouponTitle, mTvCouponSubtitle, mTvCouponDate,
mTvTermsValue, mTvFullBarcode;
private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms;
private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms, mLlWebsite;
private Coupon mCoupon;
private Couponset mCouponset;
private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false;
private Merchant mMerchant;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -78,6 +81,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mIvCouponPhoto = findViewById(R.id.imageView6);
mIvBarcode = findViewById(R.id.iv_barcode);
mLlShops = findViewById(R.id.ll_shops);
mLlWebsite = findViewById(R.id.ll_website);
mLlBarcodeShown = findViewById(R.id.ll_show_barcode);
mLlBarcodeContainer = findViewById(R.id.ll_barcode_container_items);
mLlTerms = findViewById(R.id.ll_terms_inner);
......@@ -129,9 +133,20 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
Intent intent = new Intent(CouponInfoActivity.this, ShopsActivity.class);
intent.putExtra("couponset", (Serializable) mCouponset);
intent.putExtra("merchant", (Serializable) mMerchant);
startActivity(intent);
return;
}
if (view.getId() == R.id.ll_website) {
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(mMerchant.getWebsite()));
startActivity(intent);
}
return;
}
if (view.getId() == R.id.ll_show_barcode) {
if (mIsBarcodeShown) {
mLlBarcodeContainer.setVisibility(View.GONE);
......@@ -175,6 +190,10 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
// ===========================================================
private void initViews() {
mLlBarcodeShown.setVisibility(View.GONE);
mLlBarcodeContainer.setVisibility(View.GONE);
mIvBarcode.setVisibility(View.GONE);
mTvCouponCode.setText(mCoupon.getCoupon());
mTvCouponTitle.setText(mCoupon.getName());
// mTvCouponSubtitle.setText(mCoupon.getDescription());
......@@ -189,6 +208,24 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
if (mCouponset != null) {
if (WarplyManagerHelper.getMerchantList() != null && WarplyManagerHelper.getMerchantList().size() > 0) {
for (Merchant merchant : WarplyManagerHelper.getMerchantList()) {
if (merchant.getUuid().equals(mCouponset.getMerchantUuid())) {
mMerchant = merchant;
break;
}
}
// if (mMerchant != null) {
// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("show_map") && (mMerchant.getExtraFields().optBoolean("show_map") || mMerchant.getExtraFields().optString("show_map").equals("true"))) {
mLlShops.setVisibility(View.VISIBLE);
// }
// if (mMerchant.getExtraFields() != null && mMerchant.getExtraFields().has("eshop") && (mMerchant.getExtraFields().optBoolean("eshop") || mMerchant.getExtraFields().optString("eshop").equals("true"))) {
// mLlWebsite.setVisibility(View.VISIBLE);
// }
// }
}
mTvCouponSubtitle.setText(mCouponset.getShortDescription());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
mTvTermsValue.setText(Html.fromHtml(mCouponset.getTerms(), Html.FROM_HTML_MODE_COMPACT));
......@@ -225,6 +262,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
// mTvTerms.setPaintFlags(mTvTerms.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
mLlGiftIt.setOnClickListener(this);
mLlShops.setOnClickListener(this);
mLlWebsite.setOnClickListener(this);
mLlBarcodeShown.setOnClickListener(this);
mLlTerms.setOnClickListener(this);
......@@ -268,6 +306,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
} catch (Exception e) {
e.printStackTrace();
mLlBarcodeShown.setVisibility(View.GONE);
mLlBarcodeContainer.setVisibility(View.GONE);
mIvBarcode.setVisibility(View.GONE);
}
}
......
......@@ -16,6 +16,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
......@@ -68,6 +69,8 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
private ClusterManager<Merchant> mClusterManager;
SupportMapFragment mMapView;
private MerchantList mMerchantList = new MerchantList();
private AlertDialog mAlertDialogNoShopsAvailable;
private Merchant mMerchant;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -79,6 +82,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
setContentView(R.layout.activity_shops);
mCouponset = (Couponset) getIntent().getSerializableExtra("couponset");
mMerchant = (Merchant) getIntent().getSerializableExtra("merchant");
mIvBack = findViewById(R.id.iv_shops_back);
mMapView = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mv_shops);
......@@ -254,11 +258,38 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
// Methods
// ===========================================================
private void showNoShopsAvailableDialog() {
mAlertDialogNoShopsAvailable = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_no_shops_title)
.setMessage(R.string.cos_dlg_no_shops)
.setPositiveButton(R.string.cos_dlg_no_shops_positive, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
openWebsite();
})
.setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> {
dialogNegative.dismiss();
onBackPressed();
})
.show();
}
private void openWebsite() {
WarplyAnalyticsManager.logTrackersEvent(this, "click", "SeeShopWebsite");
if (!TextUtils.isEmpty(mMerchant.getWebsite())) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(mMerchant.getWebsite()));
startActivity(intent);
}
}
private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() {
@Override
public void onSuccess(MerchantList result) {
mMerchantList.clear();
mMerchantList.addAll(result);
new Handler(Looper.getMainLooper()).post(() -> {
// if (mClusterManager != null) {
// mMap.clear();
......@@ -269,6 +300,18 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
// mClusterManager.cluster();
// }
int nonNullCoords = 0;
for (Merchant merchCoords : result) {
if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
nonNullCoords++;
}
}
if (result.size() == 0 || nonNullCoords == 0) {
showNoShopsAvailableDialog();
return;
}
for (Merchant merch : result) {
mMap.addMarker(new MarkerOptions()
.position(new LatLng(merch.getLatitude(), merch.getLongitude()))
......
......@@ -210,8 +210,8 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
this.description = json.optString(DESCRIPTION);
this.short_description = json.optString(SHORT_DESCRIPTION);
this.region = json.optString(REGION);
this.latitude = json.optDouble(LAT);
this.longitude = json.optDouble(LON);
this.latitude = json.isNull(LAT) ? 0.0 : json.optDouble(LAT);
this.longitude = json.isNull(LON) ? 0.0 : json.optDouble(LON);
this.image = json.optString(IMAGE);
this.extra_fields = json.optJSONObject(EXTRA_FIELDS);
this.active = json.optBoolean(ACTIVE);
......
......@@ -1224,6 +1224,7 @@ public class WarplyManagerHelper {
}
public static void setMerchantList(MerchantList merchantList) {
mMerchantList.clear();
mMerchantList = merchantList;
}
......
......@@ -19,6 +19,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
......@@ -121,7 +122,7 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte
JSONObject extraFields = WarpJSONParser.getJSONFromString(couponItem.getTransactionMetadata());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, MMM dd yyyy HH:mm:ss", Locale.US);
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponItem.getDate());
......
......@@ -16,8 +16,8 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
android:scaleType="centerInside"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -35,26 +35,23 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/cl_loyalty_wallet_header"
android:overScrollMode="never">
android:layout_below="@+id/cl_loyalty_wallet_header">
<androidx.constraintlayout.widget.ConstraintLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
android:overScrollMode="never">
<!-- android:background="@drawable/shape_cos_loyalty_white"-->
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:id="@+id/cl_loyalty_info_view_inner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical"
android:paddingBottom="48dp">
<ImageView
android:id="@+id/imageView6"
......@@ -62,20 +59,8 @@
android:layout_height="253dp"
android:layout_marginTop="0.5dp"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/carousel_banner" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_line"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/imageView6">
</LinearLayout>
<TextView
android:id="@+id/textView13"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
......@@ -86,10 +71,6 @@
android:paddingHorizontal="32dp"
android:textColor="#415564"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.509"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView6"
tools:text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" />
<TextView
......@@ -102,9 +83,6 @@
android:paddingHorizontal="32dp"
android:textColor="#415564"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView13"
tools:text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" />
<TextView
......@@ -112,14 +90,11 @@
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="48dp"
android:text="Κωδικός Κουπονιού"
android:textColor="#415564"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView14" />
android:textSize="18sp" />
<TextView
android:id="@+id/textView16"
......@@ -132,9 +107,6 @@
android:gravity="center"
android:textColor="@color/grey"
android:textSize="25dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView15"
tools:text="1A2C378" />
<LinearLayout
......@@ -143,10 +115,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView16">
android:visibility="gone"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_barcode_container_items"
......@@ -161,10 +131,7 @@
android:id="@+id/view5"
android:layout_width="320dp"
android:layout_height="0.8dp"
android:background="#E6E6E6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView16" />
android:background="#E6E6E6" />
<ImageView
android:id="@+id/iv_barcode"
......@@ -172,10 +139,6 @@
android:layout_height="86dp"
android:layout_marginTop="16dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toTopOf="@+id/view4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view5"
tools:srcCompat="@tools:sample/avatars" />
<TextView
......@@ -193,11 +156,7 @@
android:layout_width="320dp"
android:layout_height="0.8dp"
android:layout_marginTop="20dp"
android:background="#E6E6E6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.505"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_barcode" />
android:background="#E6E6E6" />
</LinearLayout>
<LinearLayout
......@@ -206,6 +165,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
android:orientation="horizontal">
<TextView
......@@ -231,26 +192,22 @@
fontPath="fonts/pf_square_sans_pro_regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:textColor="#415564"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_barcode_container"
tools:text="@string/cos_coupon_date" />
<LinearLayout
android:id="@+id/ll_gift_it"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="64dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView17">
android:paddingVertical="8dp">
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
......@@ -266,15 +223,15 @@
android:id="@+id/ll_shops"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/selector_button_grey"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_gift_it">
android:visibility="gone"
tools:visibility="visible">
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
......@@ -286,15 +243,37 @@
android:textSize="17dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_website"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/selector_button_grey"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="8dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/cos_website"
android:textColor="@color/cos_green6"
android:textSize="17dp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_terms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_shops">
android:gravity="center">
<LinearLayout
android:id="@+id/ll_terms_inner"
......@@ -332,8 +311,14 @@
android:textColor="#415564"
android:visibility="gone" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_line">
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
......
......@@ -93,6 +93,7 @@
<string name="cos_dlg_negative_button2">Άκυρο</string>
<string name="cos_profile_preferences">+Προτιμήσεις</string>
<string name="cos_shops">Δες τα καταστήματα</string>
<string name="cos_website">Δες το eshop</string>
<string name="cos_coupon_shops_title">Καταστήματα</string>
<string name="cos_coupon_gift">Kάνε δώρο</string>
<string name="cos_coupon_share_gift_title">Επίλεξε το κινητό από το οποίο θα γίνει η αποστολή και συμπλήρωσε το COSMOTE κινητό που θα λάβει το δώρο.</string>
......@@ -144,6 +145,9 @@
<string name="cos_share_no_assets">Για την αποστολή του δώρου σου χρειάζεται να έχεις κινητό COSMOTE.</string>
<string name="cos_dlg_coupon_depleted_title">H προσφορά δεν είναι πλέον διαθέσιμη</string>
<string name="cos_dlg_coupon_depleted_message">Μείνε συντονισμένος για νέες προσφορές και κουπόνια.</string>
<string name="cos_dlg_no_shops">Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.</string>
<string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string>
<string name="cos_dlg_no_shops_positive">Δες το eshop</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......