Panagiotis Triantafyllou

feedback fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc68'
PUBLISH_VERSION = '4.5.4.6rc69'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -224,7 +224,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
mIvBarcode.setVisibility(View.GONE);
if (mIsUnified) {
mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getInnerText(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvCouponTitle.setText(HtmlCompat.fromHtml(mCoupon.getName(), HtmlCompat.FROM_HTML_MODE_COMPACT));
} else {
mTvCouponCode.setText(mCoupon.getCoupon());
mTvCouponTitle.setText(mCoupon.getName());
......
......@@ -7,8 +7,6 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
......@@ -36,11 +34,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.maps.android.clustering.Cluster;
import com.google.maps.android.clustering.ClusterManager;
import org.json.JSONArray;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
......@@ -48,7 +42,6 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.request.WarplyMerchantsRequest;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.constants.WarpConstants;
......@@ -187,15 +180,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
if (mCouponset != null) {
ArrayList<String> uuids = new ArrayList<>();
uuids.add(mCouponset.getMerchantUuid());
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
.setIsMultilingual(true)
.setParentUuids(uuids)
, mMerchantsCallback);
}
Thread.currentThread().interrupt();
}).start();
WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback);
} else {
ArrayList<String> catuuids = new ArrayList<>();
catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "2a6adade35f1484994a3d4c8f006b909" : "adcace6cab6049c7b7271bc85bc2b26d");
......@@ -229,7 +214,7 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title);
pinTitle.setText(merch.getAdminName());
pinTitle.setText(mMerchantParent != null ? mMerchantParent.getAdminName() : merch.getAdminName());
ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo);
if (!TextUtils.isEmpty(merch.getImgPreview())) {
......@@ -312,10 +297,14 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() {
@Override
public void onSuccess(MerchantList result) {
if (result.size() == 0) {
showNoShopsAvailableDialog();
return;
}
mMerchantList.clear();
mMerchantList.addAll(result);
new Handler(Looper.getMainLooper()).post(() -> {
// if (mClusterManager != null) {
// mMap.clear();
// mClusterManager.clearItems();
......@@ -329,10 +318,12 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
for (Merchant merchCoords : result) {
if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
nonNullCoords++;
} else {
mMerchantParent = merchCoords;
}
}
if (result.size() == 0 || nonNullCoords == 0) {
if (nonNullCoords == 0) {
showNoShopsAvailableDialog();
return;
}
......@@ -344,7 +335,6 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
.title(merch.getTitle())
.snippet(merch.getUuid()));
}
});
}
@Override
......
......@@ -7,8 +7,6 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
......@@ -43,7 +41,6 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.request.WarplyMerchantsRequest;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.constants.WarpConstants;
......@@ -184,15 +181,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
if (mCouponset != null) {
ArrayList<String> uuids = new ArrayList<>();
uuids.add(mCouponset.getMerchantUuid());
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
.setIsMultilingual(true)
.setParentUuids(uuids)
, mMerchantsCallback);
}
Thread.currentThread().interrupt();
}).start();
WarplyManager.getMerchantsMultilingual(true, uuids, mMerchantsCallback);
} else {
ArrayList<String> catuuids = new ArrayList<>();
catuuids.add(WarplyProperty.getAppUuid(this).equals("0086a2088301440792091b9f814c2267") ? "2a6adade35f1484994a3d4c8f006b909" : "adcace6cab6049c7b7271bc85bc2b26d");
......@@ -226,7 +215,7 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss());
TextView pinTitle = (TextView) bottomSheetDialog.findViewById(R.id.tv_pin_title);
pinTitle.setText(merch.getAdminName());
pinTitle.setText(mMerchantParent != null ? mMerchantParent.getAdminName() : merch.getAdminName());
ImageView pinLogo = (ImageView) bottomSheetDialog.findViewById(R.id.iv_pin_logo);
if (!TextUtils.isEmpty(merch.getImgPreview())) {
......@@ -325,10 +314,14 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
private final CallbackReceiver<MerchantList> mMerchantsCallback = new CallbackReceiver<MerchantList>() {
@Override
public void onSuccess(MerchantList result) {
if (result.size() == 0) {
showNoShopsAvailableDialog();
return;
}
mMerchantList.clear();
mMerchantList.addAll(result);
new Handler(Looper.getMainLooper()).post(() -> {
// if (mClusterManager != null) {
// mMap.clear();
// mClusterManager.clearItems();
......@@ -342,10 +335,12 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
for (Merchant merchCoords : result) {
if (merchCoords.getLatitude() != 0.0 && merchCoords.getLongitude() != 0.0) {
nonNullCoords++;
} else {
mMerchantParent = merchCoords;
}
}
if (result.size() == 0 || nonNullCoords == 0) {
if (nonNullCoords == 0) {
showNoShopsAvailableDialog();
return;
}
......@@ -358,7 +353,6 @@ public class ShopsHuaweiActivity extends FragmentActivity implements View.OnClic
.snippet(merch.getUuid())
.clusterable(true));
}
});
}
@Override
......
......@@ -2136,6 +2136,76 @@ public class WarplyManager {
});
}
public static void getMerchantsMultilingual(boolean isParent, ArrayList<String> parentuuids, final CallbackReceiver<MerchantList> receiver) {
WarpUtils.log("************* WARPLY Merchants Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Merchants Request is active");
WarpUtils.log("**************************************************");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
getMerchantsRetro(service, true, parentuuids, new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> responseMerchants) {
if (responseMerchants.code() == 200 && responseMerchants.body() != null) {
JSONObject jobjMerchantsResponse = null;
try {
jobjMerchantsResponse = new JSONObject(responseMerchants.body().string());
} catch (Exception e) {
e.printStackTrace();
}
if (jobjMerchantsResponse != null && jobjMerchantsResponse.has("status") && jobjMerchantsResponse.optString("status", "2").equals("1")) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_shops_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
JSONArray jMerchantsBody = null;
try {
jMerchantsBody = jobjMerchantsResponse.optJSONObject("context").optJSONObject("MAPP_SHOPS").optJSONArray("result");
} catch (Exception e) {
e.printStackTrace();
}
if (jMerchantsBody != null) {
MerchantList mMerchantList = new MerchantList();
final ExecutorService executorShops = Executors.newFixedThreadPool(1);
JSONArray finalMerchantsJBody = jMerchantsBody;
executorShops.submit(() -> {
for (int i = 0; i < finalMerchantsJBody.length(); ++i) {
mMerchantList.add(new Merchant(finalMerchantsJBody.optJSONObject(i)));
}
new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(mMerchantList));
executorShops.shutdownNow();
});
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_shops_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
} else {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_shops_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(responseMerchants.code());
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_shops_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
}
public static void getUserCouponsWithCouponsets(final CallbackReceiver<CouponList> receiver) {
WarpUtils.log("************* WARPLY User Coupons Request ********************");
WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active");
......@@ -2537,6 +2607,49 @@ public class WarplyManager {
});
}
private static void getMerchantsRetro(ApiService service, boolean isParent, ArrayList<String> parentuuids, Callback<ResponseBody> callback) {
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParamsShops = new ArrayMap<>();
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("action", "retrieve_multilingual");
jsonParams.put("categories", new JSONArray());
jsonParams.put("active", true);
jsonParams.put("location", null);
jsonParams.put("parent_uuids", new JSONArray(parentuuids));
jsonParams.put("tags", null);
jsonParams.put("default_shown", null);
jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext()));
jsonParamsShops.put("shops", jsonParams);
RequestBody merchantsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsShops)).toString());
Call<ResponseBody> merchantsCall = service.getMerchants(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
merchantsRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp)
);
merchantsCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
callback.onResponse(call, response);
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
callback.onFailure(call, t);
}
});
}
private static void getUserCouponsRetro(ApiService service, Callback<ResponseBody> callback) {
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
......
......@@ -84,6 +84,7 @@ import java.util.Map;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.LoyaltyWallet;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.models.CouponEventModel;
......@@ -480,6 +481,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
}
} else if (parts[1].equals("couponRetrieved")) {
EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
} else if (parts[1].equals("loyaltyWallet")) {
Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), LoyaltyWallet.class);
getContext().startActivity(intent);
} else if (parts[1].equals("ccmsRetrieved")) {
WarplyCCMSEnabledModel ccmsEnabled = new WarplyCCMSEnabledModel();
ccmsEnabled.setActivated(true);
......
......@@ -435,8 +435,8 @@
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="10dp"
android:text="@string/cos_market_title"
android:textColor="@color/cos_light_black"
android:textSize="20sp" />
android:textColor="@color/cos_light_blue"
android:textSize="19sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_market_coupons"
......@@ -572,8 +572,8 @@
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="10dp"
android:text="@string/cos_gifts_title"
android:textColor="@color/cos_light_black"
android:textSize="20sp" />
android:textColor="@color/cos_light_blue"
android:textSize="19sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_active_coupons"
......
......@@ -16,8 +16,8 @@
<string name="cos_profile_title">My Rewards</string>
<string name="cos_deals_title">Deals for You</string>
<string name="cos_profile_more">Δες περισσότερα</string>
<string name="cos_gifts_title">GIFTS for YOU</string>
<string name="cos_more_title">MORE for YOU</string>
<string name="cos_gifts_title">GIFTS FOR YOU</string>
<string name="cos_more_title">MORE FOR YOU</string>
<string name="menu_home">Αρχική</string>
<string name="menu_explore">Ανακάλυψε</string>
<string name="menu_shop">Shop</string>
......@@ -73,8 +73,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">Έχεις κερδίσει&#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_mygifts">Τα δώρα μου</string>
<string name="cos_gifts_banner_title">Δώρα:</string>
<string name="cos_see_more">Δες περισσότερα</string>
......@@ -151,7 +151,7 @@
<string name="cos_dlg_no_shops_title">Καταστήματα συνεργάτη</string>
<string name="cos_dlg_no_shops_positive">Δες το eshop</string>
<string name="cos_profile_preferences_placeholder">Οι προτιμήσεις μου</string>
<string name="cos_market_title">SuperMarket Deals</string>
<string name="cos_market_title">SUPERMARKET DEALS</string>
<string name="cos_rewards_title2">COSMOTE Επιβράβευση</string>
<string name="cos_market_item_title">COSMOTE\nSuperMarket\nDeals</string>
<string name="cos_market_active_coupons">έχεις %1$s ενεργά κουπόνια</string>
......@@ -169,7 +169,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">Έχεις κερδίσει&#160;%1$s€&#160;με τα\nSUPERMARKET 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>
......