mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 16:18:55 +01:00 
			
		
		
		
	Set foreground service types for remaining jobs
This commit is contained in:
		@@ -1,7 +1,9 @@
 | 
			
		||||
package eu.kanade.tachiyomi.data.backup.create
 | 
			
		||||
 | 
			
		||||
import android.content.Context
 | 
			
		||||
import android.content.pm.ServiceInfo
 | 
			
		||||
import android.net.Uri
 | 
			
		||||
import android.os.Build
 | 
			
		||||
import androidx.core.net.toUri
 | 
			
		||||
import androidx.work.BackoffPolicy
 | 
			
		||||
import androidx.work.Constraints
 | 
			
		||||
@@ -70,6 +72,11 @@ class BackupCreateJob(private val context: Context, workerParams: WorkerParamete
 | 
			
		||||
        return ForegroundInfo(
 | 
			
		||||
            Notifications.ID_BACKUP_PROGRESS,
 | 
			
		||||
            notifier.showBackupProgress().build(),
 | 
			
		||||
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
 | 
			
		||||
                ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
 | 
			
		||||
            } else {
 | 
			
		||||
                0
 | 
			
		||||
            },
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
package eu.kanade.tachiyomi.data.backup.restore
 | 
			
		||||
 | 
			
		||||
import android.content.Context
 | 
			
		||||
import android.content.pm.ServiceInfo
 | 
			
		||||
import android.net.Uri
 | 
			
		||||
import android.os.Build
 | 
			
		||||
import androidx.core.net.toUri
 | 
			
		||||
import androidx.work.CoroutineWorker
 | 
			
		||||
import androidx.work.ExistingWorkPolicy
 | 
			
		||||
@@ -54,6 +56,11 @@ class BackupRestoreJob(private val context: Context, workerParams: WorkerParamet
 | 
			
		||||
        return ForegroundInfo(
 | 
			
		||||
            Notifications.ID_RESTORE_PROGRESS,
 | 
			
		||||
            notifier.showRestoreProgress().build(),
 | 
			
		||||
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
 | 
			
		||||
                ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
 | 
			
		||||
            } else {
 | 
			
		||||
                0
 | 
			
		||||
            },
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
package eu.kanade.tachiyomi.data.updater
 | 
			
		||||
 | 
			
		||||
import android.content.Context
 | 
			
		||||
import android.content.pm.ServiceInfo
 | 
			
		||||
import android.os.Build
 | 
			
		||||
import androidx.work.Constraints
 | 
			
		||||
import androidx.work.CoroutineWorker
 | 
			
		||||
import androidx.work.ExistingWorkPolicy
 | 
			
		||||
@@ -55,6 +57,11 @@ class AppUpdateDownloadJob(private val context: Context, workerParams: WorkerPar
 | 
			
		||||
        return ForegroundInfo(
 | 
			
		||||
            Notifications.ID_APP_UPDATER,
 | 
			
		||||
            notifier.onDownloadStarted().build(),
 | 
			
		||||
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
 | 
			
		||||
                ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
 | 
			
		||||
            } else {
 | 
			
		||||
                0
 | 
			
		||||
            },
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user