mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 16:30:49 +00:00
BugFix for a crash when receiving a new notification
This commit is contained in:
parent
1ab8463578
commit
0665c552aa
@ -101,14 +101,16 @@ class Account(
|
|||||||
val showSensitiveContent: Boolean?
|
val showSensitiveContent: Boolean?
|
||||||
)
|
)
|
||||||
|
|
||||||
val liveHiddenUsers: LiveData<LiveHiddenUsers> = live.combineWith(getBlockListNote().live().metadata) { localLive, liveMuteListEvent ->
|
val liveHiddenUsers: LiveData<LiveHiddenUsers> by lazy {
|
||||||
val liveBlockedUsers = (liveMuteListEvent?.note?.event as? PeopleListEvent)?.publicAndPrivateUsers(keyPair.privKey)
|
live.combineWith(getBlockListNote().live().metadata) { localLive, liveMuteListEvent ->
|
||||||
LiveHiddenUsers(
|
val liveBlockedUsers = (liveMuteListEvent?.note?.event as? PeopleListEvent)?.publicAndPrivateUsers(keyPair.privKey)
|
||||||
hiddenUsers = liveBlockedUsers ?: persistentSetOf(),
|
LiveHiddenUsers(
|
||||||
spammers = localLive?.account?.transientHiddenUsers ?: persistentSetOf(),
|
hiddenUsers = liveBlockedUsers ?: persistentSetOf(),
|
||||||
showSensitiveContent = showSensitiveContent
|
spammers = localLive?.account?.transientHiddenUsers ?: persistentSetOf(),
|
||||||
)
|
showSensitiveContent = showSensitiveContent
|
||||||
}.distinctUntilChanged()
|
)
|
||||||
|
}.distinctUntilChanged()
|
||||||
|
}
|
||||||
|
|
||||||
var userProfileCache: User? = null
|
var userProfileCache: User? = null
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import kotlinx.collections.immutable.persistentSetOf
|
|||||||
|
|
||||||
class EventNotificationConsumer(private val applicationContext: Context) {
|
class EventNotificationConsumer(private val applicationContext: Context) {
|
||||||
|
|
||||||
fun consume(event: Event) {
|
suspend fun consume(event: Event) {
|
||||||
if (LocalCache.notes[event.id] == null) {
|
if (LocalCache.notes[event.id] == null) {
|
||||||
if (LocalCache.justVerify(event)) {
|
if (LocalCache.justVerify(event)) {
|
||||||
LocalCache.justConsume(event, null)
|
LocalCache.justConsume(event, null)
|
||||||
@ -40,7 +40,7 @@ class EventNotificationConsumer(private val applicationContext: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unwrapAndConsume(event: Event, account: Account): Event? {
|
suspend fun unwrapAndConsume(event: Event, account: Account): Event? {
|
||||||
if (!LocalCache.justVerify(event)) return null
|
if (!LocalCache.justVerify(event)) return null
|
||||||
|
|
||||||
return when (event) {
|
return when (event) {
|
||||||
@ -65,7 +65,7 @@ class EventNotificationConsumer(private val applicationContext: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun unwrapAndNotify(giftWrap: GiftWrapEvent) {
|
private suspend fun unwrapAndNotify(giftWrap: GiftWrapEvent) {
|
||||||
val giftWrapNote = LocalCache.notes[giftWrap.id] ?: return
|
val giftWrapNote = LocalCache.notes[giftWrap.id] ?: return
|
||||||
|
|
||||||
LocalPreferences.allSavedAccounts().forEach {
|
LocalPreferences.allSavedAccounts().forEach {
|
||||||
|
Loading…
Reference in New Issue
Block a user