Panagiotis Triantafyllou

changes for cosmote pass part3

......@@ -45,8 +45,6 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
......@@ -83,7 +81,6 @@ import ly.warp.sdk.io.request.WarplyIntegrationRequest;
import ly.warp.sdk.services.EventService;
import ly.warp.sdk.services.FCMBaseMessagingService;
import ly.warp.sdk.services.VouchersFetchedService;
import ly.warp.sdk.services.WarplyHealthService;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -141,11 +138,22 @@ public class WarplyManagerHelper {
// ===========================================================
public static String getMarketPassMapUrl(Context context) {
if (WarplyProperty.getAppUuid(context).equals("f83dfde1145e4c2da69793abb2f579af")) {
return "https://dev.supermarketdeals.eu/map";
// if (WarplyProperty.getAppUuid(context).equals("f83dfde1145e4c2da69793abb2f579af")) {
// return "https://dev.supermarketdeals.eu/map";
// }
//
// return "https://supermarketdeals.eu/map";
if (WarplyManagerHelper.getCampaignListAll() != null && !WarplyManagerHelper.getCampaignListAll().isEmpty()) {
for (Campaign smCampaign : WarplyManagerHelper.getCampaignListAll()) {
if (smCampaign.getOfferCategory().equals("more_for_you") && smCampaign.getFilter().equals("supermarket")) {
return WarplyManagerHelper.openSupermarketCampaign(smCampaign);
}
}
}
return "https://supermarketdeals.eu/map";
return "";
}
/**
......@@ -182,6 +190,38 @@ public class WarplyManagerHelper {
return url;
}
public static String openSupermarketCampaign(Campaign item) {
WarplyManager.getSingleCampaign(item.getSessionUUID());
String url = item.getIndexUrl();
// + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
// + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
// + "&api_key=" + WarpUtils.getApiKey(Warply.getWarplyContext())
// + "&session_uuid=" + item.getSessionUUID()
// + "&access_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
// + "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token")
// + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
// + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret");
JSONObject params = new JSONObject();
try {
params.putOpt("web_id", WarpUtils.getWebId(Warply.getWarplyContext()));
params.putOpt("app_uuid", WarplyProperty.getAppUuid(Warply.getWarplyContext()));
params.putOpt("api_key", WarpUtils.getApiKey(Warply.getWarplyContext()));
params.putOpt("session_uuid", item.getSessionUUID());
params.putOpt("access_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
params.putOpt("refresh_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token"));
params.putOpt("client_id", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id"));
params.putOpt("client_secret", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret"));
params.putOpt("map", "map");
} catch (JSONException e) {
e.printStackTrace();
}
WarpUtils.setWebviewParams(Warply.getWarplyContext(), params);
return url;
}
private static String constructCampaignUrl(Campaign item, String dlParam) {
WarplyManager.getSingleCampaign(item.getSessionUUID());
String url = item.getIndexUrl();
......