Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: importing backup doesn't immediately cancel/update notification worker #5782

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
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
Expand All @@ -37,6 +32,11 @@
return
}

val checkingFrequency = PreferenceHelper.getString(

Check failure on line 35 in app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 A multiline expression should start on a new line Raw Output: app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt:35:33: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
PreferenceKeys.CHECKING_FREQUENCY,
"60"

Check failure on line 37 in app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Missing trailing comma before ")" Raw Output: app/src/main/java/com/github/libretube/helpers/NotificationHelper.kt:37:17: error: Missing trailing comma before ")" (standard:trailing-comma-on-call-site)
).toLong()

// required network type for the work
val networkType = when (
PreferenceHelper.getString(PreferenceKeys.REQUIRED_NETWORK, "all")
Expand Down
Loading