Panagiotis Triantafyllou

changes for cosmote pass part3

...@@ -45,8 +45,6 @@ import org.json.JSONObject; ...@@ -45,8 +45,6 @@ import org.json.JSONObject;
45 import java.util.ArrayList; 45 import java.util.ArrayList;
46 import java.util.Collections; 46 import java.util.Collections;
47 import java.util.HashMap; 47 import java.util.HashMap;
48 -import java.util.HashSet;
49 -import java.util.Iterator;
50 import java.util.Map; 48 import java.util.Map;
51 import java.util.concurrent.ExecutorService; 49 import java.util.concurrent.ExecutorService;
52 import java.util.concurrent.Executors; 50 import java.util.concurrent.Executors;
...@@ -83,7 +81,6 @@ import ly.warp.sdk.io.request.WarplyIntegrationRequest; ...@@ -83,7 +81,6 @@ import ly.warp.sdk.io.request.WarplyIntegrationRequest;
83 import ly.warp.sdk.services.EventService; 81 import ly.warp.sdk.services.EventService;
84 import ly.warp.sdk.services.FCMBaseMessagingService; 82 import ly.warp.sdk.services.FCMBaseMessagingService;
85 import ly.warp.sdk.services.VouchersFetchedService; 83 import ly.warp.sdk.services.VouchersFetchedService;
86 -import ly.warp.sdk.services.WarplyHealthService;
87 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 84 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
88 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 85 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
89 import ly.warp.sdk.utils.managers.WarplyManager; 86 import ly.warp.sdk.utils.managers.WarplyManager;
...@@ -141,11 +138,22 @@ public class WarplyManagerHelper { ...@@ -141,11 +138,22 @@ public class WarplyManagerHelper {
141 // =========================================================== 138 // ===========================================================
142 139
143 public static String getMarketPassMapUrl(Context context) { 140 public static String getMarketPassMapUrl(Context context) {
144 - if (WarplyProperty.getAppUuid(context).equals("f83dfde1145e4c2da69793abb2f579af")) { 141 +// if (WarplyProperty.getAppUuid(context).equals("f83dfde1145e4c2da69793abb2f579af")) {
145 - return "https://dev.supermarketdeals.eu/map"; 142 +// return "https://dev.supermarketdeals.eu/map";
143 +// }
144 +//
145 +// return "https://supermarketdeals.eu/map";
146 +
147 +
148 + if (WarplyManagerHelper.getCampaignListAll() != null && !WarplyManagerHelper.getCampaignListAll().isEmpty()) {
149 + for (Campaign smCampaign : WarplyManagerHelper.getCampaignListAll()) {
150 + if (smCampaign.getOfferCategory().equals("more_for_you") && smCampaign.getFilter().equals("supermarket")) {
151 + return WarplyManagerHelper.openSupermarketCampaign(smCampaign);
152 + }
153 + }
146 } 154 }
147 155
148 - return "https://supermarketdeals.eu/map"; 156 + return "";
149 } 157 }
150 158
151 /** 159 /**
...@@ -182,6 +190,38 @@ public class WarplyManagerHelper { ...@@ -182,6 +190,38 @@ public class WarplyManagerHelper {
182 return url; 190 return url;
183 } 191 }
184 192
193 + public static String openSupermarketCampaign(Campaign item) {
194 + WarplyManager.getSingleCampaign(item.getSessionUUID());
195 + String url = item.getIndexUrl();
196 +// + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext())
197 +// + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext())
198 +// + "&api_key=" + WarpUtils.getApiKey(Warply.getWarplyContext())
199 +// + "&session_uuid=" + item.getSessionUUID()
200 +// + "&access_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
201 +// + "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token")
202 +// + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id")
203 +// + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret");
204 +
205 + JSONObject params = new JSONObject();
206 + try {
207 + params.putOpt("web_id", WarpUtils.getWebId(Warply.getWarplyContext()));
208 + params.putOpt("app_uuid", WarplyProperty.getAppUuid(Warply.getWarplyContext()));
209 + params.putOpt("api_key", WarpUtils.getApiKey(Warply.getWarplyContext()));
210 + params.putOpt("session_uuid", item.getSessionUUID());
211 + params.putOpt("access_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token"));
212 + params.putOpt("refresh_token", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token"));
213 + params.putOpt("client_id", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id"));
214 + params.putOpt("client_secret", WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret"));
215 + params.putOpt("map", "map");
216 + } catch (JSONException e) {
217 + e.printStackTrace();
218 + }
219 +
220 + WarpUtils.setWebviewParams(Warply.getWarplyContext(), params);
221 +
222 + return url;
223 + }
224 +
185 private static String constructCampaignUrl(Campaign item, String dlParam) { 225 private static String constructCampaignUrl(Campaign item, String dlParam) {
186 WarplyManager.getSingleCampaign(item.getSessionUUID()); 226 WarplyManager.getSingleCampaign(item.getSessionUUID());
187 String url = item.getIndexUrl(); 227 String url = item.getIndexUrl();
......