projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
♻️ Extract a handler for new posts during first start
[Sone.git]
/
src
/
main
/
kotlin
/
net
/
pterodactylus
/
sone
/
web
/
notification
/
NewSoneHandler.kt
diff --git
a/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt
b/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt
index
9ac6c28
..
83be6fd
100644
(file)
--- a/
src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt
+++ b/
src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt
@@
-29,7
+29,7
@@
import net.pterodactylus.util.template.*
*/
class NewSoneHandler(private val notificationManager: NotificationManager, template: Template) {
*/
class NewSoneHandler(private val notificationManager: NotificationManager, template: Template) {
- private val notification = ListNotification<Sone>("new-sone-notification", "
", templat
e)
+ private val notification = ListNotification<Sone>("new-sone-notification", "
sones", template, dismissable = fals
e)
@Subscribe
fun newSoneFound(newSoneFoundEvent: NewSoneFoundEvent) {
@Subscribe
fun newSoneFound(newSoneFoundEvent: NewSoneFoundEvent) {
@@
-39,6
+39,16
@@
class NewSoneHandler(private val notificationManager: NotificationManager, templ
}
}
}
}
+ @Subscribe
+ fun markedSoneKnown(markSoneKnownEvent: MarkSoneKnownEvent) {
+ notification.remove(markSoneKnownEvent.sone)
+ }
+
+ @Subscribe
+ fun soneRemoved(soneRemovedEvent: SoneRemovedEvent) {
+ notification.remove(soneRemovedEvent.sone)
+ }
+
}
private fun NotificationManager.hasNotification(id: String) =
}
private fun NotificationManager.hasNotification(id: String) =