Adds another check to make sure the event does not exist in the local memory before notifying.
This commit is contained in:
+7
-5
@@ -22,12 +22,14 @@ class EventNotificationConsumer(private val applicationContext: Context) {
|
|||||||
fun consume(event: Event) {
|
fun consume(event: Event) {
|
||||||
val scope = CoroutineScope(Job() + Dispatchers.IO)
|
val scope = CoroutineScope(Job() + Dispatchers.IO)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
// adds to database
|
if (LocalCache.notes[event.id] == null) {
|
||||||
LocalCache.verifyAndConsume(event, null)
|
// adds to database
|
||||||
|
LocalCache.verifyAndConsume(event, null)
|
||||||
|
|
||||||
when (event) {
|
when (event) {
|
||||||
is PrivateDmEvent -> notify(event)
|
is PrivateDmEvent -> notify(event)
|
||||||
is LnZapEvent -> notify(event)
|
is LnZapEvent -> notify(event)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user