mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Hide titles in restore notification based on preference
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user