Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect privacy settings in extension update notification #1156

Merged
merged 3 commits into from
Aug 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ package eu.kanade.tachiyomi.extension.api
import android.content.Context
import androidx.core.app.NotificationCompat
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.core.security.SecurityPreferences
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.cancelNotification
import eu.kanade.tachiyomi.util.system.notify
import tachiyomi.core.common.i18n.pluralStringResource
import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get

class ExtensionUpdateNotifier(private val context: Context) {

class ExtensionUpdateNotifier(
private val context: Context,
private val securityPreferences: SecurityPreferences = Injekt.get(),
) {
fun promptUpdates(names: List<String>) {
context.notify(
Notifications.ID_UPDATES_TO_EXTS,
Expand All @@ -25,8 +30,10 @@ class ExtensionUpdateNotifier(private val context: Context) {
),
)
val extNames = names.joinToString(", ")
Animeboynz marked this conversation as resolved.
Show resolved Hide resolved
setContentText(extNames)
setStyle(NotificationCompat.BigTextStyle().bigText(extNames))
if (!securityPreferences.hideNotificationContent().get()) {
setContentText(extNames)
setStyle(NotificationCompat.BigTextStyle().bigText(extNames))
}
setSmallIcon(R.drawable.ic_extension_24dp)
setContentIntent(NotificationReceiver.openExtensionsPendingActivity(context))
setAutoCancel(true)
Expand Down