Panagiotis Triantafyllou

new targetSDK version, cancel coupon fixes, crash fix for startForeground, coupon terms fix

...@@ -3,7 +3,20 @@ ...@@ -3,7 +3,20 @@
3 <component name="deploymentTargetDropDown"> 3 <component name="deploymentTargetDropDown">
4 <value> 4 <value>
5 <entry key="app"> 5 <entry key="app">
6 - <State /> 6 + <State>
7 + <targetSelectedWithDropDown>
8 + <Target>
9 + <type value="QUICK_BOOT_TARGET" />
10 + <deviceKey>
11 + <Key>
12 + <type value="VIRTUAL_DEVICE_PATH" />
13 + <value value="$USER_HOME$/.android/avd/Pixel_7_v14.avd" />
14 + </Key>
15 + </deviceKey>
16 + </Target>
17 + </targetSelectedWithDropDown>
18 + <timeTargetWasSelectedWithDropDown value="2024-04-10T09:29:35.626328Z" />
19 + </State>
7 </entry> 20 </entry>
8 </value> 21 </value>
9 </component> 22 </component>
......
...@@ -3,13 +3,13 @@ apply plugin: 'com.android.application' ...@@ -3,13 +3,13 @@ apply plugin: 'com.android.application'
3 //apply plugin: 'com.huawei.agconnect' 3 //apply plugin: 'com.huawei.agconnect'
4 4
5 android { 5 android {
6 - compileSdkVersion 31 6 + compileSdkVersion 34
7 - buildToolsVersion "31.0.0" 7 + buildToolsVersion "34.0.0"
8 8
9 defaultConfig { 9 defaultConfig {
10 applicationId "warp.ly.android_sdk" 10 applicationId "warp.ly.android_sdk"
11 minSdkVersion 23 11 minSdkVersion 23
12 - targetSdkVersion 31 12 + targetSdkVersion 34
13 versionCode 100 13 versionCode 100
14 versionName "1.0.0" 14 versionName "1.0.0"
15 } 15 }
......
...@@ -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.5.4r19' 5 + PUBLISH_VERSION = '4.5.5.4r20'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
...@@ -10,14 +10,14 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" ...@@ -10,14 +10,14 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
10 10
11 android { 11 android {
12 12
13 - compileSdkVersion 31 13 + compileSdkVersion 34
14 - buildToolsVersion "31.0.0" 14 + buildToolsVersion "34.0.0"
15 15
16 useLibrary 'org.apache.http.legacy' 16 useLibrary 'org.apache.http.legacy'
17 17
18 defaultConfig { 18 defaultConfig {
19 minSdkVersion 23 19 minSdkVersion 23
20 - targetSdkVersion 31 20 + targetSdkVersion 34
21 consumerProguardFiles 'proguard-rules.pro' 21 consumerProguardFiles 'proguard-rules.pro'
22 vectorDrawables.useSupportLibrary = true 22 vectorDrawables.useSupportLibrary = true
23 } 23 }
......
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
12 <uses-permission 12 <uses-permission
13 android:name="android.permission.REQUEST_INSTALL_PACKAGES" 13 android:name="android.permission.REQUEST_INSTALL_PACKAGES"
14 tools:node="remove" /> 14 tools:node="remove" />
15 - <uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"/> 15 + <uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA" />
16 - <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> 16 + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
17 + <uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />
18 + <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
17 19
18 <application android:largeHeap="true"> 20 <application android:largeHeap="true">
19 <!-- <meta-data--> 21 <!-- <meta-data-->
...@@ -77,24 +79,24 @@ ...@@ -77,24 +79,24 @@
77 android:screenOrientation="portrait" 79 android:screenOrientation="portrait"
78 android:theme="@style/SDKAppTheme" /> 80 android:theme="@style/SDKAppTheme" />
79 81
80 -<!-- android:screenOrientation="portrait"--> 82 + <!-- android:screenOrientation="portrait"-->
81 -<!-- <activity--> 83 + <!-- <activity-->
82 -<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"--> 84 + <!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
83 -<!-- android:exported="false"--> 85 + <!-- android:exported="false"-->
84 -<!-- android:configChanges="orientation|screenSize"--> 86 + <!-- android:configChanges="orientation|screenSize"-->
85 -<!-- android:theme="@style/SDKAppTheme" />--> 87 + <!-- android:theme="@style/SDKAppTheme" />-->
86 - 88 +
87 -<!-- <activity--> 89 + <!-- <activity-->
88 -<!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"--> 90 + <!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"-->
89 -<!-- android:exported="false"--> 91 + <!-- android:exported="false"-->
90 -<!-- android:configChanges="orientation|screenSize"--> 92 + <!-- android:configChanges="orientation|screenSize"-->
91 -<!-- android:theme="@style/SDKAppTheme" />--> 93 + <!-- android:theme="@style/SDKAppTheme" />-->
92 - 94 +
93 -<!-- <activity--> 95 + <!-- <activity-->
94 -<!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"--> 96 + <!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"-->
95 -<!-- android:exported="false"--> 97 + <!-- android:exported="false"-->
96 -<!-- android:configChanges="orientation|screenSize"--> 98 + <!-- android:configChanges="orientation|screenSize"-->
97 -<!-- android:theme="@style/SDKAppTheme" />--> 99 + <!-- android:theme="@style/SDKAppTheme" />-->
98 100
99 <activity 101 <activity
100 android:name="ly.warp.sdk.activities.GiftsForYouActivity" 102 android:name="ly.warp.sdk.activities.GiftsForYouActivity"
...@@ -114,11 +116,11 @@ ...@@ -114,11 +116,11 @@
114 android:screenOrientation="portrait" 116 android:screenOrientation="portrait"
115 android:theme="@style/SDKAppTheme" /> 117 android:theme="@style/SDKAppTheme" />
116 118
117 -<!-- <activity--> 119 + <!-- <activity-->
118 -<!-- android:name="ly.warp.sdk.activities.LoyaltyWallet"--> 120 + <!-- android:name="ly.warp.sdk.activities.LoyaltyWallet"-->
119 -<!-- android:exported="false"--> 121 + <!-- android:exported="false"-->
120 -<!-- android:screenOrientation="portrait"--> 122 + <!-- android:screenOrientation="portrait"-->
121 -<!-- android:theme="@style/SDKAppTheme" />--> 123 + <!-- android:theme="@style/SDKAppTheme" />-->
122 124
123 <activity 125 <activity
124 android:name="ly.warp.sdk.activities.ActiveGiftsActivity" 126 android:name="ly.warp.sdk.activities.ActiveGiftsActivity"
...@@ -230,11 +232,12 @@ ...@@ -230,11 +232,12 @@
230 android:exported="false" 232 android:exported="false"
231 android:permission="android.permission.BIND_JOB_SERVICE" /> 233 android:permission="android.permission.BIND_JOB_SERVICE" />
232 234
233 -<!-- android:stopWithTask="false"--> 235 + <!-- android:stopWithTask="false"-->
234 -<!-- android:process=":warplyHealthService"--> 236 + <!-- android:process=":warplyHealthService"-->
235 <service 237 <service
236 android:name="ly.warp.sdk.services.WarplyHealthService" 238 android:name="ly.warp.sdk.services.WarplyHealthService"
237 android:exported="false" 239 android:exported="false"
240 + android:foregroundServiceType="health"
238 android:permission="android.permission.BIND_JOB_SERVICE" /> 241 android:permission="android.permission.BIND_JOB_SERVICE" />
239 242
240 <service 243 <service
...@@ -268,14 +271,14 @@ ...@@ -268,14 +271,14 @@
268 android:name="ly.warp.sdk.receivers.LocationChangedReceiver" 271 android:name="ly.warp.sdk.receivers.LocationChangedReceiver"
269 android:exported="false" /> 272 android:exported="false" />
270 273
271 -<!-- <receiver--> 274 + <!-- <receiver-->
272 -<!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"--> 275 + <!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"-->
273 -<!-- android:exported="false">--> 276 + <!-- android:exported="false">-->
274 -<!-- <intent-filter>--> 277 + <!-- <intent-filter>-->
275 -<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />--> 278 + <!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
276 -<!-- <category android:name="${applicationId}" />--> 279 + <!-- <category android:name="${applicationId}" />-->
277 -<!-- </intent-filter>--> 280 + <!-- </intent-filter>-->
278 -<!-- </receiver>--> 281 + <!-- </receiver>-->
279 282
280 <receiver 283 <receiver
281 android:name="ly.warp.sdk.receivers.BluetoothStateChangeReceiver" 284 android:name="ly.warp.sdk.receivers.BluetoothStateChangeReceiver"
......
...@@ -4,13 +4,19 @@ import android.app.Activity; ...@@ -4,13 +4,19 @@ import android.app.Activity;
4 import android.content.Context; 4 import android.content.Context;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.os.Bundle; 6 import android.os.Bundle;
7 +import android.os.Handler;
8 +import android.os.Looper;
7 import android.view.View; 9 import android.view.View;
8 import android.widget.ImageView; 10 import android.widget.ImageView;
9 import android.widget.TextView; 11 import android.widget.TextView;
12 +import android.widget.Toast;
10 13
11 import androidx.recyclerview.widget.LinearLayoutManager; 14 import androidx.recyclerview.widget.LinearLayoutManager;
12 import androidx.recyclerview.widget.RecyclerView; 15 import androidx.recyclerview.widget.RecyclerView;
13 16
17 +import org.greenrobot.eventbus.EventBus;
18 +import org.greenrobot.eventbus.Subscribe;
19 +
14 import java.io.Serializable; 20 import java.io.Serializable;
15 import java.text.ParseException; 21 import java.text.ParseException;
16 import java.text.SimpleDateFormat; 22 import java.text.SimpleDateFormat;
...@@ -20,9 +26,12 @@ import java.util.Date; ...@@ -20,9 +26,12 @@ import java.util.Date;
20 26
21 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 27 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
22 import ly.warp.sdk.R; 28 import ly.warp.sdk.R;
29 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
23 import ly.warp.sdk.io.models.UnifiedCoupon; 30 import ly.warp.sdk.io.models.UnifiedCoupon;
24 import ly.warp.sdk.utils.WarplyManagerHelper; 31 import ly.warp.sdk.utils.WarplyManagerHelper;
25 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 32 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
33 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
34 +import ly.warp.sdk.utils.managers.WarplyManager;
26 import ly.warp.sdk.views.adapters.MarketCouponAdapter; 35 import ly.warp.sdk.views.adapters.MarketCouponAdapter;
27 36
28 37
...@@ -67,6 +76,32 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -67,6 +76,32 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
67 } 76 }
68 77
69 @Override 78 @Override
79 + public void onStart() {
80 + super.onStart();
81 + if (!EventBus.getDefault().isRegistered(this))
82 + EventBus.getDefault().register(this);
83 + }
84 +
85 + @Override
86 + public void onStop() {
87 + super.onStop();
88 +// EventBus.getDefault().unregister(this);
89 + }
90 +
91 + @Override
92 + public void onDestroy() {
93 + super.onDestroy();
94 + EventBus.getDefault().unregister(this);
95 + }
96 +
97 + @Subscribe()
98 + public void onMessageEvent(WarplyEventBusManager event) {
99 + if (event.getRefreshUnifiedCouponsAdded() != null) {
100 + WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
101 + }
102 + }
103 +
104 + @Override
70 public void onClick(View view) { 105 public void onClick(View view) {
71 if (view.getId() == R.id.iv_coupons_close) { 106 if (view.getId() == R.id.iv_coupons_close) {
72 onBackPressed(); 107 onBackPressed();
...@@ -130,4 +165,16 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli ...@@ -130,4 +165,16 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
130 // Inner and Anonymous Classes 165 // Inner and Anonymous Classes
131 // =========================================================== 166 // ===========================================================
132 167
168 + private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
169 + @Override
170 + public void onSuccess(ArrayList<UnifiedCoupon> result) {
171 + Handler mUIHandler = new Handler(Looper.getMainLooper());
172 + mUIHandler.post(ActiveUnifiedCouponsActivity.this::filterItems);
173 + }
174 +
175 + @Override
176 + public void onFailure(int errorCode) {
177 +
178 + }
179 + };
133 } 180 }
......
...@@ -269,7 +269,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener ...@@ -269,7 +269,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
269 } else { 269 } else {
270 mTvCouponSubtitle.setText(mCoupon.getCouponsetDetails().getShortDescription()); 270 mTvCouponSubtitle.setText(mCoupon.getCouponsetDetails().getShortDescription());
271 } 271 }
272 - mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT)); 272 + mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getCouponsetDetails().getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
273 mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance()); 273 mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance());
274 } else { 274 } else {
275 if (mCoupon.getMerchantDetails() != null) { 275 if (mCoupon.getMerchantDetails() != null) {
......
1 package ly.warp.sdk.services; 1 package ly.warp.sdk.services;
2 2
3 -import android.app.AlarmManager;
4 import android.app.Notification; 3 import android.app.Notification;
5 import android.app.NotificationChannel; 4 import android.app.NotificationChannel;
6 import android.app.NotificationManager; 5 import android.app.NotificationManager;
...@@ -9,16 +8,15 @@ import android.app.Service; ...@@ -9,16 +8,15 @@ import android.app.Service;
9 import android.content.Context; 8 import android.content.Context;
10 import android.content.Intent; 9 import android.content.Intent;
11 import android.content.pm.PackageManager; 10 import android.content.pm.PackageManager;
11 +import android.content.pm.ServiceInfo;
12 import android.hardware.Sensor; 12 import android.hardware.Sensor;
13 import android.hardware.SensorEvent; 13 import android.hardware.SensorEvent;
14 import android.hardware.SensorEventListener; 14 import android.hardware.SensorEventListener;
15 import android.hardware.SensorManager; 15 import android.hardware.SensorManager;
16 import android.os.Build; 16 import android.os.Build;
17 import android.os.IBinder; 17 import android.os.IBinder;
18 -import android.os.SystemClock;
19 18
20 import androidx.annotation.Nullable; 19 import androidx.annotation.Nullable;
21 -import androidx.annotation.RequiresApi;
22 import androidx.core.app.NotificationCompat; 20 import androidx.core.app.NotificationCompat;
23 21
24 import org.greenrobot.eventbus.EventBus; 22 import org.greenrobot.eventbus.EventBus;
...@@ -112,7 +110,14 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -112,7 +110,14 @@ public class WarplyHealthService extends Service implements SensorEventListener
112 b.setOngoing(true); 110 b.setOngoing(true);
113 // b.setCategory(Notification.CATEGORY_SERVICE); 111 // b.setCategory(Notification.CATEGORY_SERVICE);
114 b.setSmallIcon(R.drawable.ic_launcher); 112 b.setSmallIcon(R.drawable.ic_launcher);
115 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && notificationManager != null) { 113 +
114 + if (notificationManager != null) {
115 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
116 + NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT);
117 + notificationManager.createNotificationChannel(notificationChannel);
118 + Notification notification_build = b.setChannelId(STEPS_CHANNEL_ID).build();
119 + this.startForeground(2001, notification_build, ServiceInfo.FOREGROUND_SERVICE_TYPE_HEALTH);
120 + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
116 NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT); 121 NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT);
117 notificationManager.createNotificationChannel(notificationChannel); 122 notificationManager.createNotificationChannel(notificationChannel);
118 Notification notification_build = b.setChannelId(STEPS_CHANNEL_ID).build(); 123 Notification notification_build = b.setChannelId(STEPS_CHANNEL_ID).build();
...@@ -121,6 +126,7 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -121,6 +126,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
121 Notification notification_build = b.build(); 126 Notification notification_build = b.build();
122 this.startForeground(2001, notification_build); 127 this.startForeground(2001, notification_build);
123 } 128 }
129 + }
124 130
125 new Thread( 131 new Thread(
126 () -> { 132 () -> {
......
...@@ -985,11 +985,17 @@ public class WarplyManager { ...@@ -985,11 +985,17 @@ public class WarplyManager {
985 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) { 985 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
986 if (!isMyServiceRunning(WarplyHealthService.class)) { 986 if (!isMyServiceRunning(WarplyHealthService.class)) {
987 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); 987 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
988 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { 988 +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
989 - AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE); 989 +// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
990 - PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); 990 +// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE);
991 - mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi); 991 +// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
992 - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 992 +// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
993 +// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
994 +// } else {
995 +// Warply.getWarplyContext().startService(stepsServiceIntent);
996 +// }
997 +
998 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
993 Warply.getWarplyContext().startForegroundService(stepsServiceIntent); 999 Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
994 } else { 1000 } else {
995 Warply.getWarplyContext().startService(stepsServiceIntent); 1001 Warply.getWarplyContext().startService(stepsServiceIntent);
...@@ -1123,11 +1129,17 @@ public class WarplyManager { ...@@ -1123,11 +1129,17 @@ public class WarplyManager {
1123 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) { 1129 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
1124 if (!isMyServiceRunning(WarplyHealthService.class)) { 1130 if (!isMyServiceRunning(WarplyHealthService.class)) {
1125 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); 1131 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
1126 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { 1132 +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
1127 - AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE); 1133 +// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
1128 - PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE); 1134 +// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
1129 - mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi); 1135 +// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
1130 - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 1136 +// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
1137 +// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
1138 +// } else {
1139 +// Warply.getWarplyContext().startService(stepsServiceIntent);
1140 +// }
1141 +
1142 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
1131 Warply.getWarplyContext().startForegroundService(stepsServiceIntent); 1143 Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
1132 } else { 1144 } else {
1133 Warply.getWarplyContext().startService(stepsServiceIntent); 1145 Warply.getWarplyContext().startService(stepsServiceIntent);
...@@ -1243,11 +1255,17 @@ public class WarplyManager { ...@@ -1243,11 +1255,17 @@ public class WarplyManager {
1243 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) { 1255 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
1244 if (!isMyServiceRunning(WarplyHealthService.class)) { 1256 if (!isMyServiceRunning(WarplyHealthService.class)) {
1245 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); 1257 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
1246 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { 1258 +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
1247 - AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE); 1259 +// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
1248 - PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE); 1260 +// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
1249 - mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi); 1261 +// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
1250 - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 1262 +// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
1263 +// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
1264 +// } else {
1265 +// Warply.getWarplyContext().startService(stepsServiceIntent);
1266 +// }
1267 +
1268 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
1251 Warply.getWarplyContext().startForegroundService(stepsServiceIntent); 1269 Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
1252 } else { 1270 } else {
1253 Warply.getWarplyContext().startService(stepsServiceIntent); 1271 Warply.getWarplyContext().startService(stepsServiceIntent);
...@@ -4854,11 +4872,17 @@ public class WarplyManager { ...@@ -4854,11 +4872,17 @@ public class WarplyManager {
4854 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) { 4872 if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
4855 if (!isMyServiceRunning(WarplyHealthService.class)) { 4873 if (!isMyServiceRunning(WarplyHealthService.class)) {
4856 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); 4874 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
4857 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { 4875 +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
4858 - AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE); 4876 +// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
4859 - PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE); 4877 +// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE);
4860 - mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi); 4878 +// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
4861 - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 4879 +// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
4880 +// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
4881 +// } else {
4882 +// Warply.getWarplyContext().startService(stepsServiceIntent);
4883 +// }
4884 +
4885 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
4862 Warply.getWarplyContext().startForegroundService(stepsServiceIntent); 4886 Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
4863 } else { 4887 } else {
4864 Warply.getWarplyContext().startService(stepsServiceIntent); 4888 Warply.getWarplyContext().startService(stepsServiceIntent);
......
...@@ -182,7 +182,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -182,7 +182,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
182 setFadingEdgeLength(0); 182 setFadingEdgeLength(0);
183 183
184 WebSettings settings = getSettings(); 184 WebSettings settings = getSettings();
185 - settings.setAppCacheEnabled(true); 185 + settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
186 settings.setJavaScriptEnabled(true); 186 settings.setJavaScriptEnabled(true);
187 settings.setDatabaseEnabled(true); 187 settings.setDatabaseEnabled(true);
188 settings.setDomStorageEnabled(true); 188 settings.setDomStorageEnabled(true);
...@@ -552,7 +552,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { ...@@ -552,7 +552,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
552 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); 552 EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
553 553
554 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); 554 Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
555 -// Warply.getWarplyContext().startService(stepsServiceIntent);
556 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 555 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
557 Warply.getWarplyContext().startForegroundService(stepsServiceIntent); 556 Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
558 } else { 557 } else {
......