Update: Use Android extension for sdk determination

This commit is contained in:
LooKeR 2021-10-20 17:44:18 +05:30
parent a03453c510
commit 84bf96e42e

View File

@ -7,7 +7,6 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.view.ContextThemeWrapper
import androidx.core.app.NotificationCompat
import com.looker.droidify.BuildConfig
@ -224,7 +223,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
0,
Intent(this, Receiver::class.java)
.setAction("$ACTION_OPEN.${task.packageName}"),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (Android.sdk(23))
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT
@ -291,7 +290,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
Intent(this, Receiver::class.java)
.setAction("$ACTION_INSTALL.${task.packageName}")
.putExtra(EXTRA_CACHE_FILE_NAME, task.release.cacheFileName),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (Android.sdk(23))
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT
@ -315,7 +314,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
Intent(this, Receiver::class.java)
.setAction("$ACTION_INSTALL.${task.packageName}")
.putExtra(EXTRA_CACHE_FILE_NAME, task.release.cacheFileName),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (Android.sdk(23))
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT
@ -385,7 +384,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
this,
0,
Intent(this, this::class.java).setAction(ACTION_CANCEL),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
if (Android.sdk(23))
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else
PendingIntent.FLAG_UPDATE_CURRENT
@ -458,7 +457,7 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
.observeOn(AndroidSchedulers.mainThread())
.subscribe { result, throwable ->
currentTask = null
throwable?.printStackTrace()
throwable.printStackTrace()
if (result == null || !result.success) {
showNotificationError(
task,