Panagiotis Triantafyllou

ui fixes and changes

Showing 24 changed files with 101 additions and 53 deletions
......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000000832"), //6012049321, 6012049322, 6012049323
.setGuid("7000001407"), //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-cosbeta52'
PUBLISH_VERSION = '4.5.4-cosbeta54'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -32,7 +32,7 @@ android {
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
......
......@@ -27,5 +27,6 @@
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class ly.warp.sdk.**{*;}
-keep,includedescriptorclasses class net.sqlcipher.** { *; }
-keep,includedescriptorclasses interface net.sqlcipher.** { *; }
\ No newline at end of file
......
......@@ -22,7 +22,6 @@ import org.json.JSONObject;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
......@@ -34,8 +33,7 @@ import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
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.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -158,14 +156,9 @@ 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")) {
if (WarpUtils.getUserNonTelco(this)) {
nonTelcoDialog();
}
}
}
mTvCouponsetTitle.setText(mCouponset.getName());
mTvCouponsetSubtitle.setText(Html.fromHtml(mCouponset.getDescription()));
......
......@@ -11,7 +11,6 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
......@@ -22,7 +21,6 @@ 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.text.ParseException;
......@@ -39,7 +37,6 @@ 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;
......@@ -136,10 +133,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
return;
}
if (view.getId() == R.id.cl_deals_cos) {
//TODO: remove
WarpUtils.log("DFY coupon banner pressed!");
Toast.makeText(this, "TODO:Remove:DFY banner clicked", Toast.LENGTH_SHORT).show();
//TODO: remove
WarplyDealsAnalysisEventModel warplyDealsAnalysisEventModel = new WarplyDealsAnalysisEventModel();
warplyDealsAnalysisEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(warplyDealsAnalysisEventModel));
......@@ -183,14 +177,9 @@ 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")) {
if (WarpUtils.getUserNonTelco(this)) {
nonTelcoDialog();
}
}
}
if (WarplyManagerHelper.getCouponList() != null && WarplyManagerHelper.getCouponList().size() > 0) {
mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList());
......
......@@ -6,11 +6,15 @@ import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import org.json.JSONObject;
import ly.warp.sdk.Warply;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -32,6 +36,15 @@ public class EventQuestionnaireService extends Worker {
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumerInternal(result);
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco"));
}
}
}
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
@Override
public void onSuccess(CampaignList result) {
......
......@@ -114,7 +114,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
while (true) {
sendSteps();
try {
Thread.sleep(900000);
Thread.sleep(10000); //900000
} catch (InterruptedException e) {
e.printStackTrace();
}
......@@ -247,6 +247,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private void sendSteps() {
String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date());
if (WarpUtils.getStepsCounter(this) > 0) {
WarplyManager.setPacingDetails(new PacingCalculateRequest()
.setCounter(WarpUtils.getStepsCounter(this))
.setDate(date),
......@@ -266,4 +267,5 @@ public class WarplyHealthService extends Service implements SensorEventListener
}
});
}
}
}
......
......@@ -137,6 +137,8 @@ public class WarpUtils {
+ "webview_params";
private static final String PREFERENCES_STEPS_COUNTER = PREFERENCES_PREFIX
+ "steps_counter";
private static final String PREFERENCES_KEY_USER_NON_TELCO = PREFERENCES_PREFIX
+ "user_non_telco";
private static SharedPreferences _prefs;
......@@ -152,6 +154,16 @@ public class WarpUtils {
editor.apply();
}
public static boolean getUserNonTelco(Context context) {
return getPreferences(context).getBoolean(PREFERENCES_KEY_USER_NON_TELCO, false);
}
public static void setUserNonTelco(Context context, boolean userNonTelco) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putBoolean(PREFERENCES_KEY_USER_NON_TELCO, userNonTelco);
editor.apply();
}
/**
* Method used to return the token of this device for the GCM service
*
......
......@@ -726,7 +726,8 @@ public class WarplyManagerHelper {
* Save the LoyaltyGiftsForYouPackage list
*/
public static void setSeasonalList(ArrayList<LoyaltyGiftsForYouPackage> seasonalCoupons) {
mSeasonalList = seasonalCoupons;
mSeasonalList.clear();
mSeasonalList.addAll(seasonalCoupons);
}
/**
......
......@@ -25,10 +25,13 @@
package ly.warp.sdk.utils.managers;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import androidx.appcompat.app.AlertDialog;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -37,6 +40,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.AddressHook;
......@@ -517,6 +521,8 @@ public class WarplyManager {
WarpUtils.log("[WARP Trace] WARPLY Logout is active");
WarpUtils.log("**************************************************");
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
......@@ -803,6 +809,16 @@ public class WarplyManager {
@Override
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumerInternal(result);
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco"));
}
}
}
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
......@@ -2094,7 +2110,7 @@ public class WarplyManager {
});
}
public static void getPacingDetails(PacingDetailsRequest request, final CallbackReceiver<PacingDetails> receiver) {
public static void getPacingDetails(Context context, PacingDetailsRequest request, final CallbackReceiver<PacingDetails> receiver) {
WarpUtils.log("************* WARPLY Pacing Details Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Pacing Details Request is active");
WarpUtils.log("**************************************************");
......@@ -2102,6 +2118,16 @@ public class WarplyManager {
Warply.postReceiveMicroappData(true, "context", request.toJson(), new PacingDetailsHook(new CallbackReceiver<PacingDetails>() {
@Override
public void onSuccess(PacingDetails result) {
if (result.getMeters().getMonth().getValue() >= result.getMeters().getMonth().getGoal()) {
new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_success_title)
.setMessage(R.string.cos_dlg_pacing_goal)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.show();
}
receiver.onSuccess(result);
}
......@@ -2113,7 +2139,7 @@ public class WarplyManager {
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
getPacingDetails(request, receiver);
getPacingDetails(context, request, receiver);
else
receiver.onFailure(status);
}
......@@ -2287,6 +2313,16 @@ public class WarplyManager {
@Override
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumerInternal(result);
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco"));
}
}
}
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
......
......@@ -111,7 +111,7 @@ public class ExpiredCouponAdapter extends RecyclerView.Adapter<ExpiredCouponAdap
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(couponItem.getExpiration());
newDate = simpleDateFormat.parse(couponItem.getCreated());
} catch (ParseException e) {
e.printStackTrace();
}
......
......@@ -15,8 +15,8 @@
<ImageView
android:id="@+id/iv_coupons_close"
android:layout_width="21dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_back"
......
......@@ -15,8 +15,8 @@
<ImageView
android:id="@+id/iv_list_close"
android:layout_width="21dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_back"
......
......@@ -13,8 +13,8 @@
<ImageView
android:id="@+id/iv_contextual_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -13,8 +13,8 @@
<ImageView
android:id="@+id/iv_coupon_info_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -13,8 +13,8 @@
<ImageView
android:id="@+id/iv_coupon_share_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -13,8 +13,8 @@
<ImageView
android:id="@+id/iv_couponset_info_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -16,8 +16,8 @@
<ImageView
android:id="@+id/iv_list_close"
android:layout_width="21dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_back"
......
......@@ -15,8 +15,8 @@
<ImageView
android:id="@+id/iv_loyalty_analysis_close"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -13,8 +13,8 @@
<ImageView
android:id="@+id/iv_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -15,8 +15,8 @@
<ImageView
android:id="@+id/iv_list_close"
android:layout_width="21dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_back"
......
......@@ -13,8 +13,8 @@
<ImageView
android:id="@+id/iv_shops_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="26dp"
android:layout_height="25dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -13,8 +13,8 @@
<ImageView
android:id="@+id/iv_telco_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_close"
app:layout_constraintBottom_toBottomOf="parent"
......
......@@ -131,6 +131,7 @@
<string name="cos_directions">Οδηγίες</string>
<string name="cos_empty_shared_coupons">Δεν έχεις μοιραστεί ακόμη κουπόνια</string>
<string name="cos_empty_expired_coupons">Δεν έχεις εξαργυρώσει ακόμη κουπόνια</string>
<string name="cos_dlg_pacing_goal">Πέτυχες το στόχο του μήνα! Διάλεξε το δώρο που επιθυμείς να ενεργοποιήσεις!</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......