Panagiotis Triantafyllou

new keys

......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000001018"), //6012049321, 6012049322, 6012049323
.setGuid("6012049322"), //6012049321, 6012049322, 6012049323
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta59i'
PUBLISH_VERSION = '4.5.4-cosbeta59'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -21,6 +21,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -31,9 +32,11 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -291,7 +294,9 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
couponsChanged.setChanged(true);
EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
}
@Override
......
......@@ -18,6 +18,7 @@ import androidx.work.WorkManager;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
......@@ -29,12 +30,14 @@ import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -274,6 +277,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
@Override
public void onSuccess(CouponList result) {
// Thread.currentThread().interrupt();
WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
couponsChanged.setChanged(true);
EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
}
@Override
......
......@@ -34,6 +34,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -64,11 +65,13 @@ import ly.warp.sdk.io.models.LoyaltyBadgeModel;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
import ly.warp.sdk.io.request.CosmoteSharingRequest;
import ly.warp.sdk.io.request.WarplyIntegrationRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.services.EventService;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
/**
......@@ -207,7 +210,9 @@ public class WarplyManagerHelper {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
couponsChanged.setChanged(true);
EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
}
@Override
......
......@@ -41,6 +41,7 @@ public class WarplyEventBusManager {
private LoyaltyEventModel campaignsAdded;
private HealthEventModel healthAdded;
private WarplyCouponsChangedEventModel couponsChanged;
private WarplyPacingCardEventModel widgetChanged;
public WarplyEventBusManager() {
......@@ -62,6 +63,10 @@ public class WarplyEventBusManager {
this.couponsAdded = couponsAdded;
}
public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) {
this.widgetChanged = widgetChanged;
}
public WarplyEventBusManager(HealthEventModel healthAdded) {
this.healthAdded = healthAdded;
}
......@@ -207,4 +212,8 @@ public class WarplyEventBusManager {
public WarplyCouponsChangedEventModel getCouponsChanged() {
return couponsChanged;
}
public WarplyPacingCardEventModel getWidgetChanged() {
return widgetChanged;
}
}
......
......@@ -84,7 +84,6 @@ import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.io.models.TagsCategoriesList;
import ly.warp.sdk.io.models.TagsList;
import ly.warp.sdk.io.models.TransactionsList;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
import ly.warp.sdk.io.request.CosmotePostEventRequest;
import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
......@@ -2286,9 +2285,6 @@ public class WarplyManager {
mActiveCouponList.add(coupon);
}
WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel();
couponsChanged.setChanged(true);
EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged));
receiver.onSuccess(mActiveCouponList);
}
......
......@@ -26,6 +26,7 @@
package ly.warp.sdk.views;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
......@@ -67,6 +68,7 @@ import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.io.models.CouponEventModel;
import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.services.WarplyHealthService;
import ly.warp.sdk.utils.WarpUtils;
......@@ -149,6 +151,16 @@ public class WarpView extends WebView {
initCustomActionHandler();
}
private boolean isMyServiceRunning(Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
private void initCustomActionHandler() {
String actionHandlerName = WarplyProperty.getWebActionListenerClassName(getContext());
......@@ -409,28 +421,24 @@ public class WarpView extends WebView {
// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
} else if (parts[1].equals("couponShared")) {
// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
} /*else if (parts[2].equals("serviceDisabled")) {
// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG);
WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
pacingService.setEnabled(false);
pacingService.setVisible(false);
EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
} else if (parts[2].equals("serviceEnabled")) {
WarplyPacingEventModel pacingService = new WarplyPacingEventModel();
pacingService.setEnabled(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingService));
}*/ else if (parts[1].equals("steps") && parts[2].equals("shortcutEnabled")) {
// PeriodicWorkRequest stepsWorker = new PeriodicWorkRequest.Builder(WarplyHealthService.class, 15, TimeUnit.MINUTES)
// .build();
// WorkManager.getInstance(Warply.getWarplyContext()).enqueue(stepsWorker);
} else if (parts[1].equals("steps") && parts[2].equals("widgetDisabled")) { // This is for the pacing widget
WarplyPacingCardEventModel pacingWidgetVisible = new WarplyPacingCardEventModel();
pacingWidgetVisible.setVisible(false);
EventBus.getDefault().post(new WarplyEventBusManager(pacingWidgetVisible));
} else if (parts[1].equals("steps") && parts[2].equals("widgetEnabled")) { // This is for the pacing widget
WarplyPacingCardEventModel pacingWidgetVisible = new WarplyPacingCardEventModel();
pacingWidgetVisible.setVisible(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingWidgetVisible));
} else if (parts[1].equals("steps") && parts[2].equals("shortcutEnabled")) { // This is for the pacing service
if (!isMyServiceRunning(WarplyHealthService.class)) {
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
Warply.getWarplyContext().startService(stepsServiceIntent);
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
} else if (parts[1].equals("steps") && parts[2].equals("shortcutDisabled")) {
// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWork();
}
} else if (parts[1].equals("steps") && parts[2].equals("shortcutDisabled")) { // This is for the pacing service
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
Warply.getWarplyContext().stopService(stepsServiceIntent);
......