From d9e01da7e27add5966c8e9d3f3500e3a80c30f06 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sat, 12 Aug 2023 14:59:14 -0400 Subject: [PATCH] Removes unnecessary code --- .../service/NostrChatroomDataSource.kt | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/NostrChatroomDataSource.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/NostrChatroomDataSource.kt index 7cc1199e1..c6b926bb8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/NostrChatroomDataSource.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/NostrChatroomDataSource.kt @@ -2,15 +2,10 @@ package com.vitorpamplona.amethyst.service import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.ChatroomKey -import com.vitorpamplona.amethyst.model.LocalCache -import com.vitorpamplona.amethyst.service.model.Event -import com.vitorpamplona.amethyst.service.model.GiftWrapEvent import com.vitorpamplona.amethyst.service.model.PrivateDmEvent -import com.vitorpamplona.amethyst.service.model.SealedGossipEvent import com.vitorpamplona.amethyst.service.relays.EOSEAccount import com.vitorpamplona.amethyst.service.relays.FeedType import com.vitorpamplona.amethyst.service.relays.JsonFilter -import com.vitorpamplona.amethyst.service.relays.Relay import com.vitorpamplona.amethyst.service.relays.TypedFilter object NostrChatroomDataSource : NostrDataSource("ChatroomFeed") { @@ -43,26 +38,6 @@ object NostrChatroomDataSource : NostrDataSource("ChatroomFeed") { } } - /* DOESN'T Load gift wraps here because it is already loaded on Chatroom List. - There is no way to filter for gifts only in this conversation. - fun createGiftWrapsToMeFilter(): TypedFilter? { - val myPeer = withRoom - - return if (myPeer != null) { - TypedFilter( - types = setOf(FeedType.PRIVATE_DMS), - filter = JsonFilter( - kinds = listOf(GiftWrapEvent.kind), - tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)), - since = latestEOSEs.users[account.userProfile()]?.followList?.get(withRoom.hashCode().toString())?.relayList - ) - ) - } else { - null - } - } - */ - fun createMessagesFromMeFilter(): TypedFilter? { val myPeer = withRoom @@ -81,32 +56,6 @@ object NostrChatroomDataSource : NostrDataSource("ChatroomFeed") { } } - override fun consume(event: Event, relay: Relay) { - if (this::account.isInitialized && LocalCache.justVerify(event)) { - if (event is GiftWrapEvent) { - val privateKey = account.keyPair.privKey - if (privateKey != null) { - event.cachedGift(privateKey)?.let { - this.consume(it, relay) - } - } - } - - if (event is SealedGossipEvent) { - val privateKey = account.keyPair.privKey - if (privateKey != null) { - event.cachedGossip(privateKey)?.let { - LocalCache.justConsume(it, relay) - } - } - - // Don't store sealed gossips to avoid rebroadcasting by mistake. - } else { - LocalCache.justConsume(event, relay) - } - } - } - val inandoutChannel = requestNewChannel { time, relayUrl -> latestEOSEs.addOrUpdate(account.userProfile(), withRoom.hashCode().toString(), relayUrl, time) }