feat: notification clicking

This commit is contained in:
rebelonion 2024-03-14 14:40:48 -05:00
parent ddd59643c5
commit 4ed74b664b
3 changed files with 35 additions and 7 deletions

View file

@ -51,10 +51,16 @@ class NotificationActivity : AppCompatActivity() {
onBackPressed()
}
binding.listProgressBar.visibility = ViewGroup.VISIBLE
val activityId = intent.getIntExtra("activityId", -1)
lifecycleScope.launch {
val res = Anilist.query.getNotifications(Anilist.userid?:0)
val resetNotification = activityId == -1
val res = Anilist.query.getNotifications(Anilist.userid?:0, resetNotification = resetNotification)
res?.data?.page?.notifications?.let { notifications ->
notificationList = notifications
notificationList = if (activityId != -1) {
notifications.filter { it.id == activityId }
} else {
notifications
}
adapter.update(notificationList.map { NotificationItem(it, ::onNotificationClick) })
}
withContext(Dispatchers.Main){