From 03483c932c5fb91a58a9d2ef6787dd1f23755219 Mon Sep 17 00:00:00 2001 From: davotoula Date: Sat, 23 Aug 2025 17:08:17 +0100 Subject: [PATCH] reduce warnings: remove unused nav parameter remove unnecessary ? operator replace .filter().first() with .first --- .../navigation/topbars/FeedFilterSpinner.kt | 20 ++++++++++++------- .../discover/nip99Classifieds/SellProduct.kt | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt index ae0dc505e..5832d24be 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/topbars/FeedFilterSpinner.kt @@ -260,12 +260,18 @@ fun RenderOption( val noteEvent = noteState.note.event val name = - if (noteEvent is PeopleListEvent) { - noteEvent.nameOrTitle() ?: option.note.dTag() - } else if (noteEvent is FollowListEvent) { - noteEvent.title() ?: option.note.dTag() - } else { - option.note.dTag() + when (noteEvent) { + is PeopleListEvent -> { + noteEvent.nameOrTitle() ?: option.note.dTag() + } + + is FollowListEvent -> { + noteEvent.title() ?: option.note.dTag() + } + + else -> { + option.note.dTag() + } } Text(text = name, color = MaterialTheme.colorScheme.onSurface) @@ -278,7 +284,7 @@ fun RenderOption( ) { val it by observeNote(option.note, accountViewModel) - Text(text = "/n/${((it?.note as? AddressableNote)?.dTag() ?: "")}", color = MaterialTheme.colorScheme.onSurface) + Text(text = "/n/${((it.note as? AddressableNote)?.dTag() ?: "")}", color = MaterialTheme.colorScheme.onSurface) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/SellProduct.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/SellProduct.kt index 6d7831a1a..ffd978b74 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/SellProduct.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/SellProduct.kt @@ -211,7 +211,7 @@ fun SellProduct(postViewModel: NewProductViewModel) { } TextSpinner( - placeholder = conditionTypes.filter { it.first == postViewModel.condition }.first().second, + placeholder = conditionTypes.first { it.first == postViewModel.condition }.second, options = conditionOptions, onSelect = { postViewModel.updateCondition(conditionTypes[it].first)