From fa80cb297d6f50ae96fbea4d7504dfb4c0c5f6ce Mon Sep 17 00:00:00 2001 From: David Kaspar Date: Sun, 3 Aug 2025 10:24:05 +0200 Subject: [PATCH] reduce lint warnings --- .../amethyst/ui/screen/loggedIn/AccountViewModel.kt | 12 ++++++------ .../ui/screen/loggedIn/DecryptAndIndexProcessor.kt | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 93885c30b4..47b886e320 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -949,7 +949,7 @@ class AccountViewModel( } } - suspend fun loadReactionTo(note: Note?): String? { + fun loadReactionTo(note: Note?): String? { if (note == null) return null return note.getReactionBy(userProfile()) @@ -1027,7 +1027,7 @@ class AccountViewModel( fun getUserIfExists(hex: HexKey): User? = LocalCache.getUserIfExists(hex) - private suspend fun checkGetOrCreateNote(key: HexKey): Note? = LocalCache.checkGetOrCreateNote(key) + private fun checkGetOrCreateNote(key: HexKey): Note? = LocalCache.checkGetOrCreateNote(key) override suspend fun getOrCreateNote(key: HexKey): Note = LocalCache.getOrCreateNote(key) @@ -1102,11 +1102,11 @@ class AccountViewModel( ) } - suspend fun checkGetOrCreatePublicChatChannel(key: HexKey): PublicChatChannel? = LocalCache.getOrCreatePublicChatChannel(key) + fun checkGetOrCreatePublicChatChannel(key: HexKey): PublicChatChannel? = LocalCache.getOrCreatePublicChatChannel(key) - suspend fun checkGetOrCreateLiveActivityChannel(key: Address): LiveActivitiesChannel? = LocalCache.getOrCreateLiveChannel(key) + fun checkGetOrCreateLiveActivityChannel(key: Address): LiveActivitiesChannel? = LocalCache.getOrCreateLiveChannel(key) - suspend fun checkGetOrCreateEphemeralChatChannel(key: RoomId): EphemeralChatChannel? = LocalCache.getOrCreateEphemeralChannel(key) + fun checkGetOrCreateEphemeralChatChannel(key: RoomId): EphemeralChatChannel? = LocalCache.getOrCreateEphemeralChannel(key) fun checkGetOrCreateChannel( key: HexKey, @@ -1660,7 +1660,7 @@ class AccountViewModel( } } - suspend fun findUsersStartingWithSync(prefix: String) = LocalCache.findUsersStartingWith(prefix, account) + fun findUsersStartingWithSync(prefix: String) = LocalCache.findUsersStartingWith(prefix, account) fun relayStatusFlow() = app.client.relayStatusFlow() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt index d74757b52b..7bca57ce91 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt @@ -46,7 +46,7 @@ class EventProcessor( private val account: Account, private val cache: LocalCache, ) { - private val decryptionService = DecryptionService(account, cache) + private val decryptionService = DecryptionService(account) private val indexingService = IndexingService(account, cache) private val chatroomService = ChatroomService(account) private val eventHandlers = createEventHandlers() @@ -132,10 +132,8 @@ class EventProcessor( } } -// Service classes following Single Responsibility Principle class DecryptionService( val account: Account, - private val cache: LocalCache, ) { suspend fun unwrapGiftWrap(event: GiftWrapEvent): Event? = event.unwrapOrNull(account.signer) @@ -251,7 +249,6 @@ class ChatroomService( } } -// Event handler interface and implementations following Strategy Pattern interface EventHandler { suspend fun process( event: Event,