This commit is contained in:
Matthieu 2021-10-08 00:27:18 +02:00
parent adc419a06b
commit 94f7374e38
1 changed files with 5 additions and 12 deletions

View File

@ -81,24 +81,22 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
itemView.setOnClickListener { itemView.setOnClickListener {
notification?.openActivity() notification?.openActivity()
} }
avatar.setOnClickListener {
val intent = notification?.openAccountFromNotification()
itemView.context.startActivity(intent)
}
} }
private fun Notification.openActivity() { private fun Notification.openActivity() {
val intent: Intent = val intent: Intent =
when (type) { when (type) {
Notification.NotificationType.favourite, Notification.NotificationType.mention, Notification.NotificationType.favourite,
Notification.NotificationType.poll, Notification.NotificationType.reblog -> { Notification.NotificationType.poll, Notification.NotificationType.reblog -> {
openPostFromNotification() openPostFromNotification()
} }
Notification.NotificationType.follow -> { Notification.NotificationType.follow -> {
openAccountFromNotification() openAccountFromNotification()
} }
Notification.NotificationType.mention -> {
/*Intent(itemView.context, PostActivity::class.java).apply {
putExtra(Status.POST_TAG, status?.in_reply_to_id)
}*/ // TODO
openPostFromNotification()
}
null -> return null -> return
} }
itemView.context.startActivity(intent) itemView.context.startActivity(intent)
@ -216,11 +214,6 @@ class NotificationsFragment : CachedFeedFragment<Notification>() {
itemView.context, itemView.context,
lifecycleScope lifecycleScope
) )
avatar.setOnClickListener {
val intent = notification?.openAccountFromNotification()
itemView.context.startActivity(intent)
}
} }
companion object { companion object {