diff --git a/src/main/kotlin/com/looker/droidify/service/DownloadService.kt b/src/main/kotlin/com/looker/droidify/service/DownloadService.kt index 7f7e5d6b..96c3c9a1 100644 --- a/src/main/kotlin/com/looker/droidify/service/DownloadService.kt +++ b/src/main/kotlin/com/looker/droidify/service/DownloadService.kt @@ -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() { 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() { 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() { 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() { 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() { .observeOn(AndroidSchedulers.mainThread()) .subscribe { result, throwable -> currentTask = null - throwable?.printStackTrace() + throwable.printStackTrace() if (result == null || !result.success) { showNotificationError( task,