mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-26 09:21:01 +00:00
feat: move subscriptions to new notification method
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user