Panagiotis Triantafyllou

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

......@@ -3,7 +3,20 @@
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State />
<State>
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_7_v14.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-04-10T09:29:35.626328Z" />
</State>
</entry>
</value>
</component>
......
......@@ -3,13 +3,13 @@ apply plugin: 'com.android.application'
//apply plugin: 'com.huawei.agconnect'
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
compileSdkVersion 34
buildToolsVersion "34.0.0"
defaultConfig {
applicationId "warp.ly.android_sdk"
minSdkVersion 23
targetSdkVersion 31
targetSdkVersion 34
versionCode 100
versionName "1.0.0"
}
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.5.4r19'
PUBLISH_VERSION = '4.5.5.4r20'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -10,14 +10,14 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
compileSdkVersion 34
buildToolsVersion "34.0.0"
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 23
targetSdkVersion 31
targetSdkVersion 34
consumerProguardFiles 'proguard-rules.pro'
vectorDrawables.useSupportLibrary = true
}
......
......@@ -12,8 +12,10 @@
<uses-permission
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
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="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" />
<application android:largeHeap="true">
<!-- <meta-data-->
......@@ -77,24 +79,24 @@
android:screenOrientation="portrait"
android:theme="@style/SDKAppTheme" />
<!-- android:screenOrientation="portrait"-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- android:screenOrientation="portrait"-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name="ly.warp.sdk.activities.GiftsForYouActivity"
......@@ -114,11 +116,11 @@
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.LoyaltyWallet"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name="ly.warp.sdk.activities.ActiveGiftsActivity"
......@@ -230,11 +232,12 @@
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<!-- 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
......@@ -268,14 +271,14 @@
android:name="ly.warp.sdk.receivers.LocationChangedReceiver"
android:exported="false" />
<!-- <receiver-->
<!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<receiver
android:name="ly.warp.sdk.receivers.BluetoothStateChangeReceiver"
......
......@@ -4,13 +4,19 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -20,9 +26,12 @@ import java.util.Date;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.MarketCouponAdapter;
......@@ -67,6 +76,32 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
}
@Override
public void onStop() {
super.onStop();
// EventBus.getDefault().unregister(this);
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getRefreshUnifiedCouponsAdded() != null) {
WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
}
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_coupons_close) {
onBackPressed();
......@@ -130,4 +165,16 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
// Inner and Anonymous Classes
// ===========================================================
private final CallbackReceiver<ArrayList<UnifiedCoupon>> mUnifiedCallback = new CallbackReceiver<ArrayList<UnifiedCoupon>>() {
@Override
public void onSuccess(ArrayList<UnifiedCoupon> result) {
Handler mUIHandler = new Handler(Looper.getMainLooper());
mUIHandler.post(ActiveUnifiedCouponsActivity.this::filterItems);
}
@Override
public void onFailure(int errorCode) {
}
};
}
......
......@@ -269,7 +269,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
} else {
mTvCouponSubtitle.setText(mCoupon.getCouponsetDetails().getShortDescription());
}
mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvTermsValue.setText(HtmlCompat.fromHtml(mCoupon.getCouponsetDetails().getTerms(), HtmlCompat.FROM_HTML_MODE_COMPACT));
mTvTermsValue.setMovementMethod(LinkMovementMethod.getInstance());
} else {
if (mCoupon.getMerchantDetails() != null) {
......
package ly.warp.sdk.services;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
......@@ -9,16 +8,15 @@ import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import org.greenrobot.eventbus.EventBus;
......@@ -112,14 +110,22 @@ public class WarplyHealthService extends Service implements SensorEventListener
b.setOngoing(true);
// b.setCategory(Notification.CATEGORY_SERVICE);
b.setSmallIcon(R.drawable.ic_launcher);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && notificationManager != null) {
NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(notificationChannel);
Notification notification_build = b.setChannelId(STEPS_CHANNEL_ID).build();
this.startForeground(2001, notification_build);
} else {
Notification notification_build = b.build();
this.startForeground(2001, notification_build);
if (notificationManager != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(notificationChannel);
Notification notification_build = b.setChannelId(STEPS_CHANNEL_ID).build();
this.startForeground(2001, notification_build, ServiceInfo.FOREGROUND_SERVICE_TYPE_HEALTH);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(notificationChannel);
Notification notification_build = b.setChannelId(STEPS_CHANNEL_ID).build();
this.startForeground(2001, notification_build);
} else {
Notification notification_build = b.build();
this.startForeground(2001, notification_build);
}
}
new Thread(
......
......@@ -182,7 +182,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
setFadingEdgeLength(0);
WebSettings settings = getSettings();
settings.setAppCacheEnabled(true);
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
settings.setJavaScriptEnabled(true);
settings.setDatabaseEnabled(true);
settings.setDomStorageEnabled(true);
......@@ -552,7 +552,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
// Warply.getWarplyContext().startService(stepsServiceIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
} else {
......