Panagiotis Triantafyllou

new keys

...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { ...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
36 public void onWarplyReady() { 36 public void onWarplyReady() {
37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
39 - .setGuid("7000001018"), //6012049321, 6012049322, 6012049323 39 + .setGuid("6012049322"), //6012049321, 6012049322, 6012049323
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -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-cosbeta59i' 5 + PUBLISH_VERSION = '4.5.4-cosbeta59'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -21,6 +21,7 @@ import com.bumptech.glide.Glide; ...@@ -21,6 +21,7 @@ import com.bumptech.glide.Glide;
21 import com.bumptech.glide.load.engine.DiskCacheStrategy; 21 import com.bumptech.glide.load.engine.DiskCacheStrategy;
22 import com.google.android.material.bottomsheet.BottomSheetDialog; 22 import com.google.android.material.bottomsheet.BottomSheetDialog;
23 23
24 +import org.greenrobot.eventbus.EventBus;
24 import org.json.JSONArray; 25 import org.json.JSONArray;
25 import org.json.JSONException; 26 import org.json.JSONException;
26 import org.json.JSONObject; 27 import org.json.JSONObject;
...@@ -31,9 +32,11 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; ...@@ -31,9 +32,11 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
31 import ly.warp.sdk.io.models.Consumer; 32 import ly.warp.sdk.io.models.Consumer;
32 import ly.warp.sdk.io.models.Coupon; 33 import ly.warp.sdk.io.models.Coupon;
33 import ly.warp.sdk.io.models.CouponList; 34 import ly.warp.sdk.io.models.CouponList;
35 +import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
34 import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; 36 import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
35 import ly.warp.sdk.io.request.WarplyConsumerRequest; 37 import ly.warp.sdk.io.request.WarplyConsumerRequest;
36 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 38 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
39 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
37 import ly.warp.sdk.utils.managers.WarplyManager; 40 import ly.warp.sdk.utils.managers.WarplyManager;
38 41
39 42
...@@ -291,7 +294,9 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -291,7 +294,9 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
291 private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { 294 private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
292 @Override 295 @Override
293 public void onSuccess(CouponList result) { 296 public void onSuccess(CouponList result) {
294 - 297 + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
298 + couponsChanged.setChanged(true);
299 + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
295 } 300 }
296 301
297 @Override 302 @Override
......
...@@ -18,6 +18,7 @@ import androidx.work.WorkManager; ...@@ -18,6 +18,7 @@ import androidx.work.WorkManager;
18 import com.bumptech.glide.Glide; 18 import com.bumptech.glide.Glide;
19 import com.bumptech.glide.load.engine.DiskCacheStrategy; 19 import com.bumptech.glide.load.engine.DiskCacheStrategy;
20 20
21 +import org.greenrobot.eventbus.EventBus;
21 import org.json.JSONObject; 22 import org.json.JSONObject;
22 23
23 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 24 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
...@@ -29,12 +30,14 @@ import ly.warp.sdk.io.models.Coupon; ...@@ -29,12 +30,14 @@ import ly.warp.sdk.io.models.Coupon;
29 import ly.warp.sdk.io.models.CouponList; 30 import ly.warp.sdk.io.models.CouponList;
30 import ly.warp.sdk.io.models.Couponset; 31 import ly.warp.sdk.io.models.Couponset;
31 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; 32 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
33 +import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
32 import ly.warp.sdk.io.request.WarplyGetCampaignsRequest; 34 import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
33 import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; 35 import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
34 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 36 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
35 import ly.warp.sdk.services.EventCampaignService; 37 import ly.warp.sdk.services.EventCampaignService;
36 import ly.warp.sdk.utils.WarpUtils; 38 import ly.warp.sdk.utils.WarpUtils;
37 import ly.warp.sdk.utils.WarplyManagerHelper; 39 import ly.warp.sdk.utils.WarplyManagerHelper;
40 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
38 import ly.warp.sdk.utils.managers.WarplyManager; 41 import ly.warp.sdk.utils.managers.WarplyManager;
39 42
40 43
...@@ -274,6 +277,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe ...@@ -274,6 +277,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
274 @Override 277 @Override
275 public void onSuccess(CouponList result) { 278 public void onSuccess(CouponList result) {
276 // Thread.currentThread().interrupt(); 279 // Thread.currentThread().interrupt();
280 + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
281 + couponsChanged.setChanged(true);
282 + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
277 } 283 }
278 284
279 @Override 285 @Override
......
...@@ -34,6 +34,7 @@ import androidx.appcompat.app.AlertDialog; ...@@ -34,6 +34,7 @@ import androidx.appcompat.app.AlertDialog;
34 import androidx.work.OneTimeWorkRequest; 34 import androidx.work.OneTimeWorkRequest;
35 import androidx.work.WorkManager; 35 import androidx.work.WorkManager;
36 36
37 +import org.greenrobot.eventbus.EventBus;
37 import org.json.JSONArray; 38 import org.json.JSONArray;
38 import org.json.JSONException; 39 import org.json.JSONException;
39 import org.json.JSONObject; 40 import org.json.JSONObject;
...@@ -64,11 +65,13 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel; ...@@ -64,11 +65,13 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel;
64 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; 65 import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
65 import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; 66 import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
66 import ly.warp.sdk.io.models.MerchantList; 67 import ly.warp.sdk.io.models.MerchantList;
68 +import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
67 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; 69 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
68 import ly.warp.sdk.io.request.CosmoteSharingRequest; 70 import ly.warp.sdk.io.request.CosmoteSharingRequest;
69 import ly.warp.sdk.io.request.WarplyIntegrationRequest; 71 import ly.warp.sdk.io.request.WarplyIntegrationRequest;
70 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 72 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
71 import ly.warp.sdk.services.EventService; 73 import ly.warp.sdk.services.EventService;
74 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
72 import ly.warp.sdk.utils.managers.WarplyManager; 75 import ly.warp.sdk.utils.managers.WarplyManager;
73 76
74 /** 77 /**
...@@ -207,7 +210,9 @@ public class WarplyManagerHelper { ...@@ -207,7 +210,9 @@ public class WarplyManagerHelper {
207 WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() { 210 WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() {
208 @Override 211 @Override
209 public void onSuccess(CouponList result) { 212 public void onSuccess(CouponList result) {
210 - 213 + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
214 + couponsChanged.setChanged(true);
215 + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
211 } 216 }
212 217
213 @Override 218 @Override
......
...@@ -41,6 +41,7 @@ public class WarplyEventBusManager { ...@@ -41,6 +41,7 @@ public class WarplyEventBusManager {
41 private LoyaltyEventModel campaignsAdded; 41 private LoyaltyEventModel campaignsAdded;
42 private HealthEventModel healthAdded; 42 private HealthEventModel healthAdded;
43 private WarplyCouponsChangedEventModel couponsChanged; 43 private WarplyCouponsChangedEventModel couponsChanged;
44 + private WarplyPacingCardEventModel widgetChanged;
44 45
45 public WarplyEventBusManager() { 46 public WarplyEventBusManager() {
46 47
...@@ -62,6 +63,10 @@ public class WarplyEventBusManager { ...@@ -62,6 +63,10 @@ public class WarplyEventBusManager {
62 this.couponsAdded = couponsAdded; 63 this.couponsAdded = couponsAdded;
63 } 64 }
64 65
66 + public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) {
67 + this.widgetChanged = widgetChanged;
68 + }
69 +
65 public WarplyEventBusManager(HealthEventModel healthAdded) { 70 public WarplyEventBusManager(HealthEventModel healthAdded) {
66 this.healthAdded = healthAdded; 71 this.healthAdded = healthAdded;
67 } 72 }
...@@ -207,4 +212,8 @@ public class WarplyEventBusManager { ...@@ -207,4 +212,8 @@ public class WarplyEventBusManager {
207 public WarplyCouponsChangedEventModel getCouponsChanged() { 212 public WarplyCouponsChangedEventModel getCouponsChanged() {
208 return couponsChanged; 213 return couponsChanged;
209 } 214 }
215 +
216 + public WarplyPacingCardEventModel getWidgetChanged() {
217 + return widgetChanged;
218 + }
210 } 219 }
......
...@@ -84,7 +84,6 @@ import ly.warp.sdk.io.models.SharingList; ...@@ -84,7 +84,6 @@ import ly.warp.sdk.io.models.SharingList;
84 import ly.warp.sdk.io.models.TagsCategoriesList; 84 import ly.warp.sdk.io.models.TagsCategoriesList;
85 import ly.warp.sdk.io.models.TagsList; 85 import ly.warp.sdk.io.models.TagsList;
86 import ly.warp.sdk.io.models.TransactionsList; 86 import ly.warp.sdk.io.models.TransactionsList;
87 -import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
88 import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; 87 import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
89 import ly.warp.sdk.io.request.CosmotePostEventRequest; 88 import ly.warp.sdk.io.request.CosmotePostEventRequest;
90 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; 89 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
...@@ -2286,9 +2285,6 @@ public class WarplyManager { ...@@ -2286,9 +2285,6 @@ public class WarplyManager {
2286 mActiveCouponList.add(coupon); 2285 mActiveCouponList.add(coupon);
2287 } 2286 }
2288 2287
2289 - WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
2290 - couponsChanged.setChanged(true);
2291 - EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
2292 receiver.onSuccess(mActiveCouponList); 2288 receiver.onSuccess(mActiveCouponList);
2293 } 2289 }
2294 2290
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
26 package ly.warp.sdk.views; 26 package ly.warp.sdk.views;
27 27
28 import android.annotation.SuppressLint; 28 import android.annotation.SuppressLint;
29 +import android.app.ActivityManager;
29 import android.app.AlertDialog; 30 import android.app.AlertDialog;
30 import android.content.ActivityNotFoundException; 31 import android.content.ActivityNotFoundException;
31 import android.content.Context; 32 import android.content.Context;
...@@ -67,6 +68,7 @@ import ly.warp.sdk.Warply; ...@@ -67,6 +68,7 @@ import ly.warp.sdk.Warply;
67 import ly.warp.sdk.activities.WarpViewActivity; 68 import ly.warp.sdk.activities.WarpViewActivity;
68 import ly.warp.sdk.io.models.CouponEventModel; 69 import ly.warp.sdk.io.models.CouponEventModel;
69 import ly.warp.sdk.io.models.QuestionnaireEventModel; 70 import ly.warp.sdk.io.models.QuestionnaireEventModel;
71 +import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
70 import ly.warp.sdk.io.models.WarplyPacingEventModel; 72 import ly.warp.sdk.io.models.WarplyPacingEventModel;
71 import ly.warp.sdk.services.WarplyHealthService; 73 import ly.warp.sdk.services.WarplyHealthService;
72 import ly.warp.sdk.utils.WarpUtils; 74 import ly.warp.sdk.utils.WarpUtils;
...@@ -149,6 +151,16 @@ public class WarpView extends WebView { ...@@ -149,6 +151,16 @@ public class WarpView extends WebView {
149 initCustomActionHandler(); 151 initCustomActionHandler();
150 } 152 }
151 153
154 + private boolean isMyServiceRunning(Class<?> serviceClass) {
155 + ActivityManager manager = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
156 + for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
157 + if (serviceClass.getName().equals(service.service.getClassName())) {
158 + return true;
159 + }
160 + }
161 + return false;
162 + }
163 +
152 private void initCustomActionHandler() { 164 private void initCustomActionHandler() {
153 165
154 String actionHandlerName = WarplyProperty.getWebActionListenerClassName(getContext()); 166 String actionHandlerName = WarplyProperty.getWebActionListenerClassName(getContext());
...@@ -409,28 +421,24 @@ public class WarpView extends WebView { ...@@ -409,28 +421,24 @@ public class WarpView extends WebView {
409 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 421 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
410 } else if (parts[1].equals("couponShared")) { 422 } else if (parts[1].equals("couponShared")) {
411 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 423 // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
412 - } /*else if (parts[2].equals("serviceDisabled")) { 424 + } else if (parts[1].equals("steps") && parts[2].equals("widgetDisabled")) { // This is for the pacing widget
413 -// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG); 425 + WarplyPacingCardEventModel pacingWidgetVisible = new WarplyPacingCardEventModel();
414 - WarplyPacingEventModel pacingService = new WarplyPacingEventModel(); 426 + pacingWidgetVisible.setVisible(false);
415 - pacingService.setEnabled(false); 427 + EventBus.getDefault().post(new WarplyEventBusManager(pacingWidgetVisible));
416 - pacingService.setVisible(false); 428 + } else if (parts[1].equals("steps") && parts[2].equals("widgetEnabled")) { // This is for the pacing widget
417 - EventBus.getDefault().post(new WarplyEventBusManager(pacingService)); 429 + WarplyPacingCardEventModel pacingWidgetVisible = new WarplyPacingCardEventModel();
418 - } else if (parts[2].equals("serviceEnabled")) { 430 + pacingWidgetVisible.setVisible(true);
419 - WarplyPacingEventModel pacingService = new WarplyPacingEventModel(); 431 + EventBus.getDefault().post(new WarplyEventBusManager(pacingWidgetVisible));
420 - pacingService.setEnabled(true); 432 + } else if (parts[1].equals("steps") && parts[2].equals("shortcutEnabled")) { // This is for the pacing service
421 - EventBus.getDefault().post(new WarplyEventBusManager(pacingService)); 433 + if (!isMyServiceRunning(WarplyHealthService.class)) {
422 - }*/ else if (parts[1].equals("steps") && parts[2].equals("shortcutEnabled")) {
423 -// PeriodicWorkRequest stepsWorker = new PeriodicWorkRequest.Builder(WarplyHealthService.class, 15, TimeUnit.MINUTES)
424 -// .build();
425 -// WorkManager.getInstance(Warply.getWarplyContext()).enqueue(stepsWorker);
426 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); 434 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
427 Warply.getWarplyContext().startService(stepsServiceIntent); 435 Warply.getWarplyContext().startService(stepsServiceIntent);
428 436
429 WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel(); 437 WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
430 pacingVisible.setVisible(true); 438 pacingVisible.setVisible(true);
431 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); 439 EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
432 - } else if (parts[1].equals("steps") && parts[2].equals("shortcutDisabled")) { 440 + }
433 -// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWork(); 441 + } else if (parts[1].equals("steps") && parts[2].equals("shortcutDisabled")) { // This is for the pacing service
434 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); 442 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
435 Warply.getWarplyContext().stopService(stepsServiceIntent); 443 Warply.getWarplyContext().stopService(stepsServiceIntent);
436 444
......