Bump dependencies

This commit is contained in:
arkon 2023-03-22 22:58:42 -04:00
parent 2e5efadf42
commit cb4699a5bb
10 changed files with 41 additions and 21 deletions

View File

@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.notificationManager
import eu.kanade.tachiyomi.util.system.notify
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.File import java.io.File
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -34,7 +35,7 @@ class BackupNotifier(private val context: Context) {
} }
private fun NotificationCompat.Builder.show(id: Int) { private fun NotificationCompat.Builder.show(id: Int) {
context.notificationManager.notify(id, build()) context.notify(id, build())
} }
fun showBackupProgress(): NotificationCompat.Builder { fun showBackupProgress(): NotificationCompat.Builder {

View File

@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.lang.chop import eu.kanade.tachiyomi.util.lang.chop
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.notificationManager
import eu.kanade.tachiyomi.util.system.notify
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.util.regex.Pattern import java.util.regex.Pattern
@ -50,7 +51,7 @@ internal class DownloadNotifier(private val context: Context) {
* @param id the id of the notification. * @param id the id of the notification.
*/ */
private fun NotificationCompat.Builder.show(id: Int) { private fun NotificationCompat.Builder.show(id: Int) {
context.notificationManager.notify(id, build()) context.notify(id, build())
} }
/** /**

View File

@ -9,6 +9,7 @@ import android.graphics.BitmapFactory
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import android.net.Uri import android.net.Uri
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import coil.imageLoader import coil.imageLoader
import coil.request.ImageRequest import coil.request.ImageRequest
import coil.transform.CircleCropTransformation import coil.transform.CircleCropTransformation
@ -82,7 +83,7 @@ class LibraryUpdateNotifier(private val context: Context) {
.setStyle(NotificationCompat.BigTextStyle().bigText(updatingText)) .setStyle(NotificationCompat.BigTextStyle().bigText(updatingText))
} }
context.notificationManager.notify( context.notify(
Notifications.ID_LIBRARY_PROGRESS, Notifications.ID_LIBRARY_PROGRESS,
progressNotificationBuilder progressNotificationBuilder
.setProgress(total, current, false) .setProgress(total, current, false)
@ -190,9 +191,11 @@ class LibraryUpdateNotifier(private val context: Context) {
// Per-manga notification // Per-manga notification
if (!preferences.hideNotificationContent().get()) { if (!preferences.hideNotificationContent().get()) {
launchUI { launchUI {
updates.forEach { (manga, chapters) -> context.notify(
context.notificationManager.notify(manga.id.hashCode(), createNewChaptersNotification(manga, chapters)) updates.map { (manga, chapters) ->
} NotificationManagerCompat.NotificationWithIdAndTag(manga.id.hashCode(), createNewChaptersNotification(manga, chapters))
},
)
} }
} }
} }

View File

@ -99,12 +99,12 @@ object Notifications {
* @param context The application context. * @param context The application context.
*/ */
fun createChannels(context: Context) { fun createChannels(context: Context) {
val notificationService = NotificationManagerCompat.from(context) val notificationManager = NotificationManagerCompat.from(context)
// Delete old notification channels // Delete old notification channels
deprecatedChannels.forEach(notificationService::deleteNotificationChannel) deprecatedChannels.forEach(notificationManager::deleteNotificationChannel)
notificationService.createNotificationChannelGroupsCompat( notificationManager.createNotificationChannelGroupsCompat(
listOf( listOf(
buildNotificationChannelGroup(GROUP_BACKUP_RESTORE) { buildNotificationChannelGroup(GROUP_BACKUP_RESTORE) {
setName(context.getString(R.string.label_backup)) setName(context.getString(R.string.label_backup))
@ -121,7 +121,7 @@ object Notifications {
), ),
) )
notificationService.createNotificationChannelsCompat( notificationManager.createNotificationChannelsCompat(
listOf( listOf(
buildNotificationChannel(CHANNEL_COMMON, IMPORTANCE_LOW) { buildNotificationChannel(CHANNEL_COMMON, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_common)) setName(context.getString(R.string.channel_common))

View File

@ -12,7 +12,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationHandler
import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.notify
internal class AppUpdateNotifier(private val context: Context) { internal class AppUpdateNotifier(private val context: Context) {
@ -24,7 +24,7 @@ internal class AppUpdateNotifier(private val context: Context) {
* @param id id of the notification channel. * @param id id of the notification channel.
*/ */
private fun NotificationCompat.Builder.show(id: Int = Notifications.ID_APP_UPDATER) { private fun NotificationCompat.Builder.show(id: Int = Notifications.ID_APP_UPDATER) {
context.notificationManager.notify(id, build()) context.notify(id, build())
} }
@SuppressLint("LaunchActivityFromNotification") @SuppressLint("LaunchActivityFromNotification")

View File

@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.notificationManager
import eu.kanade.tachiyomi.util.system.notify
/** /**
* Class used to show BigPictureStyle notifications * Class used to show BigPictureStyle notifications
@ -97,6 +98,6 @@ class SaveImageNotifier(private val context: Context) {
private fun updateNotification() { private fun updateNotification() {
// Displays the progress bar on notification // Displays the progress bar on notification
context.notificationManager.notify(notificationId, notificationBuilder.build()) context.notify(notificationId, notificationBuilder.build())
} }
} }

View File

@ -1,12 +1,14 @@
package eu.kanade.tachiyomi.util.system package eu.kanade.tachiyomi.util.system
import android.Manifest import android.Manifest
import android.app.Notification
import android.app.NotificationManager import android.app.NotificationManager
import android.content.Context import android.content.Context
import androidx.core.app.NotificationChannelCompat import androidx.core.app.NotificationChannelCompat
import androidx.core.app.NotificationChannelGroupCompat import androidx.core.app.NotificationChannelGroupCompat
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat import androidx.core.app.NotificationManagerCompat
import androidx.core.app.NotificationManagerCompat.NotificationWithIdAndTag
import androidx.core.content.PermissionChecker import androidx.core.content.PermissionChecker
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -15,14 +17,26 @@ val Context.notificationManager: NotificationManager
get() = getSystemService()!! get() = getSystemService()!!
fun Context.notify(id: Int, channelId: String, block: (NotificationCompat.Builder.() -> Unit)? = null) { fun Context.notify(id: Int, channelId: String, block: (NotificationCompat.Builder.() -> Unit)? = null) {
val notification = notificationBuilder(channelId, block).build()
this.notify(id, notification)
}
fun Context.notify(id: Int, notification: Notification) {
if (PermissionChecker.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PermissionChecker.PERMISSION_GRANTED) { if (PermissionChecker.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PermissionChecker.PERMISSION_GRANTED) {
return return
} }
val notification = notificationBuilder(channelId, block).build()
NotificationManagerCompat.from(this).notify(id, notification) NotificationManagerCompat.from(this).notify(id, notification)
} }
fun Context.notify(notificationWithIdAndTags: List<NotificationWithIdAndTag>) {
if (PermissionChecker.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PermissionChecker.PERMISSION_GRANTED) {
return
}
NotificationManagerCompat.from(this).notify(notificationWithIdAndTags)
}
/** /**
* Helper method to create a notification builder. * Helper method to create a notification builder.
* *

View File

@ -1,27 +1,27 @@
[versions] [versions]
agp_version = "7.4.2" agp_version = "7.4.2"
lifecycle_version = "2.6.0" lifecycle_version = "2.6.1"
[libraries] [libraries]
gradle = { module = "com.android.tools.build:gradle", version.ref = "agp_version" } gradle = { module = "com.android.tools.build:gradle", version.ref = "agp_version" }
annotation = "androidx.annotation:annotation:1.6.0" annotation = "androidx.annotation:annotation:1.7.0-alpha01"
appcompat = "androidx.appcompat:appcompat:1.6.1" appcompat = "androidx.appcompat:appcompat:1.6.1"
biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha05" biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha05"
constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4" constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0" coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
corektx = "androidx.core:core-ktx:1.10.0-rc01" corektx = "androidx.core:core-ktx:1.11.0-alpha01"
splashscreen = "androidx.core:core-splashscreen:1.0.0-alpha02" splashscreen = "androidx.core:core-splashscreen:1.0.0-alpha02"
recyclerview = "androidx.recyclerview:recyclerview:1.3.0" recyclerview = "androidx.recyclerview:recyclerview:1.3.0"
viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01" viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01"
glance = "androidx.glance:glance-appwidget:1.0.0-alpha03" glance = "androidx.glance:glance-appwidget:1.0.0-alpha03"
profileinstaller = "androidx.profileinstaller:profileinstaller:1.2.2" profileinstaller = "androidx.profileinstaller:profileinstaller:1.3.0"
lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "lifecycle_version" } lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "lifecycle_version" }
lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "lifecycle_version" } lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "lifecycle_version" }
lifecycle-runtimektx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle_version" } lifecycle-runtimektx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle_version" }
work-runtime = "androidx.work:work-runtime-ktx:2.8.0" work-runtime = "androidx.work:work-runtime-ktx:2.8.1"
guava = "com.google.guava:guava:31.1-android" guava = "com.google.guava:guava:31.1-android"
paging-runtime = "androidx.paging:paging-runtime:3.1.1" paging-runtime = "androidx.paging:paging-runtime:3.1.1"

View File

@ -4,7 +4,7 @@ compose-bom = "2023.02.00-rc02"
accompanist = "0.29.1-alpha" accompanist = "0.29.1-alpha"
[libraries] [libraries]
activity = "androidx.activity:activity-compose:1.6.1" activity = "androidx.activity:activity-compose:1.7.0"
bom = { group = "dev.chrisbanes.compose", name = "compose-bom", version.ref = "compose-bom" } bom = { group = "dev.chrisbanes.compose", name = "compose-bom", version.ref = "compose-bom" }
foundation = { module = "androidx.compose.foundation:foundation" } foundation = { module = "androidx.compose.foundation:foundation" }
animation = { module = "androidx.compose.animation:animation" } animation = { module = "androidx.compose.animation:animation" }

View File

@ -3,7 +3,7 @@ aboutlib_version = "10.6.1"
okhttp_version = "5.0.0-alpha.11" okhttp_version = "5.0.0-alpha.11"
coil_version = "2.2.2" coil_version = "2.2.2"
shizuku_version = "12.2.0" shizuku_version = "12.2.0"
sqlite = "2.3.0" sqlite = "2.3.1"
sqldelight = "1.5.5" sqldelight = "1.5.5"
leakcanary = "2.10" leakcanary = "2.10"
voyager = "1.0.0-rc07" voyager = "1.0.0-rc07"