chore: cleanup pt2

This commit is contained in:
rebelonion 2024-04-19 06:13:14 -05:00
parent 24147e746a
commit 70a50ece43
52 changed files with 501 additions and 294 deletions

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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>)

View file

@ -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)
}