mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
fix: importing backup doesn't immediately cancel/update notification worker
This commit is contained in:
parent
2fbc1361b2
commit
fc894f5f63
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user