GuardService: only start if allowed

Change-Id: I8dfbe0885bfa816574841d5e2326d1daade02221
This commit is contained in:
SpiritCroc 2021-11-21 12:51:05 +01:00
parent 491fabe850
commit f2976bc7ed

View file

@ -19,6 +19,7 @@ package im.vector.app.core.services
import android.content.Context
import android.content.Intent
import androidx.core.content.ContextCompat
import im.vector.app.core.pushers.UPHelper
import im.vector.app.features.settings.VectorPreferences
import timber.log.Timber
import javax.inject.Inject
@ -28,7 +29,7 @@ class GuardServiceStarter @Inject constructor(
private val appContext: Context
) {
fun start() {
if (preferences.isBackgroundSyncEnabled()) {
if (preferences.isBackgroundSyncEnabled() && UPHelper.allowBackgroundSync(appContext)) {
try {
Timber.i("## Sync: starting GuardService")
val intent = Intent(appContext, GuardService::class.java)