Panagiotis Triantafyllou

REMOVE STEPS SERVICE

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.5.4r21'
PUBLISH_VERSION = '4.5.5.4r22'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -14,8 +14,8 @@
tools:node="remove" />
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />-->
<!-- <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />-->
<application android:largeHeap="true">
<!-- <meta-data-->
......@@ -116,12 +116,6 @@
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.LoyaltyWallet"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name="ly.warp.sdk.activities.ActiveGiftsActivity"
android:exported="false"
......@@ -234,11 +228,11 @@
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<service
android:name="ly.warp.sdk.services.WarplyHealthService"
android:exported="false"
android:foregroundServiceType="health"
android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- <service-->
<!-- android:name="ly.warp.sdk.services.WarplyHealthService"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="health"-->
<!-- android:permission="android.permission.BIND_JOB_SERVICE" />-->
<service
android:name="ly.warp.sdk.services.WarplyBeaconsRangingService"
......
......@@ -39,18 +39,13 @@ 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;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
......@@ -58,7 +53,6 @@ import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.ContextualActivity;
import ly.warp.sdk.activities.CouponsetInfoActivity;
import ly.warp.sdk.activities.GiftsForYouActivity;
import ly.warp.sdk.activities.TelcoActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
......@@ -76,22 +70,16 @@ 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.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.Merchant;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.models.PushCampaign;
import ly.warp.sdk.io.models.UnifiedCoupon;
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.WarplyConsumerRequest;
import ly.warp.sdk.io.request.WarplyEditConsumerRequest;
import ly.warp.sdk.io.request.WarplyIntegrationRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.services.EventService;
import ly.warp.sdk.services.EventUnifiedCouponsService;
import ly.warp.sdk.services.FCMBaseMessagingService;
import ly.warp.sdk.services.VouchersFetchedService;
import ly.warp.sdk.services.WarplyHealthService;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -1464,10 +1452,10 @@ public class WarplyManagerHelper {
}
public static void logoutUser() {
if (isMyServiceRunning(WarplyHealthService.class)) {
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
Warply.getWarplyContext().stopService(stepsServiceIntent);
}
// if (isMyServiceRunning(WarplyHealthService.class)) {
// Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
// Warply.getWarplyContext().stopService(stepsServiceIntent);
// }
}
private static boolean isMyServiceRunning(Class<?> serviceClass) {
......
......@@ -104,10 +104,8 @@ import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.services.WarplyHealthService;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.WarplyProperty;
......@@ -126,7 +124,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
private static final String URL_ACTION_MARKET = "market";
private static final String URL_ACTION_INTENT = "intent";
private static final String URL_ACTION_MARKET_AUTHORITY = "play.google.com";
private static final String TAG_STEPS_WORKER = "ly.warp.sdk.services.WarplyHealthService";
// ===========================================================
// Fields
......@@ -430,12 +427,12 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
if (mWebviewLoaded) {
String scriptSourceInit = "webviewDidFocus(" + String.valueOf(mWebviewLoaded) + "," + String.valueOf(isMyServiceRunning(WarplyHealthService.class)) + ");";
WarpView.this.evaluateJavascript(scriptSourceInit, s -> {
});
}
// if (mWebviewLoaded) {
// String scriptSourceInit = "webviewDidFocus(" + String.valueOf(mWebviewLoaded) + "," + String.valueOf(isMyServiceRunning(WarplyHealthService.class)) + ");";
// WarpView.this.evaluateJavascript(scriptSourceInit, s -> {
//
// });
// }
}
@Override
......@@ -549,29 +546,29 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
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)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_steps_activation");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
} else {
Warply.getWarplyContext().startService(stepsServiceIntent);
}
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(true);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
}
// if (!isMyServiceRunning(WarplyHealthService.class)) {
// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
// analyticsEvent.setEventName("loyalty_steps_activation");
// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
//
// Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
// } else {
// 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")) { // This is for the pacing service
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
Warply.getWarplyContext().stopService(stepsServiceIntent);
WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
pacingVisible.setVisible(false);
EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
// Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
// Warply.getWarplyContext().stopService(stepsServiceIntent);
//
// WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
// pacingVisible.setVisible(false);
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
} else if (parts[1].equals("request") || parts[1].equals("response")) {
WarpUtils.log("**************** WARPLY Webview Log START *****************");
WarpUtils.log(message);
......