From f97f4c68ba3647599dc213c15042474100a0ddad Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 27 Apr 2020 17:55:42 -0400 Subject: [PATCH] Hide titles in restore notification based on preference --- .../eu/kanade/tachiyomi/data/backup/BackupNotifier.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt index 1871ec5ea4..91654181ee 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt @@ -7,14 +7,18 @@ import com.hippo.unifile.UniFile import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.Notifications +import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationManager import java.io.File import java.util.concurrent.TimeUnit +import uy.kohesive.injekt.injectLazy internal class BackupNotifier(private val context: Context) { + private val preferences: PreferencesHelper by injectLazy() + private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_BACKUP_RESTORE) { setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher)) setSmallIcon(R.drawable.ic_tachi) @@ -85,7 +89,10 @@ internal class BackupNotifier(private val context: Context) { fun showRestoreProgress(content: String = "", progress: Int = 0, maxAmount: Int = 100): NotificationCompat.Builder { val builder = with(notificationBuilder) { setContentTitle(context.getString(R.string.restoring_backup)) - setContentText(content) + + if (!preferences.hideNotificationContent()) { + setContentText(content) + } setProgress(maxAmount, progress, false) setOngoing(true)