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("7000000826"), //6012049321, 6012049322, 6012049323, 7000000831 history
.setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta63'
PUBLISH_VERSION = '4.5.4-cosbeta65'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -55,6 +55,7 @@ dependencies {
api group: 'com.google.zxing', name: 'javase', version: '3.4.1'
api 'com.github.siyamed:android-shape-imageview:0.9.3'
implementation 'org.greenrobot:eventbus:3.3.1'
api 'com.google.android.flexbox:flexbox:3.0.0'
//------------------------------ Firebase -----------------------------//
api platform('com.google.firebase:firebase-bom:29.0.3')
......
......@@ -155,19 +155,14 @@ public enum Warply {
*/
private void isInitializedOrThrow() {
if (mContext == null)
throw (new RuntimeException(
"Warply has not been initialized, call init(Context) first"));
WarpUtils.log("Warply has not been initialized, call init(Context) first");
if (mContext.get() == null)
throw (new RuntimeException(
"Warply has not been initialized, call init(Context) first"));
WarpUtils.log("Warply has not been initialized, call init(Context) first");
String apiKey = WarplyProperty.getAppUuid(mContext.get());
if (apiKey == null)
throw (new RuntimeException(
"Warply application UUID has not been set in the Manifest"));
WarpUtils.log("Warply application UUID has not been set in the Manifest");
if ((apiKey.length() != 32) && (apiKey.length() != 36))
throw (new RuntimeException(
"Warply application UUID has not been set correclty in the Manifest, key got: "
+ apiKey));
WarpUtils.log("Warply application UUID has not been set correclty in the Manifest, key got: " + apiKey);
}
/**
......
......@@ -75,13 +75,13 @@ public class ContextualActivity extends Activity implements View.OnClickListener
public void onResume() {
super.onResume();
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getConsumer(new WarplyConsumerRequest()
, mConsumerCallback);
}
Thread.currentThread().interrupt();
}).start();
// new Thread(() -> {
// if (!Thread.currentThread().isInterrupted()) {
// WarplyManager.getConsumer(new WarplyConsumerRequest()
// , mConsumerCallback);
// }
// Thread.currentThread().interrupt();
// }).start();
}
@Override
......@@ -131,32 +131,50 @@ public class ContextualActivity extends Activity implements View.OnClickListener
ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close);
dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
if (mConsumer != null) {
try {
JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata());
if (profMeta != null) {
JSONArray msisdnList = new JSONArray();
msisdnList = profMeta.optJSONArray(MSISDN_LIST);
if (msisdnList != null && msisdnList.length() > 0) {
for (int i = 0; i < msisdnList.length(); i++) {
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null);
TextView textView = (TextView) v.findViewById(R.id.tv_phone_share);
textView.setText(msisdnList.optString(i));
textView.setOnClickListener(view -> {
TextView tv = (TextView) view;
mSender = tv.getText().toString();
bottomSheetDialog.dismiss();
askActivateDialog();
});
parent.addView(v, 0, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
}
}
}
} catch (JSONException e) {
e.printStackTrace();
// if (mConsumer != null) {
// try {
// JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata());
// if (profMeta != null) {
// JSONArray msisdnList = new JSONArray();
// msisdnList = profMeta.optJSONArray(MSISDN_LIST);
// if (msisdnList != null && msisdnList.length() > 0) {
// for (int i = 0; i < msisdnList.length(); i++) {
// LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null);
// TextView textView = (TextView) v.findViewById(R.id.tv_phone_share);
// textView.setText(msisdnList.optString(i));
// textView.setOnClickListener(view -> {
// TextView tv = (TextView) view;
// mSender = tv.getText().toString();
// bottomSheetDialog.dismiss();
// askActivateDialog();
// });
// parent.addView(v, 0, new ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.WRAP_CONTENT));
// }
// }
// }
// } catch (JSONException e) {
// e.printStackTrace();
// }
// }
if (mCCMS.getEligibleAssets() != null && mCCMS.getEligibleAssets().size() > 0) {
for (int i = 0; i < mCCMS.getEligibleAssets().size(); i++) {
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null);
TextView textView = (TextView) v.findViewById(R.id.tv_phone_share);
textView.setText(mCCMS.getEligibleAssets().get(i));
textView.setOnClickListener(view -> {
TextView tv = (TextView) view;
mSender = tv.getText().toString();
bottomSheetDialog.dismiss();
askActivateDialog();
});
parent.addView(v, 0, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
}
}
......
......@@ -217,7 +217,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
mTvCouponsValueAll.setText(sBuilder, TextView.BufferType.SPANNABLE);
if (WarplyManagerHelper.getCouponExpiredList() != null && WarplyManagerHelper.getCouponExpiredList().size() > 0) {
if (WarplyManagerHelper.getCouponExpiredList().size() >= 3) {
if (WarplyManagerHelper.getCouponExpiredList().size() > 3) {
ArrayList<Coupon> tempList = new ArrayList<>(WarplyManagerHelper.getCouponExpiredList().subList(0, 3));
mRvExpiredCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
......@@ -260,7 +260,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
runOnUiThread(() -> {
if (mSharedCoupons != null && mSharedCoupons.size() > 0) {
if (mSharedCoupons.size() >= 3) {
if (mSharedCoupons.size() > 3) {
ArrayList<SharingCoupon> tempList = new ArrayList<>(mSharedCoupons.subList(0, 3));
mRvSharedCoupons.setLayoutManager(new LinearLayoutManager(LoyaltyAnalysisActivity.this, LinearLayoutManager.VERTICAL, false));
......
......@@ -7,7 +7,9 @@ import android.os.Bundle;
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.TextView;
......@@ -19,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.flexbox.FlexboxLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
......@@ -26,6 +29,7 @@ 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;
......@@ -63,6 +67,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
private ConstraintLayout mClDealsBanner, mClDealsView,
mClGiftsBanner;
private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet;
FlexboxLayout mLlActiveCodesView;
private float couponDfyValue = 0.0f;
private RecyclerView mRecyclerCoupons;
private ActiveCouponAdapter mAdapterCoupons;
......@@ -96,6 +101,45 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
mTvActiveTitle = findViewById(R.id.tv_active_gifts);
mTvActiveCouponsHeader = findViewById(R.id.tv_active_coupons_header);
mLlEmptyWallet = findViewById(R.id.ll_empty_wallet);
mLlActiveCodesView = findViewById(R.id.ll_active_deals_codes_view);
ArrayList<ActiveDFYCouponModel> dlist = new ArrayList<>();
ActiveDFYCouponModel model = new ActiveDFYCouponModel();
model.setCode("123456789");
model.setValue("10");
model.setDate("2022-09-14 20:20");
dlist.add(model);
model = new ActiveDFYCouponModel();
model.setCode("123456780");
model.setValue("10");
model.setDate("2022-09-14 20:20");
dlist.add(model);
model = new ActiveDFYCouponModel();
model.setCode("123456781");
model.setValue("10");
model.setDate("2022-09-14 20:20");
dlist.add(model);
model = new ActiveDFYCouponModel();
model.setCode("123456782");
model.setValue("10");
model.setDate("2022-09-14 20:20");
dlist.add(model);
model = new ActiveDFYCouponModel();
model.setCode("123456783");
model.setValue("10");
model.setDate("2022-09-14 20:20");
dlist.add(model);
model = new ActiveDFYCouponModel();
model.setCode("123456784");
model.setValue("10");
model.setDate("2022-09-14 20:20");
dlist.add(model);
model = new ActiveDFYCouponModel();
model.setCode("123456785");
model.setValue("10");
model.setDate("2022-09-14 20:20");
dlist.add(model);
WarplyManagerHelper.setActiveDFYCoupons(dlist);
if (WarplyManagerHelper.getActiveDFYCoupons() != null) {
Collections.sort(WarplyManagerHelper.getActiveDFYCoupons(), new Comparator<ActiveDFYCouponModel>() {
......@@ -338,6 +382,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
String date1 = WarplyManagerHelper.getActiveDFYCoupons().get(0).getDate();
String date2 = dateFormat.format(new Date());
mTvActiveCode.setText(codes);
try {
Date toDate = dateFormat.parse(date2);
Date fromDate = dateFormat.parse(date1);
......@@ -348,14 +394,30 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
e.printStackTrace();
}
} else {
for (ActiveDFYCouponModel coupon : WarplyManagerHelper.getActiveDFYCoupons()) {
codes = codes + coupon.getCode() + ",";
}
codes = codes.substring(0, codes.length() - 1);
// for (ActiveDFYCouponModel coupon : WarplyManagerHelper.getActiveDFYCoupons()) {
// codes = codes + coupon.getCode() + ",";
// }
// codes = codes.substring(0, codes.length() - 1);
mTvActiveTitle.setText(String.format(getString(R.string.cos_active_deals_plural), String.valueOf(WarplyManagerHelper.getActiveDFYCoupons().size())));
mTvActiveCode.setVisibility(View.GONE);
for (ActiveDFYCouponModel dealsItem : WarplyManagerHelper.getActiveDFYCoupons()) {
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_selectable, null);
TextView textView = (TextView) v.findViewById(R.id.tv_code_copy);
TextView textViewComma = (TextView) v.findViewById(R.id.tv_code_comma);
textView.setText(dealsItem.getCode());
textView.setTextIsSelectable(true);
textViewComma.setText(getString(R.string.cos_comma));
mLlActiveCodesView.addView(v, 0, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
}
mLlActiveCodesView.setVisibility(View.VISIBLE);
}
mTvActiveCode.setText(codes);
// mTvActiveCode.setText(codes);
} else {
mIvDealsLogo.setVisibility(View.GONE);
mClDealsView.setVisibility(View.GONE);
......
......@@ -88,13 +88,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
public void onResume() {
super.onResume();
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getConsumer(new WarplyConsumerRequest()
, mConsumerCallback);
}
Thread.currentThread().interrupt();
}).start();
// new Thread(() -> {
// if (!Thread.currentThread().isInterrupted()) {
// WarplyManager.getConsumer(new WarplyConsumerRequest()
// , mConsumerCallback);
// }
// Thread.currentThread().interrupt();
// }).start();
}
@Override
......
......@@ -49,6 +49,7 @@ public class PacingDetails {
private static final String ENABLED = "enabled";
private static final String GOAL_REACHED = "goal_reached";
private static final String MESSAGE = "msg";
private static final String TITLE = "title";
private static final String SHORTCUT_ENABLED = "shortcut_enabled";
/* Member variables of the Campaign object */
......@@ -57,6 +58,7 @@ public class PacingDetails {
private boolean enabled = false;
private boolean goal_reached = false;
private String msg = "";
private String title = "";
private boolean shortcut_enabled = false;
/**
......@@ -90,6 +92,7 @@ public class PacingDetails {
this.goal_reached = result.optBoolean(GOAL_REACHED);
this.msg = result.optString(MESSAGE);
this.shortcut_enabled = result.optBoolean(SHORTCUT_ENABLED);
this.title = result.optString(TITLE);
}
}
}
......@@ -108,6 +111,7 @@ public class PacingDetails {
jObj.putOpt(GOAL_REACHED, this.goal_reached);
jObj.putOpt(MESSAGE, this.msg);
jObj.putOpt(SHORTCUT_ENABLED, this.shortcut_enabled);
jObj.putOpt(TITLE, this.title);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......@@ -360,4 +364,12 @@ public class PacingDetails {
public void setShortcut_enabled(boolean shortcut_enabled) {
this.shortcut_enabled = shortcut_enabled;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
......
......@@ -2165,7 +2165,7 @@ public class WarplyManager {
});
}
public static void getPacingDetails(Context context, PacingDetailsRequest request, final CallbackReceiver<PacingDetails> receiver) {
public static void getPacingDetails(PacingDetailsRequest request, final CallbackReceiver<PacingDetails> receiver) {
WarpUtils.log("************* WARPLY Pacing Details Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Pacing Details Request is active");
WarpUtils.log("**************************************************");
......@@ -2173,15 +2173,17 @@ public class WarplyManager {
Warply.postReceiveMicroappData(true, "context", request.toJson(), new PacingDetailsHook(new CallbackReceiver<PacingDetails>() {
@Override
public void onSuccess(PacingDetails result) {
if (result.isGoal_reached()) {
new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_success_title)
.setMessage(result.getMsg())
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.show();
}
// if (context != null) {
// if (result.isGoal_reached()) {
// new AlertDialog.Builder(context)
// .setTitle(R.string.cos_dlg_success_title)
// .setMessage(result.getMsg())
// .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
// dialogPositive.dismiss();
// })
// .show();
// }
// }
receiver.onSuccess(result);
}
......@@ -2194,7 +2196,7 @@ public class WarplyManager {
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getPacingDetails(context, request, receiver);
getPacingDetails(request, receiver);
else
receiver.onFailure(status);
}
......
......@@ -329,8 +329,20 @@
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/blue_dark"
android:textIsSelectable="true"
android:textSize="18sp"
tools:text="961544809" />
tools:text="961544809"
tools:visibility="gone" />
<com.google.android.flexbox.FlexboxLayout
android:id="@+id/ll_active_deals_codes_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_maxHeight="60dp"
android:visibility="gone"
app:alignContent="flex_start"
app:alignItems="flex_start"
app:flexWrap="wrap"></com.google.android.flexbox.FlexboxLayout>
<TextView
android:id="@+id/tv_active_deals_date_text"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_code_copy"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:textColor="@color/grey"
android:textSize="16sp"
tools:text="6987654322" />
<TextView
android:id="@+id/tv_code_comma"
fontPath="fonts/pf_square_sans_pro_medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:textColor="@color/grey"
android:textSize="16sp"
tools:text="@string/cos_comma" />
</LinearLayout>
\ No newline at end of file
......@@ -135,6 +135,7 @@
<string name="cos_mfy_other">ΆΛΛΕΣ</string>
<string name="cos_coupon_share_telco">Επιλογή σύνδεσης</string>
<string name="cos_steps_for_good_notification_subtitle">Περπάτησε κάθε μέρα περισσότερο για να ολοκληρώσεις το στόχο του μήνα και να ξεκλειδώσεις μοναδικές προσφορές!</string>
<string name="cos_comma">,</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......