Panagiotis Triantafyllou

vouchers part5

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc80'
PUBLISH_VERSION = '4.5.5.4r1'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -2,20 +2,26 @@ package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import org.greenrobot.eventbus.EventBus;
import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan;
import io.github.inflationx.calligraphy3.TypefaceUtils;
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.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
......@@ -34,8 +40,12 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
private ImageView mIvBack;
private int mTimer = 0;
private Handler mSecondsHandler;
private TextView mTvFavValue, mTvDealsValue;
private float mFavValue = 0.0f;
private TextView mTvFavValue, mTvDealsValue, mTvGiftsValue, mTvMarketValue, mTvDealsValueAll,
mTvGiftsValueAll, mTvMarketAll;
private float mFavValue = 0.0f, countValue = 0.0f;
private RelativeLayout mRlDealsBanner, mRlGiftsBanner, mRlUnifiedBanner;
private boolean mDealsBannerPressed = false, mHistoryPressed = false,
mHistoryMarketPressed = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -50,6 +60,14 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
mIvBack = findViewById(R.id.iv_loyalty_history_close);
mTvFavValue = findViewById(R.id.tv_exp_value);
mTvDealsValue = findViewById(R.id.tv_deals_value);
mTvGiftsValue = findViewById(R.id.tv_gifts_value);
mTvMarketValue = findViewById(R.id.tv_market_value);
mTvDealsValueAll = findViewById(R.id.tv_deals_value_all);
mTvGiftsValueAll = findViewById(R.id.tv_gifts_value_all);
mTvMarketAll = findViewById(R.id.tv_market_value_all);
mRlDealsBanner = findViewById(R.id.rl_first_banner);
mRlGiftsBanner = findViewById(R.id.rl_third_banner);
mRlUnifiedBanner = findViewById(R.id.rl_second_banner);
initViews();
}
......@@ -66,6 +84,10 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
mSecondsHandler.postDelayed(this, 1000);
}
});
mDealsBannerPressed = false;
mHistoryPressed = false;
mHistoryMarketPressed = false;
}
@Override
......@@ -76,7 +98,7 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("time_spent_on_loyalty_sdk");
analyticsEvent.setParameter("name", "History");
analyticsEvent.setParameter("name", "HistoryScreen");
analyticsEvent.setParameter("seconds", String.valueOf(mTimer));
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
}
......@@ -84,10 +106,64 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_loyalty_analysis_close) {
if (view.getId() == R.id.iv_loyalty_history_close) {
onBackPressed();
return;
}
/** Deals History */
if (view.getId() == R.id.rl_first_banner) {
if (!mDealsBannerPressed) {
mDealsBannerPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyHistoryScreen")
.concat(":")
.concat("DealsBanner"));
WarplyDealsAnalysisEventModel warplyDealsAnalysisEventModel = new WarplyDealsAnalysisEventModel();
warplyDealsAnalysisEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(warplyDealsAnalysisEventModel));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_deals_for_you_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
}
return;
}
/** Coupons History */
if (view.getId() == R.id.rl_third_banner) {
if (!mHistoryPressed) {
mHistoryPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyHistoryScreen")
.concat(":")
.concat("LoyaltyBanner"));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_gifts_for_you_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(LoyaltyHistoryActivity.this, LoyaltyAnalysisActivity.class);
startActivity(intent);
}
return;
}
/** Unified History */
if (view.getId() == R.id.rl_second_banner) {
if (!mHistoryMarketPressed) {
mHistoryMarketPressed = true;
WarplyAnalyticsManager.logTrackersEvent(this, "click", ("LoyaltyHistoryScreen")
.concat(":")
.concat("MarketBanner"));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_market_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(LoyaltyHistoryActivity.this, LoyaltyMarketAnalysisActivity.class);
startActivity(intent);
}
}
}
@Override
......@@ -101,6 +177,9 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
private void initViews() {
mIvBack.setOnClickListener(this);
mRlDealsBanner.setOnClickListener(this);
mRlGiftsBanner.setOnClickListener(this);
mRlUnifiedBanner.setOnClickListener(this);
/** First Banner */
String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum());
......@@ -110,14 +189,80 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
} else {
mTvDealsValue.setTextSize(14);
}
// SpannableStringBuilder sBuilder = new SpannableStringBuilder();
// sBuilder.append(String.format(getString(R.string.cos_deals_win_title_cos), badgeValueFirst));
// CalligraphyTypefaceSpan typefaceBoldSpanFirst = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
// sBuilder.setSpan(typefaceBoldSpanFirst, 15, 16 + badgeValueFirst.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
// mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder.append(String.format(getString(R.string.cos_deals_win_title_cos), badgeValueFirst));
CalligraphyTypefaceSpan typefaceBoldSpanFirst = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilder.setSpan(typefaceBoldSpanFirst, 24, 24 + badgeValueFirst.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvDealsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
mFavValue += WarplyManagerHelper.getDealsCouponsSum();
/** First Banner */
/** Second Banner */
if (WarplyManagerHelper.getLoyaltyBadge() != null && (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0 || WarplyManagerHelper.getLoyaltyBadge().getCouponCount() == 0)) {
String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue));
if (String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()).length() >= 3) {
mTvGiftsValue.setTextSize(12);
} else {
mTvGiftsValue.setTextSize(14);
}
SpannableStringBuilder sBuilderSecond = new SpannableStringBuilder();
sBuilderSecond.append(String.format(getString(R.string.cos_deals_win_title), badgeValue));
CalligraphyTypefaceSpan typefaceBoldSpanSecond = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderSecond.setSpan(typefaceBoldSpanSecond, 24, 24 + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvGiftsValueAll.setText(sBuilderSecond, TextView.BufferType.SPANNABLE);
mFavValue += WarplyManagerHelper.getLoyaltyBadge().getValue();
}
/** Second Banner */
/** Third Expandable Banner */
if (WarplyManagerHelper.getMarketCoupons() != null && WarplyManagerHelper.getMarketCoupons().size() > 0) {
countValue = 0.0f;
if (WarplyManagerHelper.getCouponRedeemedList().size() > 0) {
if (WarplyManagerHelper.getCouponsetsDeals().size() > 0) {
for (Couponset couset : WarplyManagerHelper.getCouponsetsDeals()) {
for (Coupon cou : WarplyManagerHelper.getCouponRedeemedList()) {
if (cou.getCouponsetUuid().equals(couset.getUuid())) {
countValue += Float.valueOf(cou.getDiscount());
cou.setDescription(couset.getShortDescription());
cou.setImage(couset.getImgPreview());
cou.setName(couset.getName());
cou.setMerchantUuid(couset.getMerchantUuid());
cou.setInnerText(couset.getInnerText());
cou.setDiscount_type(couset.getDiscount_type());
cou.setFinal_price(couset.getFinal_price());
break;
}
}
}
}
}
mFavValue += countValue;
String badgeValue = String.format("%.02f", countValue);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
if (String.valueOf(countValue).length() >= 3) {
mTvMarketValue.setTextSize(12);
} else {
mTvMarketValue.setTextSize(14);
}
SpannableStringBuilder sBuilderThird = new SpannableStringBuilder();
sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue));
CalligraphyTypefaceSpan typefaceBoldSpanThird = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderThird.setSpan(typefaceBoldSpanThird, 24, 24 + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
} else {
String badgeValue = String.format("%.02f", 0.0f);
mTvMarketValue.setText(String.format(getString(R.string.cos_value), badgeValue));
SpannableStringBuilder sBuilderThird = new SpannableStringBuilder();
sBuilderThird.append(String.format(getString(R.string.cos_supermarket_win), badgeValue));
CalligraphyTypefaceSpan typefaceBoldSpanThird = new CalligraphyTypefaceSpan(TypefaceUtils.load(getAssets(), "fonts/PeridotPE-Bold.ttf"));
sBuilderThird.setSpan(typefaceBoldSpanThird, 24, 24 + badgeValue.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
}
/** Third Expandable Banner */
/** Sum Banner */
String allValue = String.format("%.02f", mFavValue);
mTvFavValue.setText(String.format(getString(R.string.cos_value), allValue));
......
......@@ -5,12 +5,8 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
......@@ -34,24 +30,11 @@ import org.apmem.tools.layouts.FlowLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan;
import io.github.inflationx.calligraphy3.TypefaceUtils;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
import ly.warp.sdk.io.models.ActiveDFYCouponModel;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.models.VouchersActivityEventModel;
......@@ -87,7 +70,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private float couponDfyValue = 0.0f, mFavValue = 0.0f;
private RecyclerView mRecyclerCoupons, mRvMarketCoupons;
private ActiveCouponAdapter mAdapterCoupons;
private AlertDialog mAlertDialogNonTelco;
private AlertDialog mAlertDialogNonTelco, mAlertDialogVouchersService;
private ScrollView mScActiveCodes;
private NestedScrollView mSvLoyaltyWallet;
private int mTimer = 0;
......@@ -103,6 +86,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mCouponPressed = false, mHistoryBadgePressed = false, mUnifiedCountPressed = false,
mGiftsCountPressed = false;
private RelativeLayout mRlDeals, mRlUnified, mRlGifts;
private View mSeparator;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -163,6 +147,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mCvVouchers = findViewById(R.id.cv_vouchers);
mLlVouchers = findViewById(R.id.ll_vouchers);
mLlVouchersSpinner = findViewById(R.id.ll_vouchers_spinner);
mSeparator = findViewById(R.id.v_separator_vouchers);
/** Deals Badge */
// if (WarplyManagerHelper.getActiveDFYCoupons() != null) {
......@@ -450,24 +435,17 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getVouchersServiceUnavailableEventModel() != null) {
runOnUiThread(this::vouchersServiceUnavailableDialog);
return;
}
if (event.getVouchersFetched() != null) {
// if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
// runOnUiThread(() -> {
// mLlVouchersSpinner.setVisibility(View.GONE);
// mLlVouchers.setVisibility(View.VISIBLE);
// });
// } else {
// runOnUiThread(() -> {
// mLlVouchersSpinner.setVisibility(View.GONE);
// });
// }
/** Empty View */
/** Vouchers */
runOnUiThread(this::checkForEmpty);
/** Empty View */
/** Vouchers */
return;
}
if (event.getUnifiedCouponsAdded() != null) {
mUnifiedPressed = false;
/** Unified Coupons List */
// if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0) {
// ArrayList<UnifiedCoupon> tempCouponList = new ArrayList<UnifiedCoupon>();
......@@ -568,11 +546,11 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mTvUnifiedCountBadge.setText(String.valueOf(WarplyManagerHelper.getMarketCouponsList().size()));
else
mTvUnifiedCountBadge.setText("0");
checkForEmpty();
});
return;
}
if (event.getCouponsAdded() != null) {
mCouponPressed = false;
/** Coupons List */
// CouponList tempCouponList = new CouponList();
// CouponList cpnlist = new CouponList();
......@@ -626,6 +604,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mTvGiftsCountBadge.setText(String.valueOf(WarplyManagerHelper.getCouponList().size()));
else
mTvGiftsCountBadge.setText("0");
checkForEmpty();
});
}
}
......@@ -640,16 +619,6 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// ===========================================================
private void initViews() {
// if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
// //TODO: show spinner
// } else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
// //TODO: hide spinner
// mLlVouchers.setVisibility(View.VISIBLE);
// } else {
// //.equals("false)
// //TODO: hide spinner
// }
if (WarpUtils.getUserNonTelco(this)) {
nonTelcoDialog();
}
......@@ -692,12 +661,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// } else {
// mLlMarketView.setVisibility(View.GONE);
// }
/** Unified Coupons List */
if (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
mTvUnifiedCountBadge.setText(String.valueOf(WarplyManagerHelper.getMarketCouponsList().size()));
else
mTvUnifiedCountBadge.setText("0");
/** Unified Coupons List */
/** Coupon List */
// if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) {
......@@ -740,12 +709,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// } else {
// mLlGifts.setVisibility(View.GONE);
// }
/** Coupon List */
if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0)
mTvGiftsCountBadge.setText(String.valueOf(WarplyManagerHelper.getCouponList().size()));
else
mTvGiftsCountBadge.setText("0");
/** Coupon List */
/** First Expandable Banner */
// String badgeValueFirst = String.format("%.02f", WarplyManagerHelper.getDealsCouponsSum());
......@@ -836,7 +805,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// sBuilderThird.setSpan(typefaceBoldSpanThird, 15, 16 + badgeValue.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
// mTvMarketAll.setText(sBuilderThird, TextView.BufferType.SPANNABLE);
// }
/** First Expandable Banner */
/** Third Expandable Banner */
/** Sum Expandable Banner */
// String allValue = String.format("%.02f", mFavValue);
......@@ -912,12 +881,12 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// } else {
// mLlDeals.setVisibility(View.GONE);
// }
/** Deals Badge */
if (WarplyManagerHelper.getActiveDFYCoupons() != null)
mTvDealsCountBadge.setText(String.valueOf(WarplyManagerHelper.getActiveDFYCoupons().size()));
else
mTvDealsCountBadge.setText("0");
/** Deals Badge */
if (WarplyManagerHelper.getConsumer() != null) {
mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name),
......@@ -992,38 +961,73 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
}
}
private void vouchersServiceUnavailableDialog() {
if (!isFinishing()) {
mLlVouchersSpinner.setVisibility(View.GONE);
mAlertDialogVouchersService = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_try_again)
.setMessage(R.string.cos_dlg_service_unavailable)
.setPositiveButton(R.string.cos_dlg_return, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
onBackPressed();
})
.setCancelable(false)
.show();
}
}
private void checkForEmpty() {
if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
/** Show spinner */
mLlVouchers.setVisibility(View.GONE);
mSeparator.setVisibility(View.VISIBLE);
mLlVouchersSpinner.setVisibility(View.VISIBLE);
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0)
&& (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() == 0)
&& (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() == 0)) {
if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
mLlBannerInfo.setVisibility(View.VISIBLE);
mLlVouchersSpinner.setVisibility(View.VISIBLE);
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
mLlBannerInfo.setVisibility(View.VISIBLE);
mLlVouchersSpinner.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.VISIBLE);
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("false")) {
mLlBannerInfo.setVisibility(View.GONE);
mLlVouchersSpinner.setVisibility(View.GONE);
/** Hide all and show empty view */
mLlVouchers.setVisibility(View.GONE);
mLlVouchersSpinner.setVisibility(View.GONE);
mSeparator.setVisibility(View.VISIBLE);
mLlEmptyWallet.setVisibility(View.VISIBLE);
}
} else {
/** Show loyalty banners and show spinner and hide empty view */
mLlEmptyWallet.setVisibility(View.GONE);
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0)
|| (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() > 0)
|| (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0)) {
mLlBannerInfo.setVisibility(View.VISIBLE);
}
if (TextUtils.isEmpty(WarplyManagerHelper.getShowVouchersBanner())) {
mLlVouchersSpinner.setVisibility(View.VISIBLE);
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
} else {
if (WarplyManagerHelper.getShowVouchersBanner().equals("true")) {
/** Hide spinner and hide empty view and show vouchers */
mLlVouchersSpinner.setVisibility(View.GONE);
mLlEmptyWallet.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.VISIBLE);
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0)
&& (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() == 0)
&& (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() == 0)) {
/** Hide loyalty banners and hide separator */
mSeparator.setVisibility(View.GONE);
mLlBannerInfo.setVisibility(View.GONE);
} else {
/** Show loyalty banners and show separator */
mSeparator.setVisibility(View.VISIBLE);
mLlBannerInfo.setVisibility(View.VISIBLE);
}
} else if (WarplyManagerHelper.getShowVouchersBanner().equals("false")) {
/** Hide spinner and hide vouchers */
mLlVouchersSpinner.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.GONE);
mSeparator.setVisibility(View.VISIBLE);
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0)
&& (WarplyManagerHelper.getMarketCouponsList() != null && WarplyManagerHelper.getMarketCouponsList().size() == 0)
&& (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() == 0)) {
/** Hide loyalty banners and show empty view */
mLlBannerInfo.setVisibility(View.GONE);
mLlEmptyWallet.setVisibility(View.VISIBLE);
} else {
/** Show loyalty banners and hide empty view */
mLlEmptyWallet.setVisibility(View.GONE);
mLlBannerInfo.setVisibility(View.VISIBLE);
}
}
}
}
......
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 25-Oct-23.
*/
public class VouchersServiceUnavailableEventModel {
private boolean serviceUnavailable;
public VouchersServiceUnavailableEventModel() {
this.serviceUnavailable = true;
}
public boolean isServiceUnavailable() {
return serviceUnavailable;
}
public void setServiceUnavailable(boolean serviceUnavailable) {
this.serviceUnavailable = serviceUnavailable;
}
}
......@@ -33,7 +33,7 @@ public class WarpConstants {
/**
* The version of the SDK installed in the device
*/
public static final String SDK_VERSION = "4.5.4.6";
public static final String SDK_VERSION = "4.5.5.4";
/**
* The URL of the server where it should ping
......
......@@ -18,6 +18,7 @@ import ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel;
import ly.warp.sdk.io.models.UnifiedCouponsEventModel;
import ly.warp.sdk.io.models.VouchersActivityEventModel;
import ly.warp.sdk.io.models.VouchersFetchedEventModel;
import ly.warp.sdk.io.models.VouchersServiceUnavailableEventModel;
import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
......@@ -61,6 +62,7 @@ public class WarplyEventBusManager {
private WarplyWebviewCallbackEventModel webviewCallback;
private WarplyWebviewActivityCallbackEventModel webviewActivityCallback;
private WarplyUnifiedActivatedEventModel unifiedActivated;
private VouchersServiceUnavailableEventModel serviceUnavailable;
public WarplyEventBusManager() {
......@@ -158,6 +160,10 @@ public class WarplyEventBusManager {
this.dealsAnalysis = dealsAnalysis;
}
public WarplyEventBusManager(VouchersServiceUnavailableEventModel serviceUnavailable) {
this.serviceUnavailable = serviceUnavailable;
}
public WarplyEventBusManager(WarplyCCMSEnabledModel ccmsActivated) {
this.ccmsActivated = ccmsActivated;
}
......@@ -299,4 +305,8 @@ public class WarplyEventBusManager {
public WarplyUnifiedActivatedEventModel getWarplyUnifiedActivatedEventModel() {
return unifiedActivated;
}
public VouchersServiceUnavailableEventModel getVouchersServiceUnavailableEventModel() {
return serviceUnavailable;
}
}
......
......@@ -205,7 +205,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_first_banner"
android:layout_marginHorizontal="16dp">
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp">
<RelativeLayout
android:layout_width="wrap_content"
......@@ -259,7 +260,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cos_green_tr"
android:background="@color/cos_creme"
android:gravity="center"
android:orientation="vertical">
......@@ -285,7 +286,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_second_banner"
android:layout_marginHorizontal="16dp">
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp">
<RelativeLayout
android:layout_width="wrap_content"
......@@ -339,7 +341,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cos_green_tr"
android:background="@color/cos_skyblue5"
android:gravity="center"
android:orientation="vertical">
......
......@@ -8,7 +8,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_loyalty_wallet_header"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="64dp"
android:background="@color/white">
<ImageView
......@@ -17,7 +17,7 @@
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:scaleType="centerInside"
android:src="@drawable/ic_back"
android:src="@drawable/ic_close"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -266,7 +266,7 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="1dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="1dp"
android:background="@drawable/shape_cos_counter_orange"
android:gravity="center"
......@@ -355,7 +355,7 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="1dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="1dp"
android:background="@drawable/shape_cos_counter_orange"
android:gravity="center"
......@@ -443,7 +443,7 @@
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="1dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="1dp"
android:background="@drawable/shape_cos_counter_orange"
android:gravity="center"
......@@ -465,27 +465,31 @@
</LinearLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_vouchers_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="14dp"
android:layout_marginTop="32dp"
android:orientation="vertical"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<ProgressBar
android:id="@+id/pb_vouchers"
android:layout_width="48dp"
android:layout_height="48dp"
android:theme="@style/progressBarGreen"/>
android:theme="@style/progressBarGreen" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_vouchers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="14dp"
android:layout_marginTop="32dp"
android:orientation="vertical"
android:visibility="gone"
......@@ -563,7 +567,6 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_empty_wallet"
......
......@@ -75,8 +75,8 @@
<string name="cos_gift_it">Δώρισέ το</string>
<string name="cos_popup_more_title">COSMOTE MORE FOR YOU</string>
<string name="cos_popup_more_subtitle">Σε αυτή την ενότητα βρες έρευνες, παιχνίδια, διαγωνισμούς και επιβραβεύσεις για τις αθλητικές σου δραστηριότητες!</string>
<string name="cos_deals_win_title">Έχεις κερδίσει&#160;%1$s€&#160;με το\nGIFTS FOR YOU!</string>
<string name="cos_deals_win_title_cos">Έχεις κερδίσει&#160;%1$s€&#160;με το\nDEALS FOR YOU!</string>
<string name="cos_deals_win_title">Μέχρι τώρα έχεις όφελος %1$s€ από τα GIFTS FOR YOU</string>
<string name="cos_deals_win_title_cos">Μέχρι τώρα έχεις όφελος %1$s€ από τα DEALS FOR YOU</string>
<string name="cos_mygifts">Τα δώρα μου</string>
<string name="cos_gifts_banner_title">Δώρα:</string>
<string name="cos_see_more">Δες περισσότερα</string>
......@@ -174,7 +174,7 @@
<string name="cos_coupon_date_limit">Ισχύει έως&#160;</string>
<string name="cos_coupon_date_limit2">%1$s</string>
<string name="cos_for_you_all">Μέχρι τώρα έχεις κερδίσει&#160;%1$s€&#160;στο For You!</string>
<string name="cos_supermarket_win">Έχεις κερδίσει&#160;%1$s€&#160;με τα\nSUPERMARKET DEALS!</string>
<string name="cos_supermarket_win">Μέχρι τώρα έχεις όφελος %1$s€ από τα SUPERMARKET DEALS</string>
<string name="cos_supermarket_history">Μέχρι τώρα έχεις κερδίσει %1$s€ σε προσφορές από %2$s κουπόνια!</string>
<string name="lbl_cosmote_webview_permission_title">COSMOTE</string>
<string name="lbl_cosmote_webview_permission_message">Το COSMOTE ζητάει πρόσβαση στην τοποθεσία σας.</string>
......@@ -205,6 +205,9 @@
<string name="cos_loyalty_history">Ιστορικό</string>
<string name="cos_redeemed_coupons_loyalty_title">Εξαργυρωμένα κουπόνια</string>
<string name="cos_history_info_text">Δες αναλυτικά το συνολικό όφελός σου έως τώρα από κουπόνια</string>
<string name="cos_dlg_try_again">Προσπάθησε ξανά αργότερα</string>
<string name="cos_dlg_service_unavailable">Προσωρινά μη διαθέσιμη πληροφορία.\nΠαρακαλούμε δοκίμασε ξανά σε λίγο.</string>
<string name="cos_dlg_return">Επιστροφή</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......