diff --git a/app/src/main/java/com/github/libretube/helpers/BackupHelper.kt b/app/src/main/java/com/github/libretube/helpers/BackupHelper.kt index eebf013a8..311e2e1cc 100644 --- a/app/src/main/java/com/github/libretube/helpers/BackupHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/BackupHelper.kt @@ -5,6 +5,7 @@ import android.net.Uri import android.util.Log import androidx.core.content.edit import androidx.preference.PreferenceManager +import androidx.work.ExistingPeriodicWorkPolicy import com.github.libretube.api.JsonHelper import com.github.libretube.constants.PreferenceKeys import com.github.libretube.db.DatabaseHolder.Database @@ -113,5 +114,8 @@ object BackupHelper { } } } + + // re-schedule the notification worker as some settings related to it might have changed + NotificationHelper.enqueueWork(context, ExistingPeriodicWorkPolicy.UPDATE) } } diff --git a/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt b/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt index 059fa3c6f..bc5db7626 100644 --- a/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt @@ -24,11 +24,6 @@ object NotificationHelper { true ) - val checkingFrequency = PreferenceHelper.getString( - PreferenceKeys.CHECKING_FREQUENCY, - "60" - ).toLong() - // schedule the work manager request if logged in and notifications enabled if (!notificationsEnabled) { // cancel the work if notifications are disabled or the user is not logged in @@ -37,6 +32,11 @@ object NotificationHelper { return } + val checkingFrequency = PreferenceHelper.getString( + PreferenceKeys.CHECKING_FREQUENCY, + "60" + ).toLong() + // required network type for the work val networkType = when ( PreferenceHelper.getString(PreferenceKeys.REQUIRED_NETWORK, "all")