mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 21:43:19 +02:00
Adds extension possibility to Quartz's event factory
This commit is contained in:
@@ -24,6 +24,11 @@ import com.vitorpamplona.quartz.encoders.toHexKey
|
|||||||
|
|
||||||
class EventFactory {
|
class EventFactory {
|
||||||
companion object {
|
companion object {
|
||||||
|
val additionalFactories =
|
||||||
|
mutableMapOf(
|
||||||
|
WikiNoteEvent.KIND to ::WikiNoteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
fun create(
|
fun create(
|
||||||
id: String,
|
id: String,
|
||||||
pubKey: String,
|
pubKey: String,
|
||||||
@@ -141,7 +146,13 @@ class EventFactory {
|
|||||||
VideoVerticalEvent.KIND -> VideoVerticalEvent(id, pubKey, createdAt, tags, content, sig)
|
VideoVerticalEvent.KIND -> VideoVerticalEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
VideoViewEvent.KIND -> VideoViewEvent(id, pubKey, createdAt, tags, content, sig)
|
VideoViewEvent.KIND -> VideoViewEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
WikiNoteEvent.KIND -> WikiNoteEvent(id, pubKey, createdAt, tags, content, sig)
|
WikiNoteEvent.KIND -> WikiNoteEvent(id, pubKey, createdAt, tags, content, sig)
|
||||||
else -> Event(id, pubKey, createdAt, kind, tags, content, sig)
|
else -> {
|
||||||
|
additionalFactories[kind]?.let {
|
||||||
|
return it(id, pubKey, createdAt, tags, content, sig)
|
||||||
|
}
|
||||||
|
|
||||||
|
Event(id, pubKey, createdAt, kind, tags, content, sig)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user