chore: cleanup pt2
This commit is contained in:
parent
24147e746a
commit
70a50ece43
52 changed files with 501 additions and 294 deletions
|
@ -5,9 +5,9 @@ import android.app.PendingIntent
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.notifications.anilist.AnilistNotificationReceiver
|
||||
import ani.dantotsu.notifications.comment.CommentNotificationReceiver
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.notifications.subscription.SubscriptionNotificationReceiver
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
|
|
|
@ -5,9 +5,9 @@ import android.content.BroadcastReceiver
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.notifications.anilist.AnilistNotificationWorker
|
||||
import ani.dantotsu.notifications.comment.CommentNotificationWorker
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.util.Logger
|
||||
|
|
|
@ -21,11 +21,16 @@ interface TaskScheduler {
|
|||
for (taskType in TaskType.entries) {
|
||||
val interval = when (taskType) {
|
||||
TaskType.COMMENT_NOTIFICATION -> CommentNotificationWorker.checkIntervals[PrefManager.getVal(
|
||||
PrefName.CommentNotificationInterval)]
|
||||
PrefName.CommentNotificationInterval
|
||||
)]
|
||||
|
||||
TaskType.ANILIST_NOTIFICATION -> AnilistNotificationWorker.checkIntervals[PrefManager.getVal(
|
||||
PrefName.AnilistNotificationInterval)]
|
||||
PrefName.AnilistNotificationInterval
|
||||
)]
|
||||
|
||||
TaskType.SUBSCRIPTION_NOTIFICATION -> SubscriptionNotificationWorker.checkIntervals[PrefManager.getVal(
|
||||
PrefName.SubscriptionNotificationInterval)]
|
||||
PrefName.SubscriptionNotificationInterval
|
||||
)]
|
||||
}
|
||||
scheduleRepeatingTask(taskType, interval)
|
||||
}
|
||||
|
@ -62,6 +67,7 @@ interface TaskScheduler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class TaskType {
|
||||
COMMENT_NOTIFICATION,
|
||||
ANILIST_NOTIFICATION,
|
||||
|
|
|
@ -66,6 +66,7 @@ class MediaNameFetch {
|
|||
val type = object : TypeToken<MediaResponse>() {}.type
|
||||
return gson.fromJson(response, type)
|
||||
}
|
||||
|
||||
data class ReturnedData(val title: String, val coverImage: String, val color: String)
|
||||
|
||||
data class MediaResponse(val data: Map<String, MediaItem>)
|
||||
|
|
|
@ -32,7 +32,7 @@ class SubscriptionHelper {
|
|||
return data
|
||||
}
|
||||
|
||||
private fun saveSelected( mediaId: Int, data: Selected) {
|
||||
private fun saveSelected(mediaId: Int, data: Selected) {
|
||||
PrefManager.setCustomVal("${mediaId}-select", data)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue