Simplify some of the notification builders

This commit is contained in:
arkon
2023-03-19 16:24:37 -04:00
parent dfdb688b43
commit 7d8a865cac
7 changed files with 111 additions and 117 deletions

View File

@@ -5,29 +5,28 @@ import androidx.core.app.NotificationCompat
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notification
import eu.kanade.tachiyomi.util.system.notificationManager
import eu.kanade.tachiyomi.util.system.notify
class ExtensionUpdateNotifier(private val context: Context) {
fun promptUpdates(names: List<String>) {
context.notificationManager.notify(
context.notify(
Notifications.ID_UPDATES_TO_EXTS,
context.notification(Notifications.CHANNEL_EXTENSIONS_UPDATE) {
setContentTitle(
context.resources.getQuantityString(
R.plurals.update_check_notification_ext_updates,
names.size,
names.size,
),
)
val extNames = names.joinToString(", ")
setContentText(extNames)
setStyle(NotificationCompat.BigTextStyle().bigText(extNames))
setSmallIcon(R.drawable.ic_extension_24dp)
setContentIntent(NotificationReceiver.openExtensionsPendingActivity(context))
setAutoCancel(true)
},
)
Notifications.CHANNEL_EXTENSIONS_UPDATE,
) {
setContentTitle(
context.resources.getQuantityString(
R.plurals.update_check_notification_ext_updates,
names.size,
names.size,
),
)
val extNames = names.joinToString(", ")
setContentText(extNames)
setStyle(NotificationCompat.BigTextStyle().bigText(extNames))
setSmallIcon(R.drawable.ic_extension_24dp)
setContentIntent(NotificationReceiver.openExtensionsPendingActivity(context))
setAutoCancel(true)
}
}
}