Panagiotis Triantafyllou

uat fixes and changes

......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("6012049139"), //6012049321, 6012049322, 6012049323
.setGuid("7000001406"), //6012049321, 6012049322, 6012049323
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta49'
PUBLISH_VERSION = '4.5.4-cosbeta50'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -35,6 +35,7 @@ import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.services.EventService;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -59,6 +60,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
private AlertDialog mAlertDialogCouponset;
private Campaign mLoyalty;
private LoyaltyContextualOfferModel mCcms = null;
private AlertDialog mAlertDialogNonTelco;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -156,6 +158,15 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
// ===========================================================
private void initViews() {
if (WarplyManagerHelper.getConsumerInternal() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
if (profMetadata != null) {
if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) {
nonTelcoDialog();
}
}
}
mTvCouponsetTitle.setText(mCouponset.getName());
mTvCouponsetSubtitle.setText(Html.fromHtml(mCouponset.getDescription()));
mLlTerms.setOnClickListener(this);
......@@ -251,6 +262,16 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
}
private void nonTelcoDialog() {
mAlertDialogNonTelco = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_non_telco)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
onBackPressed();
})
.show();
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
......@@ -12,6 +12,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
......@@ -20,6 +21,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.Collections;
......@@ -32,6 +34,7 @@ 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.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
......@@ -58,6 +61,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
private float couponDfyValue = 0.0f;
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
private AlertDialog mAlertDialogNonTelco;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -170,6 +174,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
// ===========================================================
private void initViews() {
if(WarplyManagerHelper.getConsumerInternal() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
if(profMetadata != null) {
if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) {
nonTelcoDialog();
}
}
}
if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) {
mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList());
mRecyclerCoupons.setAdapter(mAdapterCoupons);
......@@ -307,6 +320,16 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
mClDealsView.setOnClickListener(this);
}
private void nonTelcoDialog() {
mAlertDialogNonTelco = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_non_telco)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
onBackPressed();
})
.show();
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
......@@ -13,6 +13,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
......@@ -22,15 +23,14 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.request.CosmotePostEventRequest;
import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -47,13 +47,16 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
// ===========================================================
private ImageView mIvBack, mIvCampaignPhoto;
private TextView mTvCampaignTitle, mTvCampaignSubtitle;
private TextView mTvCampaignTitle, mTvTelcoGiftValue, mTvTelcoGiftType, mTvTelcoHeaderTitle,
mTvTelcoGiftDuration, mTvSeeMoreValue;
private LoyaltyContextualOfferModel mCCMS = new LoyaltyContextualOfferModel();
private Campaign mLoyalty = new Campaign();
private LinearLayout mLlActivateOffer;
private Consumer mConsumer;
private String mSender = "";
private AlertDialog mAlertDialogAskActivate, mAlertDialogErrorActivating, mAlertDialogSuccessActivating;
private LinearLayout mLlSeeMore;
private boolean mIsSeeMoreShown = false;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -70,8 +73,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
mIvBack = findViewById(R.id.iv_telco_back);
mTvCampaignTitle = findViewById(R.id.textView13);
mIvCampaignPhoto = findViewById(R.id.imageView6);
mTvCampaignSubtitle = findViewById(R.id.textView14);
mLlActivateOffer = findViewById(R.id.ll_activate_button);
mTvTelcoGiftValue = findViewById(R.id.tv_telco_gift_value);
mTvTelcoGiftType = findViewById(R.id.tv_telco_gift_type);
mTvTelcoHeaderTitle = findViewById(R.id.tv_telco_header_title);
mTvTelcoGiftDuration = findViewById(R.id.tv_telco_gift_duration);
mLlSeeMore = findViewById(R.id.ll_see_more);
mTvSeeMoreValue = findViewById(R.id.tv_see_more_value);
initViews();
}
......@@ -97,18 +105,41 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
}
if (view.getId() == R.id.ll_activate_button) {
showActivationDialog();
return;
}
if (view.getId() == R.id.ll_see_more) {
if (mIsSeeMoreShown) {
mTvSeeMoreValue.setVisibility(View.GONE);
ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow);
seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_down_dark));
mIsSeeMoreShown = false;
} else {
mTvSeeMoreValue.setVisibility(View.VISIBLE);
ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow);
seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_up_dark));
mIsSeeMoreShown = true;
}
}
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
mTvCampaignTitle.setText(mCCMS.getTitle());
mTvCampaignSubtitle.setText(mCCMS.getSubtitle());
if (!TextUtils.isEmpty(mCCMS.getImageUrl())) {
mTvTelcoHeaderTitle.setText(mCCMS.getTitleOffer());
mTvCampaignTitle.setText(mCCMS.getDescription());
mTvTelcoGiftValue.setText(mCCMS.getGiftValue());
mTvTelcoGiftType.setText(mCCMS.getGiftType());
mTvTelcoGiftDuration.setText(mCCMS.getDuration());
mTvSeeMoreValue.setText(mCCMS.getTermsAndConditions());
if (!TextUtils.isEmpty(mCCMS.getImageOfferUrl())) {
Glide.with(this)
// .setDefaultRequestOptions(
// RequestOptions
......@@ -124,6 +155,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
}
mIvBack.setOnClickListener(this);
mLlActivateOffer.setOnClickListener(this);
mLlSeeMore.setOnClickListener(this);
}
private void showActivationDialog() {
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
......@@ -15,6 +16,9 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.TimeUnit;
......@@ -22,7 +26,12 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.GiftsForYouActivity;
import ly.warp.sdk.activities.TelcoActivity;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.MergedGifts;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarplyManagerHelper;
public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> {
......@@ -78,6 +87,33 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.
public void onBindViewHolder(final MergedGiftsViewHolder holder, int position) {
MergedGifts mergedgiftsItem = mMergedGifts.get(position);
if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 1) {
JSONObject extraFields = WarpJSONParser.getJSONFromString(mergedgiftsItem.getCampaign().getExtraFields());
if (extraFields != null) {
if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(mergedgiftsItem.getCampaign().getSessionUUID())) {
if (!TextUtils.isEmpty(ccms.getImageUrl())) {
Glide.with(mContext)
.load(ccms.getImageUrl())
.transform(new CenterCrop(), new RoundedCorners(4))
.diskCacheStrategy(DiskCacheStrategy.DATA)
.into(holder.ivMergedGiftsLogo);
} else {
Glide.with(mContext)
.load(R.drawable.ic_cosmote_logo_horizontal_grey)
.into(holder.ivMergedGiftsLogo);
}
holder.tvMergedGiftsTitle.setText(ccms.getTitle());
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem));
return;
}
}
return;
}
}
if (!TextUtils.isEmpty(mergedgiftsItem.getCampaign().getLogoUrl())) {
Glide.with(mContext)
.load(mergedgiftsItem.getCampaign().getLogoUrl())
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="@color/cos_blue5"
android:startColor="@color/cos_green" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<gradient
android:angle="180"
android:endColor="@color/cos_blue4"
android:startColor="@color/cos_green10" />
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@android:color/white" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<gradient
android:angle="180"
android:endColor="@color/cos_blue5"
android:startColor="@color/cos_green" />
<corners android:radius="1000dp" />
</shape>
</item>
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="1000dp" />
</shape>
</item>
</layer-list>
\ No newline at end of file
......@@ -56,4 +56,8 @@
<color name="cos_cyan4">#2EAFB9</color>
<color name="cos_dark_grey">#394A5B</color>
<color name="cos_white_tr">#9CFFFFFF</color>
<color name="cos_skyblue2">#22A9B5</color>
<color name="cos_blue4">#07A2D1</color>
<color name="cos_green10">#73CA34</color>
<color name="cos_blue5">#0D81B8</color>
</resources>
\ No newline at end of file
......
......@@ -126,6 +126,8 @@
<string name="cos_wrong_number_dlg">Το κινητό που καταχώρησες δεν είναι COSMOTE. Παρακαλούμε καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string>
<string name="cos_dlg_error_expired">Το δώρο έχει λήξει</string>
<string name="cos_dlg_error_used">Το δώρο έχει ήδη χρησιμοποιηθεί</string>
<string name="cos_see_more2">Δες Περισσότερα</string>
<string name="cos_dlg_non_telco">Παρακαλούμε πολύ πρόσθεσε τις συνδέσεις σου στην COSMOTE για να έχεις πρόσβαση στα προνόμια του νέου Loyalty προγράμματος της COSMOTE!</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......