Panagiotis Triantafyllou

fixes

...@@ -133,6 +133,11 @@ ...@@ -133,6 +133,11 @@
133 android:permission="android.permission.BIND_JOB_SERVICE" /> 133 android:permission="android.permission.BIND_JOB_SERVICE" />
134 134
135 <service 135 <service
136 + android:name="ly.warp.sdk.services.EventCampaignCouponService"
137 + android:exported="false"
138 + android:permission="android.permission.BIND_JOB_SERVICE" />
139 +
140 + <service
136 android:name="ly.warp.sdk.services.EventCampaignService" 141 android:name="ly.warp.sdk.services.EventCampaignService"
137 android:exported="false" 142 android:exported="false"
138 android:permission="android.permission.BIND_JOB_SERVICE" /> 143 android:permission="android.permission.BIND_JOB_SERVICE" />
......
...@@ -339,52 +339,64 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -339,52 +339,64 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
339 mIvPopupClose.setOnClickListener(this); 339 mIvPopupClose.setOnClickListener(this);
340 340
341 if (mUniqueSectionList != null) { 341 if (mUniqueSectionList != null) {
342 - String firstKey = (String) mUniqueSectionList.keySet().toArray()[0]; 342 + try {
343 - if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) { 343 + String firstKey = (String) mUniqueSectionList.keySet().toArray()[0];
344 - mTvResearchSection.setText(firstKey.substring(1)); 344 + if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) {
345 - mResearchItems.setNestedScrollingEnabled(false); 345 + mTvResearchSection.setText(firstKey.substring(1));
346 - mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 346 + mResearchItems.setNestedScrollingEnabled(false);
347 - mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); 347 + mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
348 - mResearchItems.setAdapter(mAdapterResearch); 348 + mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
349 - mAdapterResearch.getPositionClicks() 349 + mResearchItems.setAdapter(mAdapterResearch);
350 - .doOnNext(this::handleMoreItemClick) 350 + mAdapterResearch.getPositionClicks()
351 - .doOnError(error -> { 351 + .doOnNext(this::handleMoreItemClick)
352 - }) 352 + .doOnError(error -> {
353 - .subscribe(); 353 + })
354 - 354 + .subscribe();
355 - mLlResearchItems.setVisibility(View.VISIBLE); 355 +
356 + mLlResearchItems.setVisibility(View.VISIBLE);
357 + }
358 + } catch (IndexOutOfBoundsException ex) {
359 + ex.printStackTrace();
356 } 360 }
357 361
358 - String secondKey = (String) mUniqueSectionList.keySet().toArray()[1]; 362 + try {
359 - if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) { 363 + String secondKey = (String) mUniqueSectionList.keySet().toArray()[1];
360 - mTvExclusiveSection.setText(secondKey.substring(1)); 364 + if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) {
361 - mExclusiveItems.setNestedScrollingEnabled(false); 365 + mTvExclusiveSection.setText(secondKey.substring(1));
362 - mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 366 + mExclusiveItems.setNestedScrollingEnabled(false);
363 - mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); 367 + mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
364 - mExclusiveItems.setAdapter(mAdapterExclusive); 368 + mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
365 - mAdapterExclusive.getPositionClicks() 369 + mExclusiveItems.setAdapter(mAdapterExclusive);
366 - .doOnNext(this::handleMoreItemClick) 370 + mAdapterExclusive.getPositionClicks()
367 - .doOnError(error -> { 371 + .doOnNext(this::handleMoreItemClick)
368 - }) 372 + .doOnError(error -> {
369 - .subscribe(); 373 + })
370 - 374 + .subscribe();
371 - mLlExclusiveItems.setVisibility(View.VISIBLE); 375 +
376 + mLlExclusiveItems.setVisibility(View.VISIBLE);
377 + }
378 + } catch (IndexOutOfBoundsException ex) {
379 + ex.printStackTrace();
372 } 380 }
373 381
374 - String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2]; 382 + try {
375 - if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) { 383 + String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2];
376 - mTvContestSection.setText(thirdKey.substring(1)); 384 + if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) {
377 - mContestItems.setNestedScrollingEnabled(false); 385 + mTvContestSection.setText(thirdKey.substring(1));
378 - mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 386 + mContestItems.setNestedScrollingEnabled(false);
379 - mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); 387 + mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
380 - mContestItems.setAdapter(mAdapterContest); 388 + mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
381 - mAdapterContest.getPositionClicks() 389 + mContestItems.setAdapter(mAdapterContest);
382 - .doOnNext(this::handleMoreItemClick) 390 + mAdapterContest.getPositionClicks()
383 - .doOnError(error -> { 391 + .doOnNext(this::handleMoreItemClick)
384 - }) 392 + .doOnError(error -> {
385 - .subscribe(); 393 + })
386 - 394 + .subscribe();
387 - mLlContestItems.setVisibility(View.VISIBLE); 395 +
396 + mLlContestItems.setVisibility(View.VISIBLE);
397 + }
398 + } catch (IndexOutOfBoundsException ex) {
399 + ex.printStackTrace();
388 } 400 }
389 401
390 if (mContextualList != null && mContextualList.size() > 0) { 402 if (mContextualList != null && mContextualList.size() > 0) {
...@@ -409,52 +421,64 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -409,52 +421,64 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
409 mIvPopupClose.setOnClickListener(this); 421 mIvPopupClose.setOnClickListener(this);
410 422
411 if (mUniqueSectionList != null) { 423 if (mUniqueSectionList != null) {
412 - String firstKey = (String) mUniqueSectionList.keySet().toArray()[0]; 424 + try {
413 - if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) { 425 + String firstKey = (String) mUniqueSectionList.keySet().toArray()[0];
414 - mTvResearchSection.setText(firstKey.substring(1)); 426 + if (mUniqueSectionList.get(firstKey) != null && mUniqueSectionList.get(firstKey).size() > 0) {
415 - mResearchItems.setNestedScrollingEnabled(false); 427 + mTvResearchSection.setText(firstKey.substring(1));
416 - mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); 428 + mResearchItems.setNestedScrollingEnabled(false);
417 - mResearchItems.setAdapter(mAdapterResearch); 429 + mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
418 - mAdapterResearch.getPositionClicks() 430 + mResearchItems.setAdapter(mAdapterResearch);
419 - .doOnNext(this::handleMoreItemClick) 431 + mAdapterResearch.getPositionClicks()
420 - .doOnError(error -> { 432 + .doOnNext(this::handleMoreItemClick)
421 - }) 433 + .doOnError(error -> {
422 - .subscribe(); 434 + })
423 - mAdapterResearch.notifyDataSetChanged(); 435 + .subscribe();
424 - 436 + mAdapterResearch.notifyDataSetChanged();
425 - mLlResearchItems.setVisibility(View.VISIBLE); 437 +
438 + mLlResearchItems.setVisibility(View.VISIBLE);
439 + }
440 + } catch (IndexOutOfBoundsException ex) {
441 + ex.printStackTrace();
426 } 442 }
427 443
428 - String secondKey = (String) mUniqueSectionList.keySet().toArray()[1]; 444 + try {
429 - if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) { 445 + String secondKey = (String) mUniqueSectionList.keySet().toArray()[1];
430 - mTvExclusiveSection.setText(secondKey.substring(1)); 446 + if (mUniqueSectionList.get(secondKey) != null && mUniqueSectionList.get(secondKey).size() > 0) {
431 - mExclusiveItems.setNestedScrollingEnabled(false); 447 + mTvExclusiveSection.setText(secondKey.substring(1));
432 - mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); 448 + mExclusiveItems.setNestedScrollingEnabled(false);
433 - mExclusiveItems.setAdapter(mAdapterExclusive); 449 + mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
434 - mAdapterExclusive.getPositionClicks() 450 + mExclusiveItems.setAdapter(mAdapterExclusive);
435 - .doOnNext(this::handleMoreItemClick) 451 + mAdapterExclusive.getPositionClicks()
436 - .doOnError(error -> { 452 + .doOnNext(this::handleMoreItemClick)
437 - }) 453 + .doOnError(error -> {
438 - .subscribe(); 454 + })
439 - mAdapterExclusive.notifyDataSetChanged(); 455 + .subscribe();
440 - 456 + mAdapterExclusive.notifyDataSetChanged();
441 - mLlExclusiveItems.setVisibility(View.VISIBLE); 457 +
458 + mLlExclusiveItems.setVisibility(View.VISIBLE);
459 + }
460 + } catch (IndexOutOfBoundsException ex) {
461 + ex.printStackTrace();
442 } 462 }
443 463
444 - String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2]; 464 + try {
445 - if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) { 465 + String thirdKey = (String) mUniqueSectionList.keySet().toArray()[2];
446 - mTvContestSection.setText(thirdKey.substring(1)); 466 + if (mUniqueSectionList.get(thirdKey) != null && mUniqueSectionList.get(thirdKey).size() > 0) {
447 - mContestItems.setNestedScrollingEnabled(false); 467 + mTvContestSection.setText(thirdKey.substring(1));
448 - mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); 468 + mContestItems.setNestedScrollingEnabled(false);
449 - mContestItems.setAdapter(mAdapterContest); 469 + mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
450 - mAdapterContest.getPositionClicks() 470 + mContestItems.setAdapter(mAdapterContest);
451 - .doOnNext(this::handleMoreItemClick) 471 + mAdapterContest.getPositionClicks()
452 - .doOnError(error -> { 472 + .doOnNext(this::handleMoreItemClick)
453 - }) 473 + .doOnError(error -> {
454 - .subscribe(); 474 + })
455 - mAdapterContest.notifyDataSetChanged(); 475 + .subscribe();
456 - 476 + mAdapterContest.notifyDataSetChanged();
457 - mLlContestItems.setVisibility(View.VISIBLE); 477 +
478 + mLlContestItems.setVisibility(View.VISIBLE);
479 + }
480 + } catch (IndexOutOfBoundsException ex) {
481 + ex.printStackTrace();
458 } 482 }
459 483
460 if (mContextualList != null && mContextualList.size() > 0) { 484 if (mContextualList != null && mContextualList.size() > 0) {
......
...@@ -102,6 +102,22 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -102,6 +102,22 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
102 super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); 102 super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
103 } 103 }
104 104
105 +// @Override
106 +// public void onRequestPermissionsResult(
107 +// int requestCode,
108 +// String permissions[],
109 +// int[] grantResults) {
110 +// switch (requestCode) {
111 +// case REQUEST_PERMISSION_PHONE_STATE:
112 +// if (grantResults.length > 0
113 +// && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
114 +// Toast.makeText(MainActivity.this, "Permission Granted!", Toast.LENGTH_SHORT).show();
115 +// } else {
116 +// Toast.makeText(MainActivity.this, "Permission Denied!", Toast.LENGTH_SHORT).show();
117 +// }
118 +// }
119 +// }
120 +
105 @Override 121 @Override
106 public void onMapReady(@NonNull GoogleMap googleMap) { 122 public void onMapReady(@NonNull GoogleMap googleMap) {
107 mMap = googleMap; 123 mMap = googleMap;
...@@ -115,6 +131,9 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe ...@@ -115,6 +131,9 @@ public class ShopsActivity extends FragmentActivity implements View.OnClickListe
115 } 131 }
116 } else { 132 } else {
117 mMap.setMyLocationEnabled(false); 133 mMap.setMyLocationEnabled(false);
134 +// ActivityCompat.requestPermissions(this,
135 +// new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
136 +// Manifest.permission.ACCESS_COARSE_LOCATION}, 501);
118 } 137 }
119 138
120 mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); 139 mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
......
...@@ -64,6 +64,7 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; ...@@ -64,6 +64,7 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
64 import ly.warp.sdk.io.models.CouponList; 64 import ly.warp.sdk.io.models.CouponList;
65 import ly.warp.sdk.io.request.PacingCalculateRequest; 65 import ly.warp.sdk.io.request.PacingCalculateRequest;
66 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 66 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
67 +import ly.warp.sdk.services.EventCampaignCouponService;
67 import ly.warp.sdk.services.EventQuestionnaireService; 68 import ly.warp.sdk.services.EventQuestionnaireService;
68 import ly.warp.sdk.services.PushEventsClickedWorkerService; 69 import ly.warp.sdk.services.PushEventsClickedWorkerService;
69 import ly.warp.sdk.services.WarplyHealthService; 70 import ly.warp.sdk.services.WarplyHealthService;
...@@ -151,9 +152,10 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -151,9 +152,10 @@ public class WarpViewActivity extends WarpBaseActivity {
151 setResult(RESULT_OK, new Intent()); 152 setResult(RESULT_OK, new Intent());
152 finish(); 153 finish();
153 } 154 }
154 -// if (event.getCoupon() != null) { 155 + if (event.getCoupon() != null) {
155 -// WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); 156 + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignCouponService.class).build();
156 -// } 157 + WorkManager.getInstance(WarpViewActivity.this).enqueue(mywork);
158 + }
157 // if (event.getPacingCard() != null) 159 // if (event.getPacingCard() != null)
158 // finish(); 160 // finish();
159 // if (event.getPacingService() != null) 161 // if (event.getPacingService() != null)
......
...@@ -198,14 +198,14 @@ public class Merchant implements Parcelable, Serializable, ClusterItem { ...@@ -198,14 +198,14 @@ public class Merchant implements Parcelable, Serializable, ClusterItem {
198 */ 198 */
199 public Merchant(JSONObject json) { 199 public Merchant(JSONObject json) {
200 if (json != null) { 200 if (json != null) {
201 - this.address = json.optString(ADDRESS); 201 + this.address = json.isNull(ADDRESS) ? "" : json.optString(ADDRESS);
202 this.id = json.optString(ID); 202 this.id = json.optString(ID);
203 this.store_id = json.optString(STORE_ID); 203 this.store_id = json.optString(STORE_ID);
204 - this.name = json.optString(NAME); 204 + this.name = json.isNull(NAME) ? "" : json.optString(NAME);
205 this.logo = json.optString(LOGO); 205 this.logo = json.optString(LOGO);
206 this.website = json.optString(WEBSITE); 206 this.website = json.optString(WEBSITE);
207 this.email = json.optString(EMAIL); 207 this.email = json.optString(EMAIL);
208 - this.telephone = json.optString(TELEPHONE); 208 + this.telephone = json.isNull(TELEPHONE) ? "" : json.optString(TELEPHONE);
209 this.category = json.optString(CATEGORY); 209 this.category = json.optString(CATEGORY);
210 this.description = json.optString(DESCRIPTION); 210 this.description = json.optString(DESCRIPTION);
211 this.short_description = json.optString(SHORT_DESCRIPTION); 211 this.short_description = json.optString(SHORT_DESCRIPTION);
......
1 +package ly.warp.sdk.services;
2 +
3 +import android.content.Context;
4 +
5 +import androidx.annotation.NonNull;
6 +import androidx.work.OneTimeWorkRequest;
7 +import androidx.work.WorkManager;
8 +import androidx.work.Worker;
9 +import androidx.work.WorkerParameters;
10 +
11 +import org.greenrobot.eventbus.EventBus;
12 +
13 +import ly.warp.sdk.Warply;
14 +import ly.warp.sdk.activities.CouponsetInfoActivity;
15 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
16 +import ly.warp.sdk.io.models.CampaignList;
17 +import ly.warp.sdk.io.models.CouponList;
18 +import ly.warp.sdk.io.models.CouponsEventModel;
19 +import ly.warp.sdk.io.models.LoyaltyEventModel;
20 +import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
21 +import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
22 +import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
23 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
24 +import ly.warp.sdk.utils.managers.WarplyManager;
25 +
26 +/**
27 + * Created by Panagiotis Triantafyllou on 05/Sept/2022.
28 + */
29 +public class EventCampaignCouponService extends Worker {
30 +
31 + public EventCampaignCouponService(@NonNull Context context, @NonNull WorkerParameters workerParams) {
32 + super(context, workerParams);
33 + }
34 +
35 + @NonNull
36 + @Override
37 + public Result doWork() {
38 + WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
39 + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
40 +
41 + return Result.success();
42 + }
43 +
44 + private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
45 + @Override
46 + public void onSuccess(CouponList result) {
47 + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
48 + couponsChanged.setChanged(true);
49 + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
50 + }
51 +
52 + @Override
53 + public void onFailure(int errorCode) {
54 + Thread.currentThread().interrupt();
55 + }
56 + };
57 +
58 + private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() {
59 + @Override
60 + public void onSuccess(CampaignList result) {
61 + LoyaltyEventModel campaignsAdded = new LoyaltyEventModel();
62 + EventBus.getDefault().post(new WarplyEventBusManager(campaignsAdded));
63 + }
64 +
65 + @Override
66 + public void onFailure(int errorCode) {
67 + Thread.currentThread().interrupt();
68 + }
69 + };
70 +}
...@@ -346,7 +346,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService { ...@@ -346,7 +346,7 @@ public class FCMBaseMessagingService extends FirebaseMessagingService {
346 nm.notify(tag, uid, notification_build); 346 nm.notify(tag, uid, notification_build);
347 }*/ 347 }*/
348 348
349 - public void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) { 349 + public static void showNotification(Context context, PushCampaign pc, Intent newIntent, List<NotificationCompat.Action> actions, RemoteViews remoteViews, String tag, int id) {
350 350
351 SecureRandom randomGenerator = new SecureRandom(); 351 SecureRandom randomGenerator = new SecureRandom();
352 int uid = randomGenerator.nextInt(1000); 352 int uid = randomGenerator.nextInt(1000);
......
...@@ -27,6 +27,8 @@ package ly.warp.sdk.utils; ...@@ -27,6 +27,8 @@ package ly.warp.sdk.utils;
27 27
28 import android.content.Context; 28 import android.content.Context;
29 import android.content.Intent; 29 import android.content.Intent;
30 +import android.content.pm.PackageManager;
31 +import android.os.Bundle;
30 import android.text.TextUtils; 32 import android.text.TextUtils;
31 import android.util.Log; 33 import android.util.Log;
32 34
...@@ -43,6 +45,7 @@ import java.io.Serializable; ...@@ -43,6 +45,7 @@ import java.io.Serializable;
43 import java.util.ArrayList; 45 import java.util.ArrayList;
44 import java.util.HashMap; 46 import java.util.HashMap;
45 import java.util.HashSet; 47 import java.util.HashSet;
48 +import java.util.Map;
46 49
47 import ly.warp.sdk.R; 50 import ly.warp.sdk.R;
48 import ly.warp.sdk.Warply; 51 import ly.warp.sdk.Warply;
...@@ -66,12 +69,14 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel; ...@@ -66,12 +69,14 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel;
66 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; 69 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
67 import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; 70 import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
68 import ly.warp.sdk.io.models.MerchantList; 71 import ly.warp.sdk.io.models.MerchantList;
72 +import ly.warp.sdk.io.models.PushCampaign;
69 import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; 73 import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
70 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; 74 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
71 import ly.warp.sdk.io.request.CosmoteSharingRequest; 75 import ly.warp.sdk.io.request.CosmoteSharingRequest;
72 import ly.warp.sdk.io.request.WarplyIntegrationRequest; 76 import ly.warp.sdk.io.request.WarplyIntegrationRequest;
73 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 77 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
74 import ly.warp.sdk.services.EventService; 78 import ly.warp.sdk.services.EventService;
79 +import ly.warp.sdk.services.FCMBaseMessagingService;
75 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 80 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
76 import ly.warp.sdk.utils.managers.WarplyManager; 81 import ly.warp.sdk.utils.managers.WarplyManager;
77 82
...@@ -1129,6 +1134,42 @@ public class WarplyManagerHelper { ...@@ -1129,6 +1134,42 @@ public class WarplyManagerHelper {
1129 mDealsSum = sum; 1134 mDealsSum = sum;
1130 } 1135 }
1131 1136
1137 + public static boolean checkForLoyaltySDKNotification(Map<String, String> pushPayload) {
1138 + Bundle data = convertToBundle(pushPayload);
1139 + if (data == null || !data.containsKey("loyalty-action"))
1140 + return false;
1141 + PushCampaign pc = new PushCampaign(data);
1142 +
1143 + WarpUtils.log("Received push with action: " + pc.getAction());
1144 + if (pc.getAction() == 0 && !pc.hasActions())
1145 + FCMBaseMessagingService.showCampaignNotification(Warply.getWarplyContext(), pc);
1146 + else
1147 + showDefaultNotification(Warply.getWarplyContext(), data);
1148 +
1149 + return true;
1150 + }
1151 +
1152 + private static Bundle convertToBundle(Map<String, String> data) {
1153 + Bundle bundle = new Bundle();
1154 + for (Map.Entry<String, String> entry : data.entrySet()) {
1155 + bundle.putString(entry.getKey(), entry.getValue());
1156 + }
1157 +
1158 + return bundle;
1159 + }
1160 +
1161 + private static void showDefaultNotification(Context context, Bundle data) {
1162 + PushCampaign pc = new PushCampaign(data);
1163 +
1164 + if (pc != null) {
1165 + PackageManager pm = context.getPackageManager();
1166 + Intent newIntent = pm.getLaunchIntentForPackage(context.getPackageName());
1167 +
1168 + FCMBaseMessagingService.showNotification(context, pc, newIntent, null, null, null, 0);
1169 + }
1170 +
1171 + }
1172 +
1132 // =========================================================== 1173 // ===========================================================
1133 // Inner and Anonymous Classes 1174 // Inner and Anonymous Classes
1134 // =========================================================== 1175 // ===========================================================
......
...@@ -418,7 +418,7 @@ public class WarpView extends WebView { ...@@ -418,7 +418,7 @@ public class WarpView extends WebView {
418 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); 418 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
419 } 419 }
420 } else if (parts[1].equals("couponRetrieved")) { 420 } else if (parts[1].equals("couponRetrieved")) {
421 -// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 421 + EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
422 } else if (parts[1].equals("couponShared")) { 422 } else if (parts[1].equals("couponShared")) {
423 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 423 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
424 } else if (parts[1].equals("steps") && parts[2].equals("widgetDisabled")) { // This is for the pacing widget 424 } else if (parts[1].equals("steps") && parts[2].equals("widgetDisabled")) { // This is for the pacing widget
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
52 android:layout_marginTop="4dp" 52 android:layout_marginTop="4dp"
53 android:clipToPadding="false" 53 android:clipToPadding="false"
54 android:orientation="vertical" 54 android:orientation="vertical"
55 - android:paddingTop="44dp" /> 55 + android:paddingTop="44dp"
56 + android:overScrollMode="never"/>
56 </RelativeLayout> 57 </RelativeLayout>
57 58
58 <TextView 59 <TextView
......
...@@ -115,7 +115,8 @@ ...@@ -115,7 +115,8 @@
115 android:layout_width="match_parent" 115 android:layout_width="match_parent"
116 android:layout_height="match_parent" 116 android:layout_height="match_parent"
117 android:layout_marginTop="-24dp" 117 android:layout_marginTop="-24dp"
118 - android:fillViewport="true"> 118 + android:fillViewport="true"
119 + android:overScrollMode="never">
119 120
120 <RelativeLayout 121 <RelativeLayout
121 android:layout_width="match_parent" 122 android:layout_width="match_parent"
......