Panagiotis Triantafyllou

REMOVE STEPS

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.5.4r32'
PUBLISH_VERSION = '4.5.5.4r33'
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" />-->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
......@@ -230,11 +230,11 @@
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<service
android:name=".services.WarplyHealthService"
android:exported="false"
android:foregroundServiceType="health"
android:permission="android.permission.FOREGROUND_SERVICE" />
<!-- <service-->
<!-- android:name=".services.WarplyHealthService"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="health"-->
<!-- android:permission="android.permission.FOREGROUND_SERVICE" />-->
<service
android:name=".services.WarplyBeaconsRangingService"
......@@ -288,14 +288,14 @@
android:name=".receivers.WarplyInAppNotificationReceiver"
android:exported="false" />
<receiver
android:name=".receivers.RestartHealthServiceReceiver"
android:exported="false">
<intent-filter>
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<action android:name="android.intent.action.RESTART" />
</intent-filter>
</receiver>
<!-- <receiver-->
<!-- android:name=".receivers.RestartHealthServiceReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!--&lt;!&ndash; <action android:name="android.intent.action.BOOT_COMPLETED" />&ndash;&gt;-->
<!-- <action android:name="android.intent.action.RESTART" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <provider-->
<!-- android:name=".utils.WarplyProvider"-->
......
......@@ -1478,10 +1478,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) {
......
......@@ -977,20 +977,20 @@ public class WarplyManager {
WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge"));
}
if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
if (!isMyServiceRunning(WarplyHealthService.class)) {
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 (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
// if (!isMyServiceRunning(WarplyHealthService.class)) {
// 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));
// }
// }
}
}
}
......@@ -1111,20 +1111,20 @@ public class WarplyManager {
WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge"));
}
if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
if (!isMyServiceRunning(WarplyHealthService.class)) {
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 (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
// if (!isMyServiceRunning(WarplyHealthService.class)) {
// 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));
// }
// }
}
}
}
......@@ -4783,95 +4783,6 @@ public class WarplyManager {
return future;
}
public static void getCosmoteUser(WarplyCosmoteUserRequest request, final CallbackReceiver<JSONObject> receiver) {
WarpUtils.log("************* WARPLY Cosmote User Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Cosmote User Request is active");
WarpUtils.log("**************************************************");
Warply.postReceiveMicroappData(false, "cosuser", request.toJson(), new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1) {
JSONObject tokens = result.optJSONObject("result");
if (tokens != null) {
WarplyDBHelper.getInstance(Warply.getWarplyContext()).saveClientAccess(
tokens.optString("client_id", ""),
tokens.optString("client_secret", "")
);
WarplyDBHelper.getInstance(Warply.getWarplyContext()).saveAuthAccess(
tokens.optString("access_token", ""),
tokens.optString("refresh_token", "")
);
JSONObject newResult = new JSONObject();
try {
newResult.putOpt("status", 1);
newResult.putOpt("message", "Success");
receiver.onSuccess(newResult);
} catch (JSONException e) {
e.printStackTrace();
receiver.onFailure(2);
}
getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
@Override
public void onSuccess(Consumer result) {
WarplyManagerHelper.setConsumerInternal(result);
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null && profMetadata.has("nonTelco")) {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco"));
} else {
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
}
}
if (result != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
if (profMetadata != null) {
if (profMetadata.has("badge")) {
WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge"));
}
if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
if (!isMyServiceRunning(WarplyHealthService.class)) {
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));
}
}
}
}
}
@Override
public void onFailure(int errorCode) {
}
});
} else
receiver.onFailure(2);
} else
receiver.onFailure(status);
}
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
}
public static void submitOrder(CosmoteSubmitOrderRequest request, final CallbackReceiver<JSONObject> receiver) {
WarpUtils.log("************* WARPLY Submit Order Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Submit Order Request is active");
......
......@@ -425,12 +425,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
......@@ -561,9 +561,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
// }
WarplyHealthEventModel healthActive = new WarplyHealthEventModel();
healthActive.setActivated(true);
EventBus.getDefault().post(new WarplyEventBusManager(healthActive));
// WarplyHealthEventModel healthActive = new WarplyHealthEventModel();
// healthActive.setActivated(true);
// EventBus.getDefault().post(new WarplyEventBusManager(healthActive));
} 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);
......@@ -572,9 +572,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
// pacingVisible.setVisible(false);
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
WarplyHealthEventModel healthActive = new WarplyHealthEventModel();
healthActive.setActivated(false);
EventBus.getDefault().post(new WarplyEventBusManager(healthActive));
// WarplyHealthEventModel healthActive = new WarplyHealthEventModel();
// healthActive.setActivated(false);
// EventBus.getDefault().post(new WarplyEventBusManager(healthActive));
} else if (parts[1].equals("request") || parts[1].equals("response")) {
WarpUtils.log("**************** WARPLY Webview Log START *****************");
WarpUtils.log(message);
......