Showing
4 changed files
with
141 additions
and
35 deletions
... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
2 | 2 | ||
3 | ext { | 3 | ext { |
4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
5 | - PUBLISH_VERSION = '4.5.4-cosbeta19' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta20' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -110,14 +110,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -110,14 +110,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
110 | 110 | ||
111 | try { | 111 | try { |
112 | String key = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).keys().next(); | 112 | String key = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).keys().next(); |
113 | - if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) { | 113 | + if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) { |
114 | - String value = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).optString("loyaltyCampaignId"); | 114 | + String value = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).optString(key); |
115 | + if (!TextUtils.isEmpty(value) && value.equals("true")) { | ||
115 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 116 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
116 | - if (ccms.getLoyaltyCampaignId().equals(value)) { | 117 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
117 | startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms))); | 118 | startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms))); |
118 | return; | 119 | return; |
119 | } | 120 | } |
120 | } | 121 | } |
122 | + } else { | ||
123 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | ||
124 | + } | ||
121 | } | 125 | } |
122 | startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 126 | startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); |
123 | } catch (Exception exception) { | 127 | } catch (Exception exception) { | ... | ... |
... | @@ -26,6 +26,14 @@ public class LoyaltyContextualOfferModel { | ... | @@ -26,6 +26,14 @@ public class LoyaltyContextualOfferModel { |
26 | private String postpayProduct; | 26 | private String postpayProduct; |
27 | private String notificationMessage; | 27 | private String notificationMessage; |
28 | private String loyaltyCampaignId; | 28 | private String loyaltyCampaignId; |
29 | + private String businessService; | ||
30 | + private String UACIOfferTrackingCode; | ||
31 | + private String offerCode1; | ||
32 | + private String score; | ||
33 | + private String zone; | ||
34 | + private String wave; | ||
35 | + private String validity; | ||
36 | + private String offerAudienceLevel; | ||
29 | 37 | ||
30 | 38 | ||
31 | public LoyaltyContextualOfferModel() { | 39 | public LoyaltyContextualOfferModel() { |
... | @@ -48,6 +56,14 @@ public class LoyaltyContextualOfferModel { | ... | @@ -48,6 +56,14 @@ public class LoyaltyContextualOfferModel { |
48 | this.postpayProduct = ""; | 56 | this.postpayProduct = ""; |
49 | this.notificationMessage = ""; | 57 | this.notificationMessage = ""; |
50 | this.loyaltyCampaignId = ""; | 58 | this.loyaltyCampaignId = ""; |
59 | + this.businessService = ""; | ||
60 | + this.UACIOfferTrackingCode = ""; | ||
61 | + this.offerCode1 = ""; | ||
62 | + this.score = ""; | ||
63 | + this.zone = ""; | ||
64 | + this.wave = ""; | ||
65 | + this.validity = ""; | ||
66 | + this.offerAudienceLevel = ""; | ||
51 | } | 67 | } |
52 | 68 | ||
53 | public String getSessionId() { | 69 | public String getSessionId() { |
... | @@ -201,4 +217,68 @@ public class LoyaltyContextualOfferModel { | ... | @@ -201,4 +217,68 @@ public class LoyaltyContextualOfferModel { |
201 | public void setLoyaltyCampaignId(String loyaltyCampaignId) { | 217 | public void setLoyaltyCampaignId(String loyaltyCampaignId) { |
202 | this.loyaltyCampaignId = loyaltyCampaignId; | 218 | this.loyaltyCampaignId = loyaltyCampaignId; |
203 | } | 219 | } |
220 | + | ||
221 | + public String getBusinessService() { | ||
222 | + return businessService; | ||
223 | + } | ||
224 | + | ||
225 | + public void setBusinessService(String businessService) { | ||
226 | + this.businessService = businessService; | ||
227 | + } | ||
228 | + | ||
229 | + public String getUACIOfferTrackingCode() { | ||
230 | + return UACIOfferTrackingCode; | ||
231 | + } | ||
232 | + | ||
233 | + public void setUACIOfferTrackingCode(String UACIOfferTrackingCode) { | ||
234 | + this.UACIOfferTrackingCode = UACIOfferTrackingCode; | ||
235 | + } | ||
236 | + | ||
237 | + public String getOfferCode1() { | ||
238 | + return offerCode1; | ||
239 | + } | ||
240 | + | ||
241 | + public void setOfferCode1(String offerCode1) { | ||
242 | + this.offerCode1 = offerCode1; | ||
243 | + } | ||
244 | + | ||
245 | + public String getScore() { | ||
246 | + return score; | ||
247 | + } | ||
248 | + | ||
249 | + public void setScore(String score) { | ||
250 | + this.score = score; | ||
251 | + } | ||
252 | + | ||
253 | + public String getZone() { | ||
254 | + return zone; | ||
255 | + } | ||
256 | + | ||
257 | + public void setZone(String zone) { | ||
258 | + this.zone = zone; | ||
259 | + } | ||
260 | + | ||
261 | + public String getWave() { | ||
262 | + return wave; | ||
263 | + } | ||
264 | + | ||
265 | + public void setWave(String wave) { | ||
266 | + this.wave = wave; | ||
267 | + } | ||
268 | + | ||
269 | + public String getValidity() { | ||
270 | + return validity; | ||
271 | + } | ||
272 | + | ||
273 | + public void setValidity(String validity) { | ||
274 | + this.validity = validity; | ||
275 | + } | ||
276 | + | ||
277 | + public String getOfferAudienceLevel() { | ||
278 | + return offerAudienceLevel; | ||
279 | + } | ||
280 | + | ||
281 | + public void setOfferAudienceLevel(String offerAudienceLevel) { | ||
282 | + this.offerAudienceLevel = offerAudienceLevel; | ||
283 | + } | ||
204 | } | 284 | } | ... | ... |
... | @@ -255,6 +255,7 @@ public class WarplyManagerHelper { | ... | @@ -255,6 +255,7 @@ public class WarplyManagerHelper { |
255 | public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) { | 255 | public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) { |
256 | Log.v("CCMS_PRESSED", ccmsItem.getId() + " " + ccmsItem.getOfferName()); | 256 | Log.v("CCMS_PRESSED", ccmsItem.getId() + " " + ccmsItem.getOfferName()); |
257 | item.setNew(false); | 257 | item.setNew(false); |
258 | + String tempAudienceLevel = ccmsItem.getEligibleAssets() != null && ccmsItem.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID"; | ||
258 | String url = item.getIndexUrl() | 259 | String url = item.getIndexUrl() |
259 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) | 260 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) |
260 | + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) | 261 | + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) |
... | @@ -265,7 +266,7 @@ public class WarplyManagerHelper { | ... | @@ -265,7 +266,7 @@ public class WarplyManagerHelper { |
265 | + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id") | 266 | + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id") |
266 | + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret") | 267 | + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret") |
267 | + "&Session_ID=" + ccmsItem.getSessionId() | 268 | + "&Session_ID=" + ccmsItem.getSessionId() |
268 | - + "&businessService=" | 269 | + + "&businessService=" + ccmsItem.getBusinessService() |
269 | + "&offerName=" + ccmsItem.getOfferName() | 270 | + "&offerName=" + ccmsItem.getOfferName() |
270 | + "&productType=" + ccmsItem.getProductType() | 271 | + "&productType=" + ccmsItem.getProductType() |
271 | + "&provDuration=" + ccmsItem.getProvDuration() | 272 | + "&provDuration=" + ccmsItem.getProvDuration() |
... | @@ -277,16 +278,13 @@ public class WarplyManagerHelper { | ... | @@ -277,16 +278,13 @@ public class WarplyManagerHelper { |
277 | + "&minsValue=" + ccmsItem.getMinsValue() | 278 | + "&minsValue=" + ccmsItem.getMinsValue() |
278 | + "&dataValue=" + ccmsItem.getDataValue() | 279 | + "&dataValue=" + ccmsItem.getDataValue() |
279 | + "&provStepValueMins=" + ccmsItem.getProvStepValueMins() | 280 | + "&provStepValueMins=" + ccmsItem.getProvStepValueMins() |
280 | - + "&UACIOfferTrackingCode=" | 281 | + + "&UACIOfferTrackingCode=" + ccmsItem.getUACIOfferTrackingCode() |
281 | - + "&MSISDN=" | 282 | + + "&OFFERCODE1=" + ccmsItem.getOfferCode1() |
282 | - + "&OFFERCODE1=" | 283 | + + "&SCORE=" + ccmsItem.getScore() |
283 | - + "&SCORE=" | 284 | + + "&WAVE=" + ccmsItem.getWave() |
284 | - + "&ZONE=" | 285 | + + "&VALIDITY=" + ccmsItem.getValidity() |
285 | - + "&WAVE=" | 286 | + + "&TREATMENT_CODE=" + ccmsItem.getTreatmentCode() |
286 | - + "&VALIDITY=" | 287 | + + "&OfferAudienceLevel=" + tempAudienceLevel; |
287 | - + "&TREATMENT_CODE=" | ||
288 | - + "&GUID=" | ||
289 | - + "&OfferAudienceLevel="; | ||
290 | 288 | ||
291 | 289 | ||
292 | // if (mConsumer != null) | 290 | // if (mConsumer != null) |
... | @@ -307,10 +305,12 @@ public class WarplyManagerHelper { | ... | @@ -307,10 +305,12 @@ public class WarplyManagerHelper { |
307 | for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { | 305 | for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { |
308 | try { | 306 | try { |
309 | String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); | 307 | String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); |
310 | - if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) { | 308 | + if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) { |
311 | String keyValue = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key); | 309 | String keyValue = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key); |
312 | - if (keyValue.equals(item.getLoyaltyCampaignId())) { | 310 | + if (!TextUtils.isEmpty(keyValue) && keyValue.equals("true")) { |
311 | + if (camp.getSessionUUID().equals(item.getLoyaltyCampaignId())) { | ||
313 | Log.v("CCMS_PRESSED", item.getId() + " " + item.getOfferName()); | 312 | Log.v("CCMS_PRESSED", item.getId() + " " + item.getOfferName()); |
313 | + String tempAudienceLevel = item.getEligibleAssets() != null && item.getEligibleAssets().size() > 0 ? "MSISDN" : "GUID"; | ||
314 | url = camp.getIndexUrl() | 314 | url = camp.getIndexUrl() |
315 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) | 315 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) |
316 | + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) | 316 | + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) |
... | @@ -321,7 +321,7 @@ public class WarplyManagerHelper { | ... | @@ -321,7 +321,7 @@ public class WarplyManagerHelper { |
321 | + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id") | 321 | + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id") |
322 | + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret") | 322 | + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret") |
323 | + "&Session_ID=" + sessionId //item.getSessionId() | 323 | + "&Session_ID=" + sessionId //item.getSessionId() |
324 | - + "&businessService=" | 324 | + + "&businessService=" + item.getBusinessService() |
325 | + "&offerName=" + item.getOfferName() | 325 | + "&offerName=" + item.getOfferName() |
326 | + "&productType=" + item.getProductType() | 326 | + "&productType=" + item.getProductType() |
327 | + "&provDuration=" + item.getProvDuration() | 327 | + "&provDuration=" + item.getProvDuration() |
... | @@ -333,19 +333,17 @@ public class WarplyManagerHelper { | ... | @@ -333,19 +333,17 @@ public class WarplyManagerHelper { |
333 | + "&minsValue=" + item.getMinsValue() | 333 | + "&minsValue=" + item.getMinsValue() |
334 | + "&dataValue=" + item.getDataValue() | 334 | + "&dataValue=" + item.getDataValue() |
335 | + "&provStepValueMins=" + item.getProvStepValueMins() | 335 | + "&provStepValueMins=" + item.getProvStepValueMins() |
336 | - + "&UACIOfferTrackingCode=" | 336 | + + "&UACIOfferTrackingCode=" + item.getUACIOfferTrackingCode() |
337 | - + "&MSISDN=" | 337 | + + "&OFFERCODE1=" + item.getOfferCode1() |
338 | - + "&OFFERCODE1=" | 338 | + + "&SCORE=" + item.getScore() |
339 | - + "&SCORE=" | 339 | + + "&WAVE=" + item.getWave() |
340 | - + "&ZONE=" | 340 | + + "&VALIDITY=" + item.getValidity() |
341 | - + "&WAVE=" | 341 | + + "&TREATMENT_CODE=" + item.getTreatmentCode() |
342 | - + "&VALIDITY=" | 342 | + + "&OfferAudienceLevel=" + tempAudienceLevel; |
343 | - + "&TREATMENT_CODE=" | ||
344 | - + "&GUID=" | ||
345 | - + "&OfferAudienceLevel="; | ||
346 | break; | 343 | break; |
347 | } | 344 | } |
348 | } | 345 | } |
346 | + } | ||
349 | } catch (Exception exception) { | 347 | } catch (Exception exception) { |
350 | Log.v("WarplyManagerHelper_CCMS_Error", exception.toString()); | 348 | Log.v("WarplyManagerHelper_CCMS_Error", exception.toString()); |
351 | } | 349 | } |
... | @@ -367,20 +365,28 @@ public class WarplyManagerHelper { | ... | @@ -367,20 +365,28 @@ public class WarplyManagerHelper { |
367 | public static void setCCMSLoyaltyCampaigns(ArrayList<LoyaltyContextualOfferModel> list) { | 365 | public static void setCCMSLoyaltyCampaigns(ArrayList<LoyaltyContextualOfferModel> list) { |
368 | mCCMSList = list; | 366 | mCCMSList = list; |
369 | 367 | ||
370 | - if (list != null && list.size() == 0) { | 368 | + if (list == null || list.size() == 0) { |
371 | CampaignList tempGifts = new CampaignList(); | 369 | CampaignList tempGifts = new CampaignList(); |
372 | if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) { | 370 | if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) { |
373 | for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { | 371 | for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { |
374 | try { | 372 | try { |
375 | String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); | 373 | String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); |
376 | - if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) { | 374 | + if (!TextUtils.isEmpty(key)) { |
375 | + String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key); | ||
376 | + if (!(key.equals("ccms_offer") && value.equals("true"))) { | ||
377 | tempGifts.add(camp); | 377 | tempGifts.add(camp); |
378 | } | 378 | } |
379 | + } | ||
379 | } catch (Exception exception) { | 380 | } catch (Exception exception) { |
380 | - Log.v("WarplyManagerHelper_CCMS_Upper", exception.toString()); | 381 | + tempGifts.add(camp); |
381 | } | 382 | } |
382 | } | 383 | } |
383 | 384 | ||
385 | + Log.v("Got L:{" + String.valueOf(tempGifts.size()) + "}", " LOYALTY campaigns"); | ||
386 | + Log.v("Got C:{0}", " CCMS campaigns"); | ||
387 | + Log.v("Matched M:{0}", " CCMS campaigns"); | ||
388 | + Log.v("=====================================", ""); | ||
389 | + Log.v("TOTAL: Campaigns Sum=" + String.valueOf(tempGifts.size()), " campaigns to display"); | ||
384 | mUniqueCampaignList.get("gifts_for_you").removeAll(tempGifts); | 390 | mUniqueCampaignList.get("gifts_for_you").removeAll(tempGifts); |
385 | } | 391 | } |
386 | return; | 392 | return; |
... | @@ -388,24 +394,40 @@ public class WarplyManagerHelper { | ... | @@ -388,24 +394,40 @@ public class WarplyManagerHelper { |
388 | 394 | ||
389 | CampaignList tempGifts = new CampaignList(); | 395 | CampaignList tempGifts = new CampaignList(); |
390 | if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) { | 396 | if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) { |
397 | + int ccmsCount = 0; | ||
398 | + int loyaltyCount = 0; | ||
391 | for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { | 399 | for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { |
392 | try { | 400 | try { |
393 | String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); | 401 | String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); |
394 | - if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) { | 402 | + if (!TextUtils.isEmpty(key) && key.equals("ccms_offer")) { |
395 | - String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString("loyaltyCampaignId"); | 403 | + String value = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key); |
404 | + if (!TextUtils.isEmpty(value) && value.equals("true")) { | ||
396 | for (LoyaltyContextualOfferModel ccms : list) { | 405 | for (LoyaltyContextualOfferModel ccms : list) { |
397 | - if (ccms.getLoyaltyCampaignId().equals(value)) { | 406 | + if (ccms.getLoyaltyCampaignId().equals(camp.getSessionUUID())) { |
398 | tempGifts.add(camp); | 407 | tempGifts.add(camp); |
408 | + ccmsCount++; | ||
399 | break; | 409 | break; |
400 | } | 410 | } |
401 | } | 411 | } |
412 | + } else { | ||
413 | + tempGifts.add(camp); | ||
414 | + loyaltyCount++; | ||
415 | + } | ||
416 | + } else { | ||
417 | + tempGifts.add(camp); | ||
418 | + loyaltyCount++; | ||
402 | } | 419 | } |
403 | } catch (Exception exception) { | 420 | } catch (Exception exception) { |
404 | - Log.v("WarplyManagerHelper_CCMS", exception.toString()); | ||
405 | tempGifts.add(camp); | 421 | tempGifts.add(camp); |
422 | + loyaltyCount++; | ||
406 | } | 423 | } |
407 | } | 424 | } |
408 | 425 | ||
426 | + Log.v("Got L:{" + String.valueOf(loyaltyCount) + "}", " LOYALTY campaigns"); | ||
427 | + Log.v("Got C:{" + String.valueOf(list.size()) + "}", " CCMS campaigns"); | ||
428 | + Log.v("Matched M:{" + String.valueOf(ccmsCount) + "}", " CCMS campaigns"); | ||
429 | + Log.v("=====================================", ""); | ||
430 | + Log.v("TOTAL: Campaigns Sum=" + String.valueOf(loyaltyCount + ccmsCount), " campaigns to display"); | ||
409 | mUniqueCampaignList.get("gifts_for_you").retainAll(tempGifts); | 431 | mUniqueCampaignList.get("gifts_for_you").retainAll(tempGifts); |
410 | } | 432 | } |
411 | } | 433 | } | ... | ... |
-
Please register or login to post a comment