fix: add a check for minimum poll time
This commit is contained in:
parent
f707f8cc33
commit
b0dbd7a348
3 changed files with 9 additions and 1 deletions
|
@ -15,7 +15,7 @@ android {
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode((System.currentTimeMillis() / 60000).toInteger())
|
versionCode((System.currentTimeMillis() / 60000).toInteger())
|
||||||
versionName "3.0.0"
|
versionName "3.0.0"
|
||||||
versionCode 220000000
|
versionCode 300000000
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@ import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class AlarmManagerScheduler(private val context: Context) : TaskScheduler {
|
class AlarmManagerScheduler(private val context: Context) : TaskScheduler {
|
||||||
override fun scheduleRepeatingTask(taskType: TaskType, interval: Long) {
|
override fun scheduleRepeatingTask(taskType: TaskType, interval: Long) {
|
||||||
|
if (interval < TimeUnit.MINUTES.toMillis(15)) {
|
||||||
|
cancelTask(taskType)
|
||||||
|
return
|
||||||
|
}
|
||||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||||
val intent = when (taskType) {
|
val intent = when (taskType) {
|
||||||
TaskType.COMMENT_NOTIFICATION -> Intent(
|
TaskType.COMMENT_NOTIFICATION -> Intent(
|
||||||
|
|
|
@ -10,6 +10,10 @@ import ani.dantotsu.notifications.subscription.SubscriptionNotificationWorker
|
||||||
|
|
||||||
class WorkManagerScheduler(private val context: Context) : TaskScheduler {
|
class WorkManagerScheduler(private val context: Context) : TaskScheduler {
|
||||||
override fun scheduleRepeatingTask(taskType: TaskType, interval: Long) {
|
override fun scheduleRepeatingTask(taskType: TaskType, interval: Long) {
|
||||||
|
if (interval < PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS) {
|
||||||
|
cancelTask(taskType)
|
||||||
|
return
|
||||||
|
}
|
||||||
val constraints = Constraints.Builder()
|
val constraints = Constraints.Builder()
|
||||||
.setRequiredNetworkType(androidx.work.NetworkType.CONNECTED)
|
.setRequiredNetworkType(androidx.work.NetworkType.CONNECTED)
|
||||||
.build()
|
.build()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue