feat(Media): Toggleable Comments (#521)

* Smooth theme transitions
This commit is contained in:
Sadwhy 2024-11-17 12:21:44 +06:00 committed by GitHub
parent 56e557738c
commit d1e2ca8b5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 85 additions and 40 deletions

View file

@ -20,21 +20,18 @@ class AlarmManagerScheduler(private val context: Context) : TaskScheduler {
return
}
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
val intent = when (taskType) {
TaskType.COMMENT_NOTIFICATION -> Intent(
context,
CommentNotificationReceiver::class.java
)
TaskType.ANILIST_NOTIFICATION -> Intent(
context,
AnilistNotificationReceiver::class.java
)
val intent = when {
taskType == TaskType.COMMENT_NOTIFICATION && PrefManager.getVal<Int>(PrefName.CommentsEnabled) == 1 ->
Intent(context, CommentNotificationReceiver::class.java)
TaskType.SUBSCRIPTION_NOTIFICATION -> Intent(
context,
SubscriptionNotificationReceiver::class.java
)
taskType == TaskType.ANILIST_NOTIFICATION ->
Intent(context, AnilistNotificationReceiver::class.java)
taskType == TaskType.SUBSCRIPTION_NOTIFICATION ->
Intent(context, SubscriptionNotificationReceiver::class.java)
else -> return
}
val pendingIntent = PendingIntent.getBroadcast(
@ -64,21 +61,18 @@ class AlarmManagerScheduler(private val context: Context) : TaskScheduler {
override fun cancelTask(taskType: TaskType) {
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
val intent = when (taskType) {
TaskType.COMMENT_NOTIFICATION -> Intent(
context,
CommentNotificationReceiver::class.java
)
TaskType.ANILIST_NOTIFICATION -> Intent(
context,
AnilistNotificationReceiver::class.java
)
val intent = when {
taskType == TaskType.COMMENT_NOTIFICATION && PrefManager.getVal<Int>(PrefName.CommentsEnabled) == 1 ->
Intent(context, CommentNotificationReceiver::class.java)
TaskType.SUBSCRIPTION_NOTIFICATION -> Intent(
context,
SubscriptionNotificationReceiver::class.java
)
taskType == TaskType.ANILIST_NOTIFICATION ->
Intent(context, AnilistNotificationReceiver::class.java)
taskType == TaskType.SUBSCRIPTION_NOTIFICATION ->
Intent(context, SubscriptionNotificationReceiver::class.java)
else -> return
}
val pendingIntent = PendingIntent.getBroadcast(