mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
Merge pull request #5782 from Bnyro/master
fix: importing backup doesn't immediately cancel/update notification worker
This commit is contained in:
commit
b5d0aba61d
@ -5,6 +5,7 @@ import android.net.Uri
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
|
import androidx.work.ExistingPeriodicWorkPolicy
|
||||||
import com.github.libretube.api.JsonHelper
|
import com.github.libretube.api.JsonHelper
|
||||||
import com.github.libretube.constants.PreferenceKeys
|
import com.github.libretube.constants.PreferenceKeys
|
||||||
import com.github.libretube.db.DatabaseHolder.Database
|
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
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
val checkingFrequency = PreferenceHelper.getString(
|
|
||||||
PreferenceKeys.CHECKING_FREQUENCY,
|
|
||||||
"60"
|
|
||||||
).toLong()
|
|
||||||
|
|
||||||
// schedule the work manager request if logged in and notifications enabled
|
// schedule the work manager request if logged in and notifications enabled
|
||||||
if (!notificationsEnabled) {
|
if (!notificationsEnabled) {
|
||||||
// cancel the work if notifications are disabled or the user is not logged in
|
// cancel the work if notifications are disabled or the user is not logged in
|
||||||
@ -37,6 +32,11 @@ object NotificationHelper {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val checkingFrequency = PreferenceHelper.getString(
|
||||||
|
PreferenceKeys.CHECKING_FREQUENCY,
|
||||||
|
"60"
|
||||||
|
).toLong()
|
||||||
|
|
||||||
// required network type for the work
|
// required network type for the work
|
||||||
val networkType = when (
|
val networkType = when (
|
||||||
PreferenceHelper.getString(PreferenceKeys.REQUIRED_NETWORK, "all")
|
PreferenceHelper.getString(PreferenceKeys.REQUIRED_NETWORK, "all")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user