Showing
6 changed files
with
92 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-cosbeta74' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta75' | 
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 
| 7 | } | 7 | } | 
| 8 | 8 | ... | ... | 
| ... | @@ -1309,7 +1309,7 @@ public enum Warply { | ... | @@ -1309,7 +1309,7 @@ public enum Warply { | 
| 1309 | isInitializedOrThrow(); | 1309 | isInitializedOrThrow(); | 
| 1310 | 1310 | ||
| 1311 | WarpUtils.log("************* WARPLY Microapp ********************"); | 1311 | WarpUtils.log("************* WARPLY Microapp ********************"); | 
| 1312 | - if (!WarplyServerPreferencesManager.isMicroAppActive(WarpConstants.MicroApp.APPLICATION_DATA)) { | 1312 | + if (!WarplyServerPreferencesManager.isMicroAppActive(WarpConstants.MicroApp.DEVICE_INFO)) { | 
| 1313 | WarpUtils.log("[WARP Trace] Application Info Microapp is not active"); | 1313 | WarpUtils.log("[WARP Trace] Application Info Microapp is not active"); | 
| 1314 | return; | 1314 | return; | 
| 1315 | } else { | 1315 | } else { | ... | ... | 
| ... | @@ -13,6 +13,8 @@ import android.widget.TextView; | ... | @@ -13,6 +13,8 @@ import android.widget.TextView; | 
| 13 | 13 | ||
| 14 | import androidx.recyclerview.widget.LinearLayoutManager; | 14 | import androidx.recyclerview.widget.LinearLayoutManager; | 
| 15 | import androidx.recyclerview.widget.RecyclerView; | 15 | import androidx.recyclerview.widget.RecyclerView; | 
| 16 | +import androidx.work.OneTimeWorkRequest; | ||
| 17 | +import androidx.work.WorkManager; | ||
| 16 | 18 | ||
| 17 | import org.greenrobot.eventbus.EventBus; | 19 | import org.greenrobot.eventbus.EventBus; | 
| 18 | import org.greenrobot.eventbus.Subscribe; | 20 | import org.greenrobot.eventbus.Subscribe; | 
| ... | @@ -32,10 +34,12 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | ... | @@ -32,10 +34,12 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 
| 32 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; | 34 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; | 
| 33 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; | 35 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; | 
| 34 | import ly.warp.sdk.io.models.MergedGifts; | 36 | import ly.warp.sdk.io.models.MergedGifts; | 
| 37 | +import ly.warp.sdk.services.EventCampaignService; | ||
| 35 | import ly.warp.sdk.utils.WarpJSONParser; | 38 | import ly.warp.sdk.utils.WarpJSONParser; | 
| 36 | import ly.warp.sdk.utils.WarpUtils; | 39 | import ly.warp.sdk.utils.WarpUtils; | 
| 37 | import ly.warp.sdk.utils.WarplyManagerHelper; | 40 | import ly.warp.sdk.utils.WarplyManagerHelper; | 
| 38 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 41 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 
| 42 | +import ly.warp.sdk.utils.managers.WarplyManager; | ||
| 39 | import ly.warp.sdk.views.adapters.MergedGiftsAdapter; | 43 | import ly.warp.sdk.views.adapters.MergedGiftsAdapter; | 
| 40 | 44 | ||
| 41 | 45 | ||
| ... | @@ -149,6 +153,14 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -149,6 +153,14 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 149 | super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); | 153 | super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); | 
| 150 | } | 154 | } | 
| 151 | 155 | ||
| 156 | + @Override | ||
| 157 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
| 158 | + if (requestCode == 1004) { | ||
| 159 | + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | ||
| 160 | + WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork); | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + | ||
| 152 | @Subscribe() | 164 | @Subscribe() | 
| 153 | public void onMessageEvent(WarplyEventBusManager event) { | 165 | public void onMessageEvent(WarplyEventBusManager event) { | 
| 154 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { | 166 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { | 
| ... | @@ -204,16 +216,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -204,16 +216,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 204 | String cpnUuid = campaignSettings.optString("couponset"); | 216 | String cpnUuid = campaignSettings.optString("couponset"); | 
| 205 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 217 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 
| 206 | if (cpns.getUuid().equals(cpnUuid)) { | 218 | if (cpns.getUuid().equals(cpnUuid)) { | 
| 219 | + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
| 207 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 220 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 
| 208 | intent.putExtra("couponset", (Serializable) cpns); | 221 | intent.putExtra("couponset", (Serializable) cpns); | 
| 209 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 222 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 
| 210 | intent.putExtra("ccms", ccmsItem); | 223 | intent.putExtra("ccms", ccmsItem); | 
| 211 | - startActivity(intent); | 224 | + startActivityForResult(intent, 1004); | 
| 212 | break; | 225 | break; | 
| 213 | } | 226 | } | 
| 214 | } | 227 | } | 
| 215 | } else { | 228 | } else { | 
| 216 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 229 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 217 | } | 230 | } | 
| 218 | } | 231 | } | 
| 219 | } catch (Exception exception) { | 232 | } catch (Exception exception) { | 
| ... | @@ -231,15 +244,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -231,15 +244,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 231 | String cpnUuid = campaignSettings.optString("couponset"); | 244 | String cpnUuid = campaignSettings.optString("couponset"); | 
| 232 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 245 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 
| 233 | if (cpns.getUuid().equals(cpnUuid)) { | 246 | if (cpns.getUuid().equals(cpnUuid)) { | 
| 247 | + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
| 234 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 248 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 
| 235 | intent.putExtra("couponset", (Serializable) cpns); | 249 | intent.putExtra("couponset", (Serializable) cpns); | 
| 236 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 250 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 
| 237 | - startActivity(intent); | 251 | + startActivityForResult(intent, 1004); | 
| 238 | break; | 252 | break; | 
| 239 | } | 253 | } | 
| 240 | } | 254 | } | 
| 241 | } else { | 255 | } else { | 
| 242 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 256 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 243 | } | 257 | } | 
| 244 | } | 258 | } | 
| 245 | } catch (Exception exception) { | 259 | } catch (Exception exception) { | 
| ... | @@ -255,10 +269,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -255,10 +269,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 255 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 269 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 
| 256 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 270 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 
| 257 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 271 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 
| 272 | + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
| 258 | Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | 273 | Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | 
| 259 | intent.putExtra("ccms", ccms); | 274 | intent.putExtra("ccms", ccms); | 
| 260 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 275 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 
| 261 | - startActivity(intent); | 276 | + startActivityForResult(intent, 1004); | 
| 262 | break; | 277 | break; | 
| 263 | } | 278 | } | 
| 264 | } | 279 | } | 
| ... | @@ -268,16 +283,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -268,16 +283,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 268 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 283 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 
| 269 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 284 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 
| 270 | WarpUtils.log("CCMS_CLICK " + ccms.toString()); | 285 | WarpUtils.log("CCMS_CLICK " + ccms.toString()); | 
| 271 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms))); | 286 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004); | 
| 272 | break; | 287 | break; | 
| 273 | } | 288 | } | 
| 274 | } | 289 | } | 
| 275 | } else { | 290 | } else { | 
| 276 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 291 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 277 | } | 292 | } | 
| 278 | } | 293 | } | 
| 279 | } catch (Exception exception) { | 294 | } catch (Exception exception) { | 
| 280 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 295 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 281 | } | 296 | } | 
| 282 | } else if (dataItem.getDataType() == 2) { | 297 | } else if (dataItem.getDataType() == 2) { | 
| 283 | LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent(); | 298 | LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent(); | 
| ... | @@ -340,16 +355,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -340,16 +355,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 340 | String cpnUuid = campaignSettings.optString("couponset"); | 355 | String cpnUuid = campaignSettings.optString("couponset"); | 
| 341 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 356 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 
| 342 | if (cpns.getUuid().equals(cpnUuid)) { | 357 | if (cpns.getUuid().equals(cpnUuid)) { | 
| 358 | + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
| 343 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 359 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 
| 344 | intent.putExtra("couponset", (Serializable) cpns); | 360 | intent.putExtra("couponset", (Serializable) cpns); | 
| 345 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 361 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 
| 346 | intent.putExtra("ccms", ccmsItem); | 362 | intent.putExtra("ccms", ccmsItem); | 
| 347 | - startActivity(intent); | 363 | + startActivityForResult(intent, 1004); | 
| 348 | break; | 364 | break; | 
| 349 | } | 365 | } | 
| 350 | } | 366 | } | 
| 351 | } else { | 367 | } else { | 
| 352 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 368 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 353 | } | 369 | } | 
| 354 | } | 370 | } | 
| 355 | } catch (Exception exception) { | 371 | } catch (Exception exception) { | 
| ... | @@ -367,15 +383,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -367,15 +383,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 367 | String cpnUuid = campaignSettings.optString("couponset"); | 383 | String cpnUuid = campaignSettings.optString("couponset"); | 
| 368 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 384 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 
| 369 | if (cpns.getUuid().equals(cpnUuid)) { | 385 | if (cpns.getUuid().equals(cpnUuid)) { | 
| 386 | + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
| 370 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 387 | Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | 
| 371 | intent.putExtra("couponset", (Serializable) cpns); | 388 | intent.putExtra("couponset", (Serializable) cpns); | 
| 372 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 389 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 
| 373 | - startActivity(intent); | 390 | + startActivityForResult(intent, 1004); | 
| 374 | break; | 391 | break; | 
| 375 | } | 392 | } | 
| 376 | } | 393 | } | 
| 377 | } else { | 394 | } else { | 
| 378 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 395 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 379 | } | 396 | } | 
| 380 | } | 397 | } | 
| 381 | } catch (Exception exception) { | 398 | } catch (Exception exception) { | 
| ... | @@ -391,10 +408,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -391,10 +408,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 391 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 408 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 
| 392 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 409 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 
| 393 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 410 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 
| 411 | + WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
| 394 | Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | 412 | Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | 
| 395 | intent.putExtra("ccms", ccms); | 413 | intent.putExtra("ccms", ccms); | 
| 396 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 414 | intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | 
| 397 | - startActivity(intent); | 415 | + startActivityForResult(intent, 1004); | 
| 398 | break; | 416 | break; | 
| 399 | } | 417 | } | 
| 400 | } | 418 | } | 
| ... | @@ -403,16 +421,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -403,16 +421,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | 
| 403 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 421 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 
| 404 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 422 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 
| 405 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 423 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 
| 406 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms))); | 424 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004); | 
| 407 | break; | 425 | break; | 
| 408 | } | 426 | } | 
| 409 | } | 427 | } | 
| 410 | } else { | 428 | } else { | 
| 411 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 429 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 412 | } | 430 | } | 
| 413 | } | 431 | } | 
| 414 | } catch (Exception exception) { | 432 | } catch (Exception exception) { | 
| 415 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | 433 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | 
| 416 | } | 434 | } | 
| 417 | } else if (dataItem.getDataType() == 2) { | 435 | } else if (dataItem.getDataType() == 2) { | 
| 418 | LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent(); | 436 | LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent(); | ... | ... | 
| ... | @@ -13,6 +13,8 @@ import android.widget.TextView; | ... | @@ -13,6 +13,8 @@ import android.widget.TextView; | 
| 13 | 13 | ||
| 14 | import androidx.recyclerview.widget.LinearLayoutManager; | 14 | import androidx.recyclerview.widget.LinearLayoutManager; | 
| 15 | import androidx.recyclerview.widget.RecyclerView; | 15 | import androidx.recyclerview.widget.RecyclerView; | 
| 16 | +import androidx.work.OneTimeWorkRequest; | ||
| 17 | +import androidx.work.WorkManager; | ||
| 16 | 18 | ||
| 17 | import org.greenrobot.eventbus.EventBus; | 19 | import org.greenrobot.eventbus.EventBus; | 
| 18 | import org.greenrobot.eventbus.Subscribe; | 20 | import org.greenrobot.eventbus.Subscribe; | 
| ... | @@ -31,6 +33,7 @@ import ly.warp.sdk.io.models.CampaignList; | ... | @@ -31,6 +33,7 @@ import ly.warp.sdk.io.models.CampaignList; | 
| 31 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 33 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 
| 32 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 34 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 
| 33 | import ly.warp.sdk.io.models.MergedMore; | 35 | import ly.warp.sdk.io.models.MergedMore; | 
| 36 | +import ly.warp.sdk.services.EventCampaignService; | ||
| 34 | import ly.warp.sdk.utils.WarpJSONParser; | 37 | import ly.warp.sdk.utils.WarpJSONParser; | 
| 35 | import ly.warp.sdk.utils.WarpUtils; | 38 | import ly.warp.sdk.utils.WarpUtils; | 
| 36 | import ly.warp.sdk.utils.WarplyManagerHelper; | 39 | import ly.warp.sdk.utils.WarplyManagerHelper; | 
| ... | @@ -174,6 +177,14 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -174,6 +177,14 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | 
| 174 | super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); | 177 | super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); | 
| 175 | } | 178 | } | 
| 176 | 179 | ||
| 180 | + @Override | ||
| 181 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
| 182 | + if (requestCode == 1003) { | ||
| 183 | + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | ||
| 184 | + WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork); | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + | ||
| 177 | @Subscribe() | 188 | @Subscribe() | 
| 178 | public void onMessageEvent(WarplyEventBusManager event) { | 189 | public void onMessageEvent(WarplyEventBusManager event) { | 
| 179 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { | 190 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { | 
| ... | @@ -520,16 +531,16 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -520,16 +531,16 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | 
| 520 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 531 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 
| 521 | if (ccms.getLoyaltyCampaignId().equals(moreItem.getSessionUUID())) { | 532 | if (ccms.getLoyaltyCampaignId().equals(moreItem.getSessionUUID())) { | 
| 522 | WarpUtils.log("CCMS_CLICK " + ccms.toString()); | 533 | WarpUtils.log("CCMS_CLICK " + ccms.toString()); | 
| 523 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(moreItem, ccms))); | 534 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(moreItem, ccms)), 1003); | 
| 524 | break; | 535 | break; | 
| 525 | } | 536 | } | 
| 526 | } | 537 | } | 
| 527 | } else { | 538 | } else { | 
| 528 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem))); | 539 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem)), 1003); | 
| 529 | } | 540 | } | 
| 530 | } | 541 | } | 
| 531 | } catch (Exception exception) { | 542 | } catch (Exception exception) { | 
| 532 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem))); | 543 | + startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem)), 1003); | 
| 533 | } | 544 | } | 
| 534 | } | 545 | } | 
| 535 | 546 | ... | ... | 
| ... | @@ -739,6 +739,7 @@ public class WarplyManagerHelper { | ... | @@ -739,6 +739,7 @@ public class WarplyManagerHelper { | 
| 739 | } | 739 | } | 
| 740 | } else if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 740 | } else if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 
| 741 | if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) { | 741 | if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) { | 
| 742 | + WarplyManager.getSingleCampaign(camp.getSessionUUID()); | ||
| 742 | Intent intent = new Intent(context, TelcoActivity.class); | 743 | Intent intent = new Intent(context, TelcoActivity.class); | 
| 743 | intent.putExtra("ccms", item); | 744 | intent.putExtra("ccms", item); | 
| 744 | intent.putExtra("loyalty", (Serializable) camp); | 745 | intent.putExtra("loyalty", (Serializable) camp); | 
| ... | @@ -775,6 +776,7 @@ public class WarplyManagerHelper { | ... | @@ -775,6 +776,7 @@ public class WarplyManagerHelper { | 
| 775 | String cpnUuid = campaignSettings.optString("couponset"); | 776 | String cpnUuid = campaignSettings.optString("couponset"); | 
| 776 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 777 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 
| 777 | if (cpns.getUuid().equals(cpnUuid)) { | 778 | if (cpns.getUuid().equals(cpnUuid)) { | 
| 779 | + WarplyManager.getSingleCampaign(item.getSessionUUID()); | ||
| 778 | Intent intent = new Intent(context, CouponsetInfoActivity.class); | 780 | Intent intent = new Intent(context, CouponsetInfoActivity.class); | 
| 779 | intent.putExtra("couponset", (Serializable) cpns); | 781 | intent.putExtra("couponset", (Serializable) cpns); | 
| 780 | intent.putExtra("loyalty", (Serializable) item); | 782 | intent.putExtra("loyalty", (Serializable) item); | 
| ... | @@ -802,6 +804,7 @@ public class WarplyManagerHelper { | ... | @@ -802,6 +804,7 @@ public class WarplyManagerHelper { | 
| 802 | String cpnUuid = campaignSettings.optString("couponset"); | 804 | String cpnUuid = campaignSettings.optString("couponset"); | 
| 803 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 805 | for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | 
| 804 | if (cpns.getUuid().equals(cpnUuid)) { | 806 | if (cpns.getUuid().equals(cpnUuid)) { | 
| 807 | + WarplyManager.getSingleCampaign(item.getSessionUUID()); | ||
| 805 | Intent intent = new Intent(context, CouponsetInfoActivity.class); | 808 | Intent intent = new Intent(context, CouponsetInfoActivity.class); | 
| 806 | intent.putExtra("couponset", (Serializable) cpns); | 809 | intent.putExtra("couponset", (Serializable) cpns); | 
| 807 | intent.putExtra("loyalty", (Serializable) item); | 810 | intent.putExtra("loyalty", (Serializable) item); | ... | ... | 
| ... | @@ -31,6 +31,8 @@ import android.os.Looper; | ... | @@ -31,6 +31,8 @@ import android.os.Looper; | 
| 31 | import android.util.Log; | 31 | import android.util.Log; | 
| 32 | 32 | ||
| 33 | import androidx.appcompat.app.AlertDialog; | 33 | import androidx.appcompat.app.AlertDialog; | 
| 34 | +import androidx.work.OneTimeWorkRequest; | ||
| 35 | +import androidx.work.WorkManager; | ||
| 34 | 36 | ||
| 35 | import org.greenrobot.eventbus.EventBus; | 37 | import org.greenrobot.eventbus.EventBus; | 
| 36 | import org.json.JSONArray; | 38 | import org.json.JSONArray; | 
| ... | @@ -133,6 +135,7 @@ import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | ... | @@ -133,6 +135,7 @@ import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 
| 133 | import ly.warp.sdk.io.request.WarplyValidateCouponRequest; | 135 | import ly.warp.sdk.io.request.WarplyValidateCouponRequest; | 
| 134 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; | 136 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; | 
| 135 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; | 137 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; | 
| 138 | +import ly.warp.sdk.services.EventCampaignService; | ||
| 136 | import ly.warp.sdk.utils.WarpJSONParser; | 139 | import ly.warp.sdk.utils.WarpJSONParser; | 
| 137 | import ly.warp.sdk.utils.WarpUtils; | 140 | import ly.warp.sdk.utils.WarpUtils; | 
| 138 | import ly.warp.sdk.utils.WarplyManagerHelper; | 141 | import ly.warp.sdk.utils.WarplyManagerHelper; | 
| ... | @@ -2577,19 +2580,41 @@ public class WarplyManager { | ... | @@ -2577,19 +2580,41 @@ public class WarplyManager { | 
| 2577 | WarpUtils.log("[WARP Trace] WARPLY Get Event Request is active"); | 2580 | WarpUtils.log("[WARP Trace] WARPLY Get Event Request is active"); | 
| 2578 | WarpUtils.log("**************************************************"); | 2581 | WarpUtils.log("**************************************************"); | 
| 2579 | 2582 | ||
| 2580 | -// String url = WarplyProperty.getBaseUrl(Warply.getWarplyContext()) + WarpConstants.BASE_REMOTE_PAGE_URL + sessionUuid; | 2583 | + String url = WarplyProperty.getBaseUrl(Warply.getWarplyContext()) + WarpConstants.BASE_REMOTE_PAGE_URL + sessionUuid; | 
| 2581 | -// | 2584 | + | 
| 2582 | -// Warply.getSingleCampaign(null, url, | 2585 | + Warply.getSingleCampaign(null, url, | 
| 2583 | -// new CallbackReceiver<JSONObject>() { | 2586 | + new CallbackReceiver<JSONObject>() { | 
| 2584 | -// @Override | 2587 | + @Override | 
| 2585 | -// public void onSuccess(JSONObject result) { | 2588 | + public void onSuccess(JSONObject result) { | 
| 2586 | -// WarpUtils.log("GET_SINGLE_CAMPAIGN_SUCCESS"); | 2589 | + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { | 
| 2587 | -// } | 2590 | + @Override | 
| 2588 | -// | 2591 | + public void onSuccess(CampaignList result) { | 
| 2589 | -// @Override | 2592 | + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | 
| 2590 | -// public void onFailure(int errorCode) { | 2593 | + WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | 
| 2591 | -// WarpUtils.log("GET_SINGLE_CAMPAIGN_FAILED"); | 2594 | + } | 
| 2592 | -// } | 2595 | + | 
| 2593 | -// }, null); | 2596 | + @Override | 
| 2597 | + public void onFailure(int errorCode) { | ||
| 2598 | + | ||
| 2599 | + } | ||
| 2600 | + }); | ||
| 2601 | + } | ||
| 2602 | + | ||
| 2603 | + @Override | ||
| 2604 | + public void onFailure(int errorCode) { | ||
| 2605 | + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { | ||
| 2606 | + @Override | ||
| 2607 | + public void onSuccess(CampaignList result) { | ||
| 2608 | + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | ||
| 2609 | + WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | ||
| 2610 | + } | ||
| 2611 | + | ||
| 2612 | + @Override | ||
| 2613 | + public void onFailure(int errorCode) { | ||
| 2614 | + | ||
| 2615 | + } | ||
| 2616 | + }); | ||
| 2617 | + } | ||
| 2618 | + }, null); | ||
| 2594 | } | 2619 | } | 
| 2595 | } | 2620 | } | ... | ... | 
- 
Please register or login to post a comment