mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-22 07:03:57 +00:00
26 lines
1.0 KiB
Kotlin
26 lines
1.0 KiB
Kotlin
package ani.dantotsu.notifications.subscription
|
|
|
|
import android.content.BroadcastReceiver
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import ani.dantotsu.notifications.AlarmManagerScheduler
|
|
import ani.dantotsu.notifications.TaskScheduler
|
|
import ani.dantotsu.settings.saving.PrefManager
|
|
import ani.dantotsu.settings.saving.PrefName
|
|
import ani.dantotsu.util.Logger
|
|
import kotlinx.coroutines.runBlocking
|
|
|
|
class SubscriptionNotificationReceiver : BroadcastReceiver() {
|
|
override fun onReceive(context: Context, intent: Intent?) {
|
|
Logger.log("SubscriptionNotificationReceiver: onReceive")
|
|
runBlocking {
|
|
SubscriptionNotificationTask().execute(context)
|
|
}
|
|
val subscriptionInterval =
|
|
SubscriptionNotificationWorker.checkIntervals[PrefManager.getVal(PrefName.SubscriptionNotificationInterval)]
|
|
AlarmManagerScheduler(context).scheduleRepeatingTask(
|
|
TaskScheduler.TaskType.SUBSCRIPTION_NOTIFICATION,
|
|
subscriptionInterval
|
|
)
|
|
}
|
|
} |