another change

This commit is contained in:
Jace 2022-11-19 22:11:28 +08:00
parent 3d266e6226
commit 7514a9e9d0

View file

@ -267,8 +267,8 @@ object PluginManager {
} }
main { main {
val uitext = UiText.StringResource(R.string.plugins_updated, updatedPlugins) val uitext = txt(R.string.plugins_updated, updatedPlugins.size)
createNotification(activity, uitext) createNotification(activity, uitext, updatedPlugins)
} }
// ioSafe { // ioSafe {
@ -348,8 +348,8 @@ object PluginManager {
} }
main { main {
val uitext = UiText.StringResource(R.string.plugins_downloaded, newDownloadPlugins) val uitext = txt(R.string.plugins_downloaded, newDownloadPlugins.size)
createNotification(activity, uitext) createNotification(activity, uitext, newDownloadPlugins)
} }
// ioSafe { // ioSafe {
@ -611,15 +611,14 @@ object PluginManager {
private fun createNotification( private fun createNotification(
context: Context, context: Context,
uitext: UiText.StringResource uitext: UiText,
extensions: List<String>
): Notification? { ): Notification? {
try { try {
val extensionNames = uitext.args.filterIsInstance<String>()
val resIdFormat = uitext.resId
if (extensionNames.isEmpty()) return null if (extensions.isEmpty()) return null
val content = extensionNames.joinToString(", ") val content = extensions.joinToString(", ")
// main { // DON'T WANT TO SLOW IT DOWN // main { // DON'T WANT TO SLOW IT DOWN
val builder = NotificationCompat.Builder(context, EXTENSIONS_CHANNEL_ID) val builder = NotificationCompat.Builder(context, EXTENSIONS_CHANNEL_ID)
.setAutoCancel(false) .setAutoCancel(false)
@ -628,7 +627,7 @@ object PluginManager {
.setSilent(true) .setSilent(true)
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW)
.setColor(context.colorFromAttribute(R.attr.colorPrimary)) .setColor(context.colorFromAttribute(R.attr.colorPrimary))
.setContentTitle(txt(resIdFormat, extensionNames.size).asString(context)) .setContentTitle(uitext.asString(context))
//.setContentTitle(context.getString(title, extensionNames.size)) //.setContentTitle(context.getString(title, extensionNames.size))
.setSmallIcon(R.drawable.ic_baseline_extension_24) .setSmallIcon(R.drawable.ic_baseline_extension_24)
.setStyle( .setStyle(