From 4ee4a00b58bb6ad6f09438289a1f32b19dfecdd6 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 13:55:07 +0100 Subject: [PATCH 01/15] Add a nested comment explaining why this function is empty --- .../java/com/vitorpamplona/amethyst/ui/screen/AccountState.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountState.kt index 0495229ae..0b764e9e8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountState.kt @@ -65,7 +65,9 @@ class CompositionObserver( private val vmStore: StoreOwnerRegistry, private val key: Any, ) : RememberObserver { - override fun onRemembered() {} + override fun onRemembered() { + // No action needed when remembered — registration happens at construction time. + } override fun onForgotten() = vmStore.composableDetached(key) From ccb5738826ee914cfb55c7e4b8b55293e2ff1ed7 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 14:11:34 +0100 Subject: [PATCH 02/15] Replace the API-branched calls with ContextCompat.registerReceiver() which handles the flags transparently across all API levels --- .../amethyst/service/playback/pip/PipVideoView.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/PipVideoView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/PipVideoView.kt index 765138b3e..4a01cb6ec 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/PipVideoView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/PipVideoView.kt @@ -20,8 +20,6 @@ */ package com.vitorpamplona.amethyst.service.playback.pip -import android.content.Context.RECEIVER_EXPORTED -import android.os.Build import androidx.annotation.OptIn import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row @@ -34,6 +32,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext +import androidx.core.content.ContextCompat import androidx.media3.common.util.UnstableApi import androidx.media3.ui.compose.ContentFrame import androidx.media3.ui.compose.state.rememberMuteButtonState @@ -91,13 +90,8 @@ fun RegisterControllerReceiver(controllerState: MediaControllerState) { onPlayPause = controllerState::togglePlayPause, ) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - context.registerReceiver(receiver, receiver.filterMute, RECEIVER_EXPORTED) - context.registerReceiver(receiver, receiver.filterPlayPause, RECEIVER_EXPORTED) - } else { - context.registerReceiver(receiver, receiver.filterMute) - context.registerReceiver(receiver, receiver.filterPlayPause) - } + ContextCompat.registerReceiver(context, receiver, receiver.filterMute, ContextCompat.RECEIVER_EXPORTED) + ContextCompat.registerReceiver(context, receiver, receiver.filterPlayPause, ContextCompat.RECEIVER_EXPORTED) onDispose { context.unregisterReceiver(receiver) From 8876c3c1d727deb368fe186ddbe0f0264d03813e Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 14:15:06 +0100 Subject: [PATCH 03/15] use multi-dollar string interpolation avoid default locale --- .../amethyst/service/okhttp/OkHttpDebugLogging.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/OkHttpDebugLogging.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/OkHttpDebugLogging.kt index 367627357..e3c48929d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/OkHttpDebugLogging.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/OkHttpDebugLogging.kt @@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.service.okhttp import okhttp3.internal.concurrent.TaskRunner import okhttp3.internal.http2.Http2 import java.io.Closeable +import java.util.Locale import java.util.concurrent.CopyOnWriteArraySet import java.util.logging.ConsoleHandler import java.util.logging.Handler @@ -45,7 +46,7 @@ object OkHttpDebugLogging { level = Level.FINE formatter = object : SimpleFormatter() { - override fun format(record: LogRecord) = String.format("[%1\$tF %1\$tT] %2\$s %n", record.millis, record.message) + override fun format(record: LogRecord) = String.format(Locale.ROOT, $$"[%1$tF %1$tT] %2$s %n", record.millis, record.message) } } From 80fb171e0a257ce27ca945db2e857d0490661677 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 14:20:19 +0100 Subject: [PATCH 04/15] Unnecessary; SDK_INT is always >= 26 --- .../amethyst/service/tts/TextToSpeechEngine.kt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/tts/TextToSpeechEngine.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/tts/TextToSpeechEngine.kt index 0b9ec7042..c517d75f9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/tts/TextToSpeechEngine.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/tts/TextToSpeechEngine.kt @@ -22,7 +22,6 @@ package com.vitorpamplona.amethyst.service.tts import android.content.Context import android.media.AudioAttributes -import android.os.Build import android.speech.tts.TextToSpeech import android.speech.tts.UtteranceProgressListener import java.util.Locale @@ -79,15 +78,13 @@ class TextToSpeechEngine private constructor() { engine.setPitch(defaultPitch) engine.setSpeechRate(defaultSpeed) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - val audioAttributes = - AudioAttributes - .Builder() - .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH) - .setUsage(AudioAttributes.USAGE_MEDIA) - .build() - engine.setAudioAttributes(audioAttributes) - } + val audioAttributes = + AudioAttributes + .Builder() + .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH) + .setUsage(AudioAttributes.USAGE_MEDIA) + .build() + engine.setAudioAttributes(audioAttributes) engine.setListener( onStart = { onStartListener?.invoke() }, From 5ac8b9ad6239f90c00506a60fc385801105d8a9e Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 14:21:54 +0100 Subject: [PATCH 05/15] Prefer mutableLongStateOf instead of mutableStateOf --- .../amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt index c45eb4b20..32cfc5707 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt @@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.home import android.content.Context import androidx.compose.runtime.Stable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableLongStateOf import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue @@ -220,7 +221,7 @@ open class ShortNotePostViewModel : var canUsePoll by mutableStateOf(false) var wantsPoll by mutableStateOf(false) var pollOptions: SnapshotStateMap = newStateMapPollOptions() - var closedAt by mutableStateOf(TimeUtils.oneDayAhead()) + var closedAt by mutableLongStateOf(TimeUtils.oneDayAhead()) // Invoices var canAddInvoice by mutableStateOf(false) From 953e8c1749537ae28e6f6742e7079ab602a9877b Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 14:25:04 +0100 Subject: [PATCH 06/15] supress false positive --- .../amethyst/service/lnurl/LightningAddressResolver.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt index 5f3da6350..4eba0cb07 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt @@ -126,12 +126,14 @@ class LightningAddressResolver { okHttpClient: (String) -> OkHttpClient, context: Context, ): String { + @Suppress("BlockingMethodInNonBlockingContext") // URLEncoder.encode is CPU-only, not I/O blocking val encodedMessage = URLEncoder.encode(message, "utf-8") val urlBinder = if (lnCallback.contains("?")) "&" else "?" var url = "$lnCallback${urlBinder}amount=$milliSats&comment=$encodedMessage" if (nostrRequest != null) { + @Suppress("BlockingMethodInNonBlockingContext") // URLEncoder.encode is CPU-only, not I/O blocking val encodedNostrRequest = URLEncoder.encode(nostrRequest.toJson(), "utf-8") url += "&nostr=$encodedNostrRequest" } From 7de098063f9ca62f88ffde21615ba1f5857771d8 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 15:46:00 +0100 Subject: [PATCH 07/15] Specifying : ExoPlayer makes the contract explicit --- .../amethyst/service/playback/playerPool/ExoPlayerBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/playerPool/ExoPlayerBuilder.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/playerPool/ExoPlayerBuilder.kt index 65a0d433b..665530fc0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/playerPool/ExoPlayerBuilder.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/playerPool/ExoPlayerBuilder.kt @@ -35,7 +35,7 @@ import okhttp3.OkHttpClient class ExoPlayerBuilder( val okHttp: OkHttpClient, ) { - fun build(context: Context) = + fun build(context: Context): ExoPlayer = ExoPlayer .Builder(context) .apply { From 99e8ffcdebf929dc551e742e1e769c64a34980c8 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 17:14:31 +0100 Subject: [PATCH 08/15] Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable. --- .../amethyst/service/lang/LanguageTranslatorService.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt index bf1f8e109..886298d51 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/lang/LanguageTranslatorService.kt @@ -34,6 +34,7 @@ import com.linkedin.urls.detection.UrlDetector import com.linkedin.urls.detection.UrlDetectorOptions import com.vitorpamplona.amethyst.service.checkNotInMainThread import kotlinx.coroutines.CancellationException +import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import java.util.regex.Pattern @@ -45,7 +46,7 @@ data class ResultOrError( ) object LanguageTranslatorService { - var executorService = Executors.newCachedThreadPool() + var executorService: ExecutorService = Executors.newCachedThreadPool() private val options = LanguageIdentificationOptions @@ -54,8 +55,8 @@ object LanguageTranslatorService { .setConfidenceThreshold(0.6f) .build() private val languageIdentification = LanguageIdentification.getClient(options) - val lnRegex = Pattern.compile("\\blnbc[a-z0-9]+\\b", Pattern.CASE_INSENSITIVE) - val tagRegex = + val lnRegex: Pattern = Pattern.compile("\\blnbc[a-z0-9]+\\b", Pattern.CASE_INSENSITIVE) + val tagRegex: Pattern = Pattern.compile( "(nostr:)?@?(nsec1|npub1|nevent1|naddr1|note1|nprofile1|nrelay1)([qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)", Pattern.CASE_INSENSITIVE, From 34e1ea92b2868d2905a44c16209fa64b2fc9228e Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 17:15:32 +0100 Subject: [PATCH 09/15] Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable. --- .../java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt | 2 +- .../screen/loggedIn/notifications/NotificationSummaryState.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt index 99d2cc893..107bd36aa 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/TimeAgoFormatter.kt @@ -32,7 +32,7 @@ import kotlin.math.round private const val YEAR_DATE_FORMAT = "MMM dd, yyyy" private const val MONTH_DATE_FORMAT = "MMM dd" -var locale = Locale.getDefault() +var locale: Locale = Locale.getDefault() var yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) var monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt index 38799f3bf..9ed5f27d5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt @@ -82,7 +82,7 @@ class NotificationSummaryState( Instant.ofEpochSecond(createAt).atZone(ZoneId.systemDefault()).toLocalDateTime(), ) - fun today() = sdf.format(LocalDateTime.now()) + fun today(): String = sdf.format(LocalDateTime.now()) public suspend fun initializeSuspend() { checkNotInMainThread() From c8c42b5d70713af4ba7d609f462bd85eaba0b55f Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 17:17:26 +0100 Subject: [PATCH 10/15] If-Null return/break/... foldable to '?:' --- .../com/vitorpamplona/amethyst/model/LargeSoftCache.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt index c9a61d5cc..48e390b7c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt @@ -25,14 +25,13 @@ import java.lang.ref.WeakReference import java.util.concurrent.ConcurrentSkipListMap import java.util.function.BiConsumer -class LargeSoftCache : CacheOperations { - protected val cache = ConcurrentSkipListMap>() +class LargeSoftCache : CacheOperations { + private val cache = ConcurrentSkipListMap>() fun keys() = cache.keys fun get(key: K): V? { - val softRef = cache.get(key) - if (softRef == null) return null + val softRef = cache.get(key) ?: return null val value = softRef.get() return if (value != null) { @@ -135,7 +134,7 @@ class LargeSoftCache : CacheOperations { .forEach(BiConsumerWrapper(this, consumer)) } - class BiConsumerWrapper( + class BiConsumerWrapper( val cache: LargeSoftCache, val inner: BiConsumer, ) : BiConsumer> { From 8329184d991f8da982648f492edc308e8a85284b Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 17:21:43 +0100 Subject: [PATCH 11/15] correct package name --- .../java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt | 2 +- .../vitorpamplona/amethyst/ui/layouts/DisappearingBottomBar.kt | 2 +- .../amethyst/ui/layouts/DisappearingFloatingButton.kt | 2 +- .../vitorpamplona/amethyst/ui/layouts/DisappearingScaffold.kt | 2 -- .../screen/loggedIn/notifications/NotificationSummaryState.kt | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt index 48e390b7c..bc7c6cce3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LargeSoftCache.kt @@ -98,7 +98,7 @@ class LargeSoftCache : CacheOperations { // another thread may put in between cache.remove(key, softRef) val newObject = builder(key) - return cache.putIfAbsent(key, WeakReference(newObject))?.get() ?: newObject + cache.putIfAbsent(key, WeakReference(newObject))?.get() ?: newObject } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingBottomBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingBottomBar.kt index 4972c960f..68281cf55 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingBottomBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingBottomBar.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.myapplication +package com.vitorpamplona.amethyst.ui.layouts import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.AnimationState diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingFloatingButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingFloatingButton.kt index 6cdf473fc..0da9167d3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingFloatingButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingFloatingButton.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.myapplication +package com.vitorpamplona.amethyst.ui.layouts import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingScaffold.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingScaffold.kt index 8bb60a28b..3096fb99a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingScaffold.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/layouts/DisappearingScaffold.kt @@ -32,8 +32,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.DividerThickness -import com.vitorpamplona.myapplication.DisappearingBottomBar -import com.vitorpamplona.myapplication.DisappearingFloatingButton @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt index 9ed5f27d5..105d71a93 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt @@ -84,7 +84,7 @@ class NotificationSummaryState( fun today(): String = sdf.format(LocalDateTime.now()) - public suspend fun initializeSuspend() { + suspend fun initializeSuspend() { checkNotInMainThread() val currentUser = user.pubkeyHex From bd71e9ae8f55d54cb7c3f1bd3df3582b08084739 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 19:17:56 +0100 Subject: [PATCH 12/15] remove redundant modifiers --- .../com/vitorpamplona/amethyst/ImageUploadTesting.kt | 2 +- .../nip03Timestamp/TorAwareOkHttpOtsResolverBuilder.kt | 8 ++++---- .../amethyst/model/nip51Lists/BookmarkListState.kt | 2 +- .../amethyst/model/nip51Lists/HiddenUsersState.kt | 2 +- .../nip51Lists/searchRelays/SearchRelayListState.kt | 4 ++-- .../nip51Lists/trustedRelays/TrustedRelayListState.kt | 6 +++--- .../model/nipB7Blossom/BlossomServerListState.kt | 2 +- .../amethyst/model/preferences/DataStoreExt.kt | 2 +- .../amethyst/model/preferences/EncryptedDataStore.kt | 2 +- .../amethyst/model/topNavFeeds/OutboxLoaderState.kt | 2 +- .../allFollows/AllFollowsByOutboxTopNavFilter.kt | 4 ++-- .../allFollows/AllFollowsByProxyTopNavFilter.kt | 4 ++-- .../model/topNavFeeds/noteBased/NoteFeedFlow.kt | 10 +++++----- .../amethyst/service/cashu/melt/MeltProcessor.kt | 2 +- .../service/eventCache/MemoryTrimmingService.kt | 2 +- .../service/playback/composable/VideoViewInner.kt | 2 +- .../amethyst/service/playback/pip/IntentExtras.kt | 2 +- .../AccountNotificationsEoseFromInboxRelaysManager.kt | 2 +- .../AccountNotificationsEoseFromRandomRelaysManager.kt | 2 +- .../nip28PublicChats/ChannelLoaderSubAssembler.kt | 2 +- .../event/loaders/FilterMissingAddressables.kt | 2 +- .../reqCommand/event/loaders/FilterMissingEvents.kt | 2 +- .../amethyst/ui/components/AudioWaveformReadOnly.kt | 4 +--- .../amethyst/ui/feeds/ChannelFeedContentState.kt | 2 +- .../amethyst/ui/navigation/routes/RouteMaker.kt | 2 +- .../amethyst/ui/note/ZapPollNoteViewModel.kt | 2 +- .../ui/note/nip22Comments/CommentPostViewModel.kt | 4 ++-- .../com/vitorpamplona/amethyst/ui/note/types/Emoji.kt | 4 ++-- .../amethyst/ui/screen/AccountSessionManager.kt | 2 +- .../subassemblies/FilterMessagesToPublicChat.kt | 2 +- .../subassemblies/FilterMyMessagesToLiveActivities.kt | 2 +- .../datasource/FollowingEphemeralChatSubAssembler.kt | 2 +- .../datasource/FollowingPublicChatSubAssembler.kt | 2 +- .../datasource/GeoHashFeedFilterSubAssembler.kt | 2 +- .../UserProfileFollowersFilterSubAssembler.kt | 2 +- .../UserProfileMetadataFilterSubAssembler.kt | 2 +- .../relays/blocked/BlockedRelayListViewModel.kt | 2 +- .../relays/broadcast/BroadcastRelayListViewModel.kt | 2 +- .../relays/favorites/FavoriteRelayListViewModel.kt | 2 +- .../relays/indexer/IndexerRelayListViewModel.kt | 2 +- .../relays/nip37/PrivateOutboxRelayListViewModel.kt | 2 +- .../loggedIn/relays/proxy/ProxyRelayListViewModel.kt | 2 +- .../loggedIn/relays/search/SearchRelayListViewModel.kt | 2 +- .../relays/trusted/TrustedRelayListViewModel.kt | 2 +- .../notifications/PushNotificationReceiverService.kt | 2 +- 45 files changed, 59 insertions(+), 61 deletions(-) diff --git a/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt b/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt index 3aebe1c1c..0d4f7d976 100644 --- a/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt +++ b/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ImageUploadTesting.kt @@ -80,7 +80,7 @@ class ImageUploadTesting { .addInterceptor(DefaultContentTypeInterceptor("Amethyst/${BuildConfig.VERSION_NAME}")) .build() - private suspend fun getBitmap(): ByteArray { + private fun getBitmap(): ByteArray { val bitmap = Bitmap.createBitmap(200, 300, Bitmap.Config.ARGB_8888) for (x in 0 until bitmap.width) { for (y in 0 until bitmap.height) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip03Timestamp/TorAwareOkHttpOtsResolverBuilder.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip03Timestamp/TorAwareOkHttpOtsResolverBuilder.kt index b0c01c92a..d075edd0a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip03Timestamp/TorAwareOkHttpOtsResolverBuilder.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip03Timestamp/TorAwareOkHttpOtsResolverBuilder.kt @@ -34,9 +34,9 @@ class TorAwareOkHttpOtsResolverBuilder( ) : OtsResolverBuilder { fun getAPI(usingTor: Boolean) = if (usingTor) { - OkHttpBitcoinExplorer.Companion.MEMPOOL_API_URL + OkHttpBitcoinExplorer.MEMPOOL_API_URL } else { - OkHttpBitcoinExplorer.Companion.BLOCKSTREAM_API_URL + OkHttpBitcoinExplorer.BLOCKSTREAM_API_URL } override fun build(): OtsResolver = @@ -44,9 +44,9 @@ class TorAwareOkHttpOtsResolverBuilder( explorer = OkHttpBitcoinExplorer( baseUrl = { - getAPI(usingTor = isTorActive(OkHttpBitcoinExplorer.Companion.MEMPOOL_API_URL)) + getAPI(usingTor = isTorActive(OkHttpBitcoinExplorer.MEMPOOL_API_URL)) }, - client = okHttpClient(OkHttpBitcoinExplorer.Companion.MEMPOOL_API_URL), + client = okHttpClient(OkHttpBitcoinExplorer.MEMPOOL_API_URL), cache = cache, ), calendar = OkHttpCalendar(okHttpClient), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/BookmarkListState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/BookmarkListState.kt index ca15f42c4..9a438a880 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/BookmarkListState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/BookmarkListState.kt @@ -62,7 +62,7 @@ class BookmarkListState( fun getBookmarkList(): BookmarkListEvent? = bookmarkList.event as? BookmarkListEvent - suspend fun publicBookmarks(note: Note): List { + fun publicBookmarks(note: Note): List { val noteEvent = note.event as? BookmarkListEvent return noteEvent?.publicBookmarks() ?: emptyList() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/HiddenUsersState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/HiddenUsersState.kt index c39699277..8f45d8534 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/HiddenUsersState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/HiddenUsersState.kt @@ -47,7 +47,7 @@ class HiddenUsersState( ) { var transientHiddenUsers: MutableStateFlow> = MutableStateFlow(setOf()) - suspend fun assembleLiveHiddenUsers( + fun assembleLiveHiddenUsers( blockList: List, muteList: List, transientHiddenUsers: Set, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/searchRelays/SearchRelayListState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/searchRelays/SearchRelayListState.kt index e382bdfdd..1f823adbc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/searchRelays/SearchRelayListState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/searchRelays/SearchRelayListState.kt @@ -51,7 +51,7 @@ class SearchRelayListState( // Creates a long-term reference for this note so that the GC doesn't collect the note it self val searchListNote = cache.getOrCreateAddressableNote(getSearchRelayListAddress()) - fun getSearchRelayListAddress() = SearchRelayListEvent.Companion.createAddress(signer.pubKey) + fun getSearchRelayListAddress() = SearchRelayListEvent.createAddress(signer.pubKey) fun getSearchRelayListFlow(): StateFlow = searchListNote.flow().metadata.stateFlow @@ -70,7 +70,7 @@ class SearchRelayListState( .flowOn(Dispatchers.IO) .stateIn( scope, - SharingStarted.Companion.Eagerly, + SharingStarted.Eagerly, emptySet(), ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/trustedRelays/TrustedRelayListState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/trustedRelays/TrustedRelayListState.kt index 11eef7564..995c41cd6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/trustedRelays/TrustedRelayListState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/trustedRelays/TrustedRelayListState.kt @@ -68,7 +68,7 @@ class TrustedRelayListState( .flowOn(Dispatchers.IO) .stateIn( scope, - SharingStarted.Companion.Eagerly, + SharingStarted.Eagerly, emptySet(), ) @@ -76,13 +76,13 @@ class TrustedRelayListState( val relayListForTrusted = getTrustedRelayList() return if (relayListForTrusted != null && relayListForTrusted.tags.isNotEmpty()) { - TrustedRelayListEvent.Companion.updateRelayList( + TrustedRelayListEvent.updateRelayList( earlierVersion = relayListForTrusted, relays = trustedRelays, signer = signer, ) } else { - TrustedRelayListEvent.Companion.create( + TrustedRelayListEvent.create( relays = trustedRelays, signer = signer, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nipB7Blossom/BlossomServerListState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nipB7Blossom/BlossomServerListState.kt index 735868c78..ca4fbc387 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nipB7Blossom/BlossomServerListState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nipB7Blossom/BlossomServerListState.kt @@ -120,5 +120,5 @@ class BlossomServerListState( suspend fun createBlossomDeleteAuth( hash: HexKey, alt: String, - ): BlossomAuthorizationEvent? = BlossomAuthorizationEvent.createDeleteAuth(hash, alt, signer) + ): BlossomAuthorizationEvent = BlossomAuthorizationEvent.createDeleteAuth(hash, alt, signer) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt index f66037979..bc35e6b1d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt @@ -29,7 +29,7 @@ import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.map import java.io.IOException -suspend fun DataStore.getProperty( +fun DataStore.getProperty( key: Preferences.Key, parser: (String) -> T, serializer: (T) -> String, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt index 6ec67ae1a..d97cdd2fe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt @@ -67,7 +67,7 @@ class EncryptedDataStore( ?.get(key) ?.let { decrypt(it) } - suspend fun getProperty( + fun getProperty( key: Preferences.Key, parser: (String) -> T, serializer: (T) -> String, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/OutboxLoaderState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/OutboxLoaderState.kt index 49bf8371c..708731655 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/OutboxLoaderState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/OutboxLoaderState.kt @@ -48,7 +48,7 @@ class OutboxLoaderState( }.flowOn(Dispatchers.IO) .stateIn( scope, - SharingStarted.Companion.Eagerly, + SharingStarted.Eagerly, UnknownTopNavPerRelayFilterSet, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt index a607a0d42..bac9a832c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt @@ -52,8 +52,8 @@ class AllFollowsByOutboxTopNavFilter( val defaultRelays: StateFlow>, val blockedRelays: StateFlow>, ) : IFeedTopNavFilter { - val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.Companion.toScope(it) } - val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.Companion.toScope(it) } + val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.toScope(it) } + val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.toScope(it) } override fun matchAuthor(pubkey: HexKey): Boolean = authors == null || pubkey in authors diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByProxyTopNavFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByProxyTopNavFilter.kt index edd06abd5..bed71c9b8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByProxyTopNavFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByProxyTopNavFilter.kt @@ -47,8 +47,8 @@ class AllFollowsByProxyTopNavFilter( val communities: Set? = null, val proxyRelays: Set, ) : IFeedTopNavFilter { - val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.Companion.toScope(it) } - val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.Companion.toScope(it) } + val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.toScope(it) } + val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.toScope(it) } override fun matchAuthor(pubkey: HexKey): Boolean = authors == null || pubkey in authors diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/noteBased/NoteFeedFlow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/noteBased/NoteFeedFlow.kt index a32aabae3..fbd5492b2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/noteBased/NoteFeedFlow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/noteBased/NoteFeedFlow.kt @@ -62,7 +62,7 @@ class NoteFeedFlow( ): IFeedTopNavFilter = when (noteEvent) { is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) { + if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays) } else { AuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays) @@ -109,7 +109,7 @@ class NoteFeedFlow( ) { when (noteEvent) { is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) { + if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { emit(MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays)) } else { emit(AuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays)) @@ -161,7 +161,7 @@ class NoteFeedFlow( ): IFeedTopNavFilter = when (noteEvent) { is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) { + if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays) } else { AuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays) @@ -208,7 +208,7 @@ class NoteFeedFlow( ) { when (noteEvent) { is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) { + if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { emit(MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays)) } else { emit(AuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays)) @@ -272,7 +272,7 @@ class NoteFeedFlow( override fun startValue(): IFeedTopNavFilter { val noteEvent = metadataFlow.value?.note?.event return if (noteEvent == null) { - return AuthorsByOutboxTopNavFilter(emptySet(), blockedRelays) + AuthorsByOutboxTopNavFilter(emptySet(), blockedRelays) } else { if (proxyRelays.value.isEmpty()) { processByOutbox(noteEvent, outboxRelays.value) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/cashu/melt/MeltProcessor.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/cashu/melt/MeltProcessor.kt index d12b1ea08..6ea4f28bf 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/cashu/melt/MeltProcessor.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/cashu/melt/MeltProcessor.kt @@ -83,7 +83,7 @@ class MeltProcessor { ) } - suspend fun melt( + fun melt( token: CashuToken, lud16: String, okHttpClient: (String) -> OkHttpClient, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/eventCache/MemoryTrimmingService.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/eventCache/MemoryTrimmingService.kt index 925209294..c2ebbb38a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/eventCache/MemoryTrimmingService.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/eventCache/MemoryTrimmingService.kt @@ -32,7 +32,7 @@ class MemoryTrimmingService( ) { var isTrimmingMemoryMutex = AtomicBoolean(false) - private suspend fun doTrim( + private fun doTrim( account: Collection, otherAccounts: List, ) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoViewInner.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoViewInner.kt index 68e285b64..cef95667c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoViewInner.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoViewInner.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.amethyst.service.playback.composable.mainVideo.VideoPla import com.vitorpamplona.amethyst.service.playback.composable.mediaitem.GetMediaItem import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -public val DEFAULT_MUTED_SETTING = mutableStateOf(true) +val DEFAULT_MUTED_SETTING = mutableStateOf(true) @Composable fun VideoViewInner( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/IntentExtras.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/IntentExtras.kt index 145d8e9dc..a98c8232c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/IntentExtras.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/pip/IntentExtras.kt @@ -77,7 +77,7 @@ class IntentExtras { data.mimeType?.let { putString("mimeType", it) } data.aspectRatio?.let { putFloat("aspectRatio", it) } data.proxyPort?.let { putInt("proxyPort", it) } - data.keepPlaying.let { putBoolean("keepPlaying", it) } + putBoolean("keepPlaying", data.keepPlaying) data.waveformData?.let { putFloatArray("wavefrontData", it.wave.toFloatArray()) } bounds?.let { putInt("boundLeft", it.left) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromInboxRelaysManager.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromInboxRelaysManager.kt index f3e594d31..9d7c0cdfe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromInboxRelaysManager.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromInboxRelaysManager.kt @@ -49,7 +49,7 @@ class AccountNotificationsEoseFromInboxRelaysManager( override fun updateFilter( key: AccountQueryState, since: SincePerRelayMap?, - ): List? = + ): List = key.account.notificationRelays.flow.value.flatMap { filterSummaryNotificationsToPubkey( relay = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromRandomRelaysManager.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromRandomRelaysManager.kt index 55c14ab57..9aa0acc87 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromRandomRelaysManager.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/AccountNotificationsEoseFromRandomRelaysManager.kt @@ -50,7 +50,7 @@ class AccountNotificationsEoseFromRandomRelaysManager( override fun updateFilter( key: AccountQueryState, since: SincePerRelayMap?, - ): List? { + ): List { // only loads this after the feed is built val defaultSince = key.feedContentStates.notifications.lastNoteCreatedAtIfFilled() ?: TimeUtils.oneWeekAgo() return (key.account.followsPerRelay.value.keys - key.account.notificationRelays.flow.value).flatMap { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/nip28PublicChats/ChannelLoaderSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/nip28PublicChats/ChannelLoaderSubAssembler.kt index a2da47ae6..c14d14bd1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/nip28PublicChats/ChannelLoaderSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/nip28PublicChats/ChannelLoaderSubAssembler.kt @@ -38,7 +38,7 @@ class ChannelLoaderSubAssembler( client: INostrClient, allKeys: () -> Set, ) : SingleSubNoEoseCacheEoseManager(client, allKeys, invalidateAfterEose = true) { - override fun updateFilter(keys: List): List? = filterMissingChannelsById(keys) + override fun updateFilter(keys: List): List = filterMissingChannelsById(keys) override fun distinct(key: ChannelFinderQueryState) = key.channel } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingAddressables.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingAddressables.kt index 616465f9a..629aef281 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingAddressables.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingAddressables.kt @@ -71,7 +71,7 @@ fun potentialRelaysToFindAddress(note: AddressableNote): Set return set } -fun filterMissingAddressables(keys: List): List? { +fun filterMissingAddressables(keys: List): List { val addressesPerRelay = mapOfSet { keys.forEach { key -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingEvents.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingEvents.kt index c3a8da9c0..b4f378205 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingEvents.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/loaders/FilterMissingEvents.kt @@ -67,7 +67,7 @@ fun potentialRelaysToFindEvent(note: Note): Set { return set } -fun filterMissingEvents(keys: List): List? { +fun filterMissingEvents(keys: List): List { val eventsPerRelay = mapOfSet { keys.forEach { key -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AudioWaveformReadOnly.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AudioWaveformReadOnly.kt index 9f2dc5433..59ea44a51 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AudioWaveformReadOnly.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AudioWaveformReadOnly.kt @@ -207,6 +207,4 @@ internal fun Iterable.normalize( return values.map { scale * ((it - currentMin) / range) + min } } -private fun Int.safeDiv(value: Int): Float { - return if (value == 0) return 0F else this / value.toFloat() -} +private fun Int.safeDiv(value: Int): Float = if (value == 0) 0F else this / value.toFloat() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt index ba25e3a42..0b1f957e8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt @@ -64,7 +64,7 @@ class ChannelFeedContentState( viewModelScope.launch(Dispatchers.IO) { _scrollToTop.emit(_scrollToTop.value + 1) } } - suspend fun sentToTop() { + fun sentToTop() { scrolltoTopPending = false } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt index 25bdca7df..1f06f23b0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt @@ -323,7 +323,7 @@ suspend fun routeEditDraftTo( is ChatroomKeyable -> { val room = draft.chatroomKey(account.userProfile().pubkeyHex) account.chatroomList.getOrCreatePrivateChatroom(room) - return Route.Room(room, draftId = note.idHex) + Route.Room(room, draftId = note.idHex) } is TextNoteEvent -> { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt index 8cb381999..9d4b31d4a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt @@ -262,7 +262,7 @@ class PollNoteViewModel : ViewModel() { valueMinimum?.let { minimum -> valueMaximum?.let { maximum -> if (minimum != maximum) { - options.add(((minimum + maximum) / 2).toLong()) + options.add(((minimum + maximum) / 2)) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt index e790bcf0a..239c41d63 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt @@ -474,7 +474,7 @@ open class CommentPostViewModel : myMultiOrchestrator.upload( alt, contentWarningReason, - MediaCompressor.Companion.intToCompressorQuality(mediaQuality), + MediaCompressor.intToCompressorQuality(mediaQuality), server, account, context, @@ -703,5 +703,5 @@ open class CommentPostViewModel : return location!! } - override fun locationManager(): LocationState = Amethyst.Companion.instance.locationManager + override fun locationManager(): LocationState = Amethyst.instance.locationManager } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt index cbc301de9..1f8b59cff 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Emoji.kt @@ -63,7 +63,7 @@ import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent import com.vitorpamplona.quartz.nip30CustomEmoji.taggedEmojis @Composable -public fun RenderEmojiPack( +fun RenderEmojiPack( baseNote: Note, actionable: Boolean, backgroundColor: MutableState, @@ -86,7 +86,7 @@ public fun RenderEmojiPack( @OptIn(ExperimentalLayoutApi::class) @Composable -public fun RenderEmojiPack( +fun RenderEmojiPack( noteEvent: EmojiPackEvent, baseNote: Note, actionable: Boolean, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountSessionManager.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountSessionManager.kt index 3f5618ae1..04ae6867e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountSessionManager.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountSessionManager.kt @@ -118,7 +118,7 @@ class AccountSessionManager( } } - private suspend fun requestLoginUI() = _accountContent.update { AccountState.LoggedOff } + private fun requestLoginUI() = _accountContent.update { AccountState.LoggedOff } suspend fun loginAndStartUI( key: String, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMessagesToPublicChat.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMessagesToPublicChat.kt index c1561c440..1163f14ad 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMessagesToPublicChat.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMessagesToPublicChat.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent fun filterMessagesToPublicChat( channel: PublicChatChannel, since: SincePerRelayMap?, -): List? = +): List = channel.relays().toSet().map { RelayBasedFilter( relay = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMyMessagesToLiveActivities.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMyMessagesToLiveActivities.kt index 44bd9e3b4..006ca2832 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMyMessagesToLiveActivities.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/datasource/subassemblies/FilterMyMessagesToLiveActivities.kt @@ -31,7 +31,7 @@ fun filterMyMessagesToLiveActivities( channel: LiveActivitiesChannel, pubKey: HexKey, since: SincePerRelayMap?, -): List? = +): List = channel.relays().toSet().map { RelayBasedFilter( relay = it, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingEphemeralChatSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingEphemeralChatSubAssembler.kt index e333f7894..ad6ca0ddb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingEphemeralChatSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingEphemeralChatSubAssembler.kt @@ -40,7 +40,7 @@ class FollowingEphemeralChatSubAssembler( override fun updateFilter( key: ChatroomListState, since: SincePerRelayMap?, - ): List? = + ): List = listOfNotNull( filterFollowingEphemeralChats(key.account.ephemeralChatList.liveEphemeralChatList.value, since), ).flatten() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt index 8e4b0e4a8..98c66b737 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FollowingPublicChatSubAssembler.kt @@ -40,7 +40,7 @@ class FollowingPublicChatSubAssembler( override fun updateFilter( key: ChatroomListState, since: SincePerRelayMap?, - ): List? = + ): List = listOfNotNull( filterLastMessageFollowingPublicChats(key.account.publicChatList.flowSet.value, since), filterFollowingPublicChatsCreationEvent(key.account.publicChatList.flowSet.value, since), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/datasource/GeoHashFeedFilterSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/datasource/GeoHashFeedFilterSubAssembler.kt index a6f174ab0..9d7fe94ab 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/datasource/GeoHashFeedFilterSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/datasource/GeoHashFeedFilterSubAssembler.kt @@ -32,7 +32,7 @@ class GeoHashFeedFilterSubAssembler( override fun updateFilter( key: GeohashQueryState, since: SincePerRelayMap?, - ): List? = filterPostsByGeohash(key.geohash, key.relays, since) + ): List = filterPostsByGeohash(key.geohash, key.relays, since) /** * Only one key per hashtag. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileFollowersFilterSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileFollowersFilterSubAssembler.kt index 57030f718..6fe462fe8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileFollowersFilterSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileFollowersFilterSubAssembler.kt @@ -32,7 +32,7 @@ class UserProfileFollowersFilterSubAssembler( override fun updateFilter( key: UserProfileQueryState, since: SincePerRelayMap?, - ): List? = filterUserProfileFollowers(user(key), since) + ): List = filterUserProfileFollowers(user(key), since) override fun user(key: UserProfileQueryState) = key.user } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileMetadataFilterSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileMetadataFilterSubAssembler.kt index 78cde3b09..591010081 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileMetadataFilterSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/datasource/UserProfileMetadataFilterSubAssembler.kt @@ -34,7 +34,7 @@ class UserProfileMetadataFilterSubAssembler( override fun updateFilter( keys: List, since: SincePerRelayMap?, - ): List? { + ): List { val userPerRelay = mapOfSet { keys.mapTo(mutableSetOf()) { key -> key.user }.forEach { user -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListViewModel.kt index 25081c10b..abaf3faab 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/blocked/BlockedRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class BlockedRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.blockedRelayList.flow.value .toList() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListViewModel.kt index 608eb9405..1c94de0f6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/broadcast/BroadcastRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class BroadcastRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.broadcastRelayList.flow.value .toList() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/favorites/FavoriteRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/favorites/FavoriteRelayListViewModel.kt index a0d3ff0a6..45a95c11b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/favorites/FavoriteRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/favorites/FavoriteRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class FavoriteRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.favoriteRelayList.flow.value .toList() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListViewModel.kt index b4af90aeb..837966624 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/indexer/IndexerRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class IndexerRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.indexerRelayList.flowNoDefaults.value .toList() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListViewModel.kt index 628864a70..a3e5f9f41 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/nip37/PrivateOutboxRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class PrivateOutboxRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.privateStorageRelayList.flow.value .toList() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListViewModel.kt index 0d32e58c4..e2a0f1359 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/proxy/ProxyRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class ProxyRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.proxyRelayList.flow.value .toList() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListViewModel.kt index bbbbfc148..e2e3ba0aa 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/search/SearchRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class SearchRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.searchRelayList.flowNoDefaults.value .toList() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListViewModel.kt index 057c71098..c6b46496e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/trusted/TrustedRelayListViewModel.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl @Stable class TrustedRelayListViewModel : BasicRelaySetupInfoModel() { - override fun getRelayList(): List? = + override fun getRelayList(): List = account.trustedRelayList.flow.value .toList() diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt index b80c289f5..7ba915c3e 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt @@ -55,7 +55,7 @@ class PushNotificationReceiverService : FirebaseMessagingService() { } } - private suspend fun parseMessage(params: Map): GiftWrapEvent? { + private fun parseMessage(params: Map): GiftWrapEvent? { params["encryptedEvent"]?.let { eventStr -> (Event.fromJson(eventStr) as? GiftWrapEvent)?.let { return it From 8868b1b0e62363e8ef74d0d50053dc75084544b6 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 19:28:17 +0100 Subject: [PATCH 13/15] Explicit type arguments can be inferred --- .../com/vitorpamplona/amethyst/model/AccountSettings.kt | 6 +++--- .../java/com/vitorpamplona/amethyst/model/AntiSpamFilter.kt | 2 +- .../amethyst/model/preferences/DataStoreExt.kt | 2 +- .../amethyst/model/preferences/EncryptedDataStore.kt | 2 +- .../amethyst/model/serverList/MergedFollowListsState.kt | 4 ++-- .../allFollows/AllFollowsByOutboxTopNavFilter.kt | 4 ++-- .../allFollows/AllFollowsTopNavPerRelayFilter.kt | 4 ++-- .../model/topNavFeeds/aroundMe/LocationTopNavFilter.kt | 2 +- .../topNavFeeds/aroundMe/LocationTopNavPerRelayFilter.kt | 2 +- .../amethyst/service/location/LocationState.kt | 2 +- .../amethyst/service/playback/composable/VideoView.kt | 2 +- .../service/playback/composable/controls/MuteButton.kt | 2 +- .../relayClient/authCommand/model/ListWithUniqueSetCache.kt | 4 ++-- .../relayClient/reqCommand/RelaySubscriptionsCoordinator.kt | 3 +-- .../account/follows/AccountFollowsLoaderSubAssembler.kt | 2 +- .../reqCommand/event/watchers/EventWatcherSubAssembler.kt | 2 +- .../reqCommand/user/loaders/UserOutboxFinderSubAssembler.kt | 2 +- .../amethyst/service/relayClient/speedLogger/KindGroup.kt | 4 ++-- .../java/com/vitorpamplona/amethyst/service/relays/EOSE.kt | 4 ++-- .../vitorpamplona/amethyst/ui/components/ClickableRoute.kt | 2 +- .../amethyst/ui/feeds/ChannelFeedContentState.kt | 6 +++--- .../ui/navigation/drawer/AccountSwitchBottomSheet.kt | 2 +- .../com/vitorpamplona/amethyst/ui/navigation/navs/Nav.kt | 2 +- .../java/com/vitorpamplona/amethyst/ui/note/BlankNote.kt | 2 +- .../java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt | 4 ++-- .../amethyst/ui/note/creators/draftTags/DraftTagState.kt | 4 ++-- .../ui/note/creators/userSuggestions/UserSuggestionState.kt | 2 +- .../amethyst/ui/note/creators/zapsplits/DisplayZapSplits.kt | 2 +- .../amethyst/ui/note/elements/DisplayReward.kt | 4 ++-- .../amethyst/ui/note/elements/DisplayUncitedHashtags.kt | 2 +- .../vitorpamplona/amethyst/ui/note/types/PublicMessage.kt | 3 +-- .../amethyst/ui/screen/loggedIn/AccountViewModel.kt | 4 ++-- .../screen/loggedIn/chats/feed/layouts/ChatBubbleLayout.kt | 2 +- .../chats/privateDM/header/NewChatroomSubjectDialog.kt | 4 ++-- .../nip28PublicChat/metadata/ChannelMetadataViewModel.kt | 2 +- .../discover/nip53LiveActivities/LiveActivityCard.kt | 2 +- .../discover/nip99Classifieds/NewProductViewModel.kt | 2 +- .../ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt | 2 +- .../ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt | 2 +- .../amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt | 2 +- .../ui/screen/loggedIn/lists/list/PeopleListItem.kt | 2 +- .../screen/loggedIn/notifications/CardFeedContentState.kt | 2 +- .../profile/reports/dal/UserProfileReportsFeedFilter.kt | 2 +- .../screen/loggedIn/relays/common/RelaySuggestionState.kt | 3 +-- .../ui/screen/loggedIn/search/SearchBarViewModel.kt | 4 ++-- 45 files changed, 61 insertions(+), 64 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt index 94c178cd6..a2c42cc88 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt @@ -186,8 +186,8 @@ class AccountSettings( var backupEphemeralChatList: EphemeralChatListEvent? = null, var backupTrustProviderList: TrustProviderListEvent? = null, val lastReadPerRoute: MutableStateFlow>> = MutableStateFlow(mapOf()), - val hasDonatedInVersion: MutableStateFlow> = MutableStateFlow(setOf()), - val pendingAttestations: MutableStateFlow> = MutableStateFlow>(mapOf()), + val hasDonatedInVersion: MutableStateFlow> = MutableStateFlow(setOf()), + val pendingAttestations: MutableStateFlow> = MutableStateFlow(mapOf()), var backupNipA3PaymentTargets: PaymentTargetsEvent? = null, ) : EphemeralChatRepository, PublicChatListRepository { @@ -612,7 +612,7 @@ class AccountSettings( route: String, timestampInSecs: Long, ): MutableStateFlow = - MutableStateFlow(timestampInSecs).also { newFlow -> + MutableStateFlow(timestampInSecs).also { newFlow -> lastReadPerRoute.update { it + Pair(route, newFlow) } saveAccountSettings() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AntiSpamFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AntiSpamFilter.kt index 2d21b2b66..75c9e3aa7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AntiSpamFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AntiSpamFilter.kt @@ -170,7 +170,7 @@ class AntiSpamFilter { } } - val flowSpam = MutableStateFlow(AntiSpamState(this)) + val flowSpam = MutableStateFlow(AntiSpamState(this)) } class AntiSpamState( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt index bc35e6b1d..6c6611192 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/DataStoreExt.kt @@ -35,7 +35,7 @@ fun DataStore.getProperty( serializer: (T) -> String, scope: CoroutineScope, ): UpdatablePropertyFlow = - UpdatablePropertyFlow( + UpdatablePropertyFlow( flow = data .catch { e -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt index d97cdd2fe..02498472a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/EncryptedDataStore.kt @@ -72,7 +72,7 @@ class EncryptedDataStore( parser: (String) -> T, serializer: (T) -> String, ): UpdatablePropertyFlow = - UpdatablePropertyFlow( + UpdatablePropertyFlow( flow = store.data .catch { e -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/serverList/MergedFollowListsState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/serverList/MergedFollowListsState.kt index dba3ca53d..f3d7ae385 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/serverList/MergedFollowListsState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/serverList/MergedFollowListsState.kt @@ -60,8 +60,8 @@ class MergedFollowListsState( val geotags: Set = emptySet(), val communities: Set = emptySet(), ) { - val geotagScopes: Set = geotags.mapTo(mutableSetOf()) { GeohashId.toScope(it) } - val hashtagScopes: Set = hashtags.mapTo(mutableSetOf()) { HashtagId.toScope(it) } + val geotagScopes: Set = geotags.mapTo(mutableSetOf()) { GeohashId.toScope(it) } + val hashtagScopes: Set = hashtags.mapTo(mutableSetOf()) { HashtagId.toScope(it) } } fun mergeLists( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt index bac9a832c..6386b1d4d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsByOutboxTopNavFilter.kt @@ -52,8 +52,8 @@ class AllFollowsByOutboxTopNavFilter( val defaultRelays: StateFlow>, val blockedRelays: StateFlow>, ) : IFeedTopNavFilter { - val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.toScope(it) } - val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.toScope(it) } + val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.toScope(it) } + val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.toScope(it) } override fun matchAuthor(pubkey: HexKey): Boolean = authors == null || pubkey in authors diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsTopNavPerRelayFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsTopNavPerRelayFilter.kt index ff670117e..443bfd5c0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsTopNavPerRelayFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/allFollows/AllFollowsTopNavPerRelayFilter.kt @@ -35,6 +35,6 @@ class AllFollowsTopNavPerRelayFilter( val geotags: Set? = null, val communities: Set? = null, ) : IFeedTopNavPerRelayFilter { - val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.toScope(it) } - val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.toScope(it) } + val geotagScopes: Set? = geotags?.mapTo(mutableSetOf()) { GeohashId.toScope(it) } + val hashtagScopes: Set? = hashtags?.mapTo(mutableSetOf()) { HashtagId.toScope(it) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavFilter.kt index 7f0284b1c..24b39bee6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavFilter.kt @@ -37,7 +37,7 @@ class LocationTopNavFilter( val geotags: Set, val relayList: Set, ) : IFeedTopNavFilter { - val geotagScopes: Set = geotags.mapTo(mutableSetOf()) { GeohashId.toScope(it) } + val geotagScopes: Set = geotags.mapTo(mutableSetOf()) { GeohashId.toScope(it) } override fun matchAuthor(pubkey: HexKey): Boolean = true diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavPerRelayFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavPerRelayFilter.kt index 4792a92b2..bd1cd0743 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavPerRelayFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/topNavFeeds/aroundMe/LocationTopNavPerRelayFilter.kt @@ -28,5 +28,5 @@ import com.vitorpamplona.quartz.nip73ExternalIds.location.GeohashId class LocationTopNavPerRelayFilter( val geotags: Set, ) : IFeedTopNavPerRelayFilter { - val geotagScopes: Set = geotags.mapTo(mutableSetOf()) { GeohashId.toScope(it) } + val geotagScopes: Set = geotags.mapTo(mutableSetOf()) { GeohashId.toScope(it) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/location/LocationState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/location/LocationState.kt index 5e432c61e..c72cd8fe9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/location/LocationState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/location/LocationState.kt @@ -55,7 +55,7 @@ class LocationState( object Loading : LocationResult() } - private var hasLocationPermission = MutableStateFlow(false) + private var hasLocationPermission = MutableStateFlow(false) private var latestLocation: LocationResult = LocationResult.Loading fun setLocationPermission(newValue: Boolean) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoView.kt index f7e31c162..20ddfc233 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/VideoView.kt @@ -102,7 +102,7 @@ fun VideoView( ) { val automaticallyStartPlayback = remember { - mutableStateOf( + mutableStateOf( if (alwaysShowVideo) true else accountViewModel.settings.startVideoPlayback(), ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/controls/MuteButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/controls/MuteButton.kt index 0fe24ca92..e33a001dd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/controls/MuteButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/playback/composable/controls/MuteButton.kt @@ -76,7 +76,7 @@ fun MuteButton( ) { val holdOn = remember { - mutableStateOf( + mutableStateOf( true, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/ListWithUniqueSetCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/ListWithUniqueSetCache.kt index ec84d87dd..e51406c75 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/ListWithUniqueSetCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/ListWithUniqueSetCache.kt @@ -26,7 +26,7 @@ class ListWithUniqueSetCache( val key: (T) -> U, ) { private val list = AtomicReference(listOf()) - private val cacheSet = AtomicReference?>(setOf()) + private val cacheSet = AtomicReference?>(setOf()) fun isEmpty() = list.get().isEmpty() @@ -49,7 +49,7 @@ class ListWithUniqueSetCache( } // Compute and attempt to atomically update the cache - val newSet = list.get().mapTo(mutableSetOf(), key) + val newSet = list.get().mapTo(mutableSetOf(), key) cacheSet.compareAndSet(currentSet, newSet) return newSet } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/RelaySubscriptionsCoordinator.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/RelaySubscriptionsCoordinator.kt index bc00b34b9..6798df8ac 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/RelaySubscriptionsCoordinator.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/RelaySubscriptionsCoordinator.kt @@ -20,7 +20,6 @@ */ package com.vitorpamplona.amethyst.service.relayClient.reqCommand -import com.vitorpamplona.amethyst.commons.relayClient.composeSubscriptionManagers.ComposeSubscriptionManagerControls import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.AccountFilterAssembler import com.vitorpamplona.amethyst.service.relayClient.reqCommand.channel.ChannelFinderFilterAssemblyGroup @@ -88,7 +87,7 @@ class RelaySubscriptionsCoordinator( val nwc = NWCPaymentFilterAssembler(client) val all = - listOf( + listOf( account, home, chatroomList, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/follows/AccountFollowsLoaderSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/follows/AccountFollowsLoaderSubAssembler.kt index eb23bfe13..8192abf20 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/follows/AccountFollowsLoaderSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/follows/AccountFollowsLoaderSubAssembler.kt @@ -72,7 +72,7 @@ class AccountFollowsLoaderSubAssembler( * This assembler saves the EOSE per user key. That EOSE includes their metadata, etc * and reports, but only from trusted accounts (follows of all logged in users). */ - val hasTried: EOSEAccountFast = EOSEAccountFast(2000) + val hasTried: EOSEAccountFast = EOSEAccountFast(2000) // updates all filters override fun invalidateFilters(ignoreIfDoing: Boolean) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/watchers/EventWatcherSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/watchers/EventWatcherSubAssembler.kt index 2a648f18b..be3e7e252 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/watchers/EventWatcherSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/event/watchers/EventWatcherSubAssembler.kt @@ -37,7 +37,7 @@ class EventWatcherSubAssembler( allKeys: () -> Set, ) : SingleSubEoseManager(client, allKeys) { var lastNotesOnFilter = emptyList() - var latestEOSEs: EOSEAccountFast = EOSEAccountFast(1000) + var latestEOSEs: EOSEAccountFast = EOSEAccountFast(1000) override fun newEose( relay: NormalizedRelayUrl, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/loaders/UserOutboxFinderSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/loaders/UserOutboxFinderSubAssembler.kt index 56c9982e3..44316d6b1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/loaders/UserOutboxFinderSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/loaders/UserOutboxFinderSubAssembler.kt @@ -49,7 +49,7 @@ class UserOutboxFinderSubAssembler( * This assembler saves the EOSE per user key. That EOSE includes their metadata, etc * and reports, but only from trusted accounts (follows of all logged in users). */ - var hasTried: EOSEAccountFast = EOSEAccountFast(200) + var hasTried: EOSEAccountFast = EOSEAccountFast(200) fun newEose( relay: NormalizedRelayUrl, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/speedLogger/KindGroup.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/speedLogger/KindGroup.kt index 9937eac60..345cbd096 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/speedLogger/KindGroup.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/speedLogger/KindGroup.kt @@ -30,8 +30,8 @@ import kotlin.concurrent.atomics.ExperimentalAtomicApi class KindGroup( var count: AtomicInteger = AtomicInteger(0), var memory: AtomicInteger = AtomicInteger(0), - val subs: LargeCache = LargeCache(), - val relays: LargeCache = LargeCache(), + val subs: LargeCache = LargeCache(), + val relays: LargeCache = LargeCache(), ) { companion object { const val MB: Int = 1024 diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relays/EOSE.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relays/EOSE.kt index c04b6531b..e5e8179c0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relays/EOSE.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relays/EOSE.kt @@ -32,7 +32,7 @@ typealias MutableTime = com.vitorpamplona.amethyst.commons.relays.MutableTime open class EOSEByKey( cacheSize: Int = 200, ) { - var followList: LruCache = LruCache(cacheSize) + var followList: LruCache = LruCache(cacheSize) fun addOrUpdate( listCode: U, @@ -99,7 +99,7 @@ open class EOSEAccountKey( class EOSEAccountFast( cacheSize: Int = 20, ) { - private val users: LruCache = LruCache(cacheSize) + private val users: LruCache = LruCache(cacheSize) private val lock = Any() fun addOrUpdate( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt index ad2498aad..125d03248 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ClickableRoute.kt @@ -108,7 +108,7 @@ fun LoadOrCreateNote( content: @Composable (Note?) -> Unit, ) { var note by - remember(event.id) { mutableStateOf(accountViewModel.getNoteIfExists(event.id)) } + remember(event.id) { mutableStateOf(accountViewModel.getNoteIfExists(event.id)) } if (note == null) { LaunchedEffect(key1 = event.id) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt index 0b1f957e8..7b53a2fdd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/ChannelFeedContentState.kt @@ -49,7 +49,7 @@ class ChannelFeedContentState( val feedContent = _feedContent.asStateFlow() // Simple counter that changes when it needs to invalidate everything - private val _scrollToTop = MutableStateFlow(0) + private val _scrollToTop = MutableStateFlow(0) val scrollToTop = _scrollToTop.asStateFlow() var scrolltoTopPending = false @@ -98,10 +98,10 @@ class ChannelFeedContentState( if (notes.isEmpty()) { _feedContent.tryEmit(ChannelFeedState.Empty) } else if (currentState is ChannelFeedState.Loaded) { - currentState.feed.tryEmit(LoadedFeedState(notes, localFilter.showHiddenKey())) + currentState.feed.tryEmit(LoadedFeedState(notes, localFilter.showHiddenKey())) } else { _feedContent.tryEmit( - ChannelFeedState.Loaded(MutableStateFlow(LoadedFeedState(notes, localFilter.showHiddenKey()))), + ChannelFeedState.Loaded(MutableStateFlow(LoadedFeedState(notes, localFilter.showHiddenKey()))), ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt index 4cbd74bfe..9c2dfa282 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/drawer/AccountSwitchBottomSheet.kt @@ -130,7 +130,7 @@ fun DisplayAccount( accountSessionManager: AccountSessionManager, ) { var baseUser by remember(acc) { - mutableStateOf( + mutableStateOf( decodePublicKeyAsHexOrNull(acc.npub)?.let { LocalCache.getUserIfExists(it) }, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/Nav.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/Nav.kt index 7956d1e77..f3087a352 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/Nav.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/Nav.kt @@ -87,7 +87,7 @@ class Nav( ) { navigationScope.launch { controller.navigate(route) { - popUpTo(klass) { inclusive = true } + popUpTo(klass) { inclusive = true } } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BlankNote.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BlankNote.kt index ebd0913b7..b00c1735a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BlankNote.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BlankNote.kt @@ -98,7 +98,7 @@ fun HiddenNotePreview() { ThemeComparisonColumn( toPreview = { HiddenNote( - reports = persistentSetOf(), + reports = persistentSetOf(), isHiddenAuthor = true, accountViewModel = mockAccountViewModel(), nav = EmptyNav(), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 85dbd35e2..30ec920a3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -481,7 +481,7 @@ private fun ReactionDetailGallery( accountViewModel: AccountViewModel, ) { val defaultBackgroundColor = MaterialTheme.colorScheme.background - val backgroundColor = remember { mutableStateOf(defaultBackgroundColor) } + val backgroundColor = remember { mutableStateOf(defaultBackgroundColor) } val hasReactions by observeNoteReferences(baseNote, accountViewModel) @@ -757,7 +757,7 @@ private fun SlidingAnimationCount( if (accountViewModel.settings.isPerformanceMode()) { TextCount(baseCount, textColor) } else { - AnimatedContent( + AnimatedContent( targetState = baseCount, transitionSpec = AnimatedContentTransitionScope::transitionSpec, label = "SlidingAnimationCount", diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/draftTags/DraftTagState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/draftTags/DraftTagState.kt index d996b105a..a014a1627 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/draftTags/DraftTagState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/draftTags/DraftTagState.kt @@ -34,9 +34,9 @@ import kotlin.uuid.Uuid @Stable class DraftTagState { var current: String by mutableStateOf(newTag()) - var usedDraftTags by mutableStateOf(setOf(current)) + var usedDraftTags by mutableStateOf(setOf(current)) - private val _versions = MutableStateFlow(0) + private val _versions = MutableStateFlow(0) @OptIn(FlowPreview::class) val versions = _versions.debounce(1000) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/userSuggestions/UserSuggestionState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/userSuggestions/UserSuggestionState.kt index bf0ad4223..955696d97 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/userSuggestions/UserSuggestionState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/userSuggestions/UserSuggestionState.kt @@ -43,7 +43,7 @@ class UserSuggestionState( val account: Account, val requireAtSymbol: Boolean = true, ) { - val invalidations = MutableStateFlow(0) + val invalidations = MutableStateFlow(0) val currentWord = MutableStateFlow("") val searchDataSourceState = SearchQueryState(MutableStateFlow(""), account) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zapsplits/DisplayZapSplits.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zapsplits/DisplayZapSplits.kt index 9ef050b0e..f40ab6d72 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zapsplits/DisplayZapSplits.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/zapsplits/DisplayZapSplits.kt @@ -51,7 +51,7 @@ fun DisplayZapSplits( remember(noteEvent) { val list = noteEvent.zapSplitSetup() if (list.isEmpty() && useAuthorIfEmpty) { - listOf( + listOf( ZapSplitSetup( pubKeyHex = noteEvent.pubKey, relay = null, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayReward.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayReward.kt index a25ef4f8a..54cde53ca 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayReward.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayReward.kt @@ -116,13 +116,13 @@ private fun RenderPledgeAmount( ) { val repliesState by observeNoteReplies(baseNote, accountViewModel) var reward by remember { - mutableStateOf( + mutableStateOf( showAmount(baseReward.amount), ) } var hasPledge by remember { - mutableStateOf( + mutableStateOf( false, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayUncitedHashtags.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayUncitedHashtags.kt index 2038a77b7..11f573256 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayUncitedHashtags.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/DisplayUncitedHashtags.kt @@ -58,7 +58,7 @@ fun DisplayUncitedHashtags( nav: INav, ) { val unusedHashtags by - produceState(initialValue = emptyList()) { + produceState(initialValue = emptyList()) { val tagsInEvent = event.hashtags() if (tagsInEvent.isNotEmpty()) { val state = CachedRichTextParser.parseText(content, event.tags.toImmutableListOfLists(), callbackUri) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicMessage.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicMessage.kt index 2e178a678..a2b8773ad 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicMessage.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicMessage.kt @@ -35,7 +35,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow import com.vitorpamplona.amethyst.commons.model.toImmutableListOfLists import com.vitorpamplona.amethyst.model.Note -import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.ui.components.RenderUserAsClickableText import com.vitorpamplona.amethyst.ui.components.SensitivityWarning import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer @@ -102,7 +101,7 @@ fun DisplayUncitedUsers( nav: INav, ) { @Suppress("ProduceStateDoesNotAssignValue") - val uncitedUsers by produceState(initialValue = emptyList()) { + val uncitedUsers by produceState(initialValue = emptyList()) { val users = event.groupKeySetWithoutOwner() - event.citedUsers() if (users.isNotEmpty()) { val newUsers = accountViewModel.loadUsersSync(users.toList()) 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 1e0cea279..8f6c73859 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 @@ -511,7 +511,7 @@ class AccountViewModel( }.toMutableMap() val results = - mapNotNullAsync( + mapNotNullAsync( zaps.filter { (it.request.event as? LnZapRequestEvent)?.isPrivateZap() == true }, ) { next -> val info = innerDecryptAmountMessage(next.request, next.response) @@ -1609,7 +1609,7 @@ class AccountViewModel( }.stateIn( viewModelScope, SharingStarted.WhileSubscribed(5000), - emptySet(), + emptySet(), ) val draftNoteCache = CachedDraftNotes(this) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatBubbleLayout.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatBubbleLayout.kt index 072bb05cb..4fa4ac913 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatBubbleLayout.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatBubbleLayout.kt @@ -173,7 +173,7 @@ fun ChatBubbleLayout( private fun BubblePreview() { val bgColor = remember { - mutableStateOf(Color.Transparent) + mutableStateOf(Color.Transparent) } Column { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/NewChatroomSubjectDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/NewChatroomSubjectDialog.kt index 8b22d03ef..91addfd7a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/NewChatroomSubjectDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/header/NewChatroomSubjectDialog.kt @@ -73,14 +73,14 @@ fun NewChatroomSubjectDialog( Surface { val groupName = remember { - mutableStateOf( + mutableStateOf( accountViewModel.account.chatroomList.rooms .get(room) ?.subject ?.value ?: "", ) } - val message = remember { mutableStateOf("") } + val message = remember { mutableStateOf("") } val scope = rememberCoroutineScope() Column( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataViewModel.kt index 59c6800e7..310d5044a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip28PublicChat/metadata/ChannelMetadataViewModel.kt @@ -129,7 +129,7 @@ class ChannelMetadataViewModel : ViewModel() { val template = if (event != null) { - val hint = EventHintBundle(event, channel.relays().firstOrNull()) + val hint = EventHintBundle(event, channel.relays().firstOrNull()) ChannelMetadataEvent.build( channelName.value.text, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt index 41fffe055..3c89d5e9c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip53LiveActivities/LiveActivityCard.kt @@ -238,7 +238,7 @@ fun LoadParticipants( } } - val hostsAuthor = hosts + (baseNote.author?.let { listOf(it) } ?: emptyList()) + val hostsAuthor = hosts + (baseNote.author?.let { listOf(it) } ?: emptyList()) val topFilter = accountViewModel.account.liveDiscoveryFollowLists.value diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt index 14a3752a3..1297036b6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt @@ -142,7 +142,7 @@ open class NewProductViewModel : var price by mutableStateOf(TextFieldValue("")) var locationText by mutableStateOf(TextFieldValue("")) var category by mutableStateOf(TextFieldValue("")) - var condition by mutableStateOf(ConditionTag.CONDITION.USED_LIKE_NEW) + var condition by mutableStateOf(ConditionTag.CONDITION.USED_LIKE_NEW) // Invoices var canAddInvoice by mutableStateOf(false) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt index 53ef624e4..b00fbc9a1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt @@ -57,7 +57,7 @@ class GeoHashFeedFilter( override fun applyFilter(newItems: Set): Set = innerApplyFilter(newItems) - private fun innerApplyFilter(collection: Collection): Set = collection.filterTo(HashSet()) { acceptableEvent(it, tag) } + private fun innerApplyFilter(collection: Collection): Set = collection.filterTo(HashSet()) { acceptableEvent(it, tag) } fun acceptableEvent( it: Note, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt index fbb048075..9a95a0e46 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt @@ -59,7 +59,7 @@ class HashtagFeedFilter( override fun applyFilter(newItems: Set): Set = innerApplyFilter(newItems) - private fun innerApplyFilter(collection: Collection): Set = collection.filterTo(HashSet()) { acceptableEvent(it, tag) } + private fun innerApplyFilter(collection: Collection): Set = collection.filterTo(HashSet()) { acceptableEvent(it, tag) } fun acceptableEvent( it: Note, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt index 80f623b2c..504c4d10b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeLiveFilter.kt @@ -194,7 +194,7 @@ class HomeLiveFilter( return collection.sortedWith( compareByDescending { followCounts[it] } - .thenByDescending { it.lastNote?.createdAt() ?: 0L } + .thenByDescending { it.lastNote?.createdAt() ?: 0L } .thenBy { it.hashCode() }, ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/list/PeopleListItem.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/list/PeopleListItem.kt index 2ac13c5f7..369852526 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/list/PeopleListItem.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/list/PeopleListItem.kt @@ -426,7 +426,7 @@ private fun ListModifyDescriptionDialog( onDismissDialog: () -> Unit, onModifyDescription: (String) -> Unit, ) { - val updatedDescription = remember { mutableStateOf("") } + val updatedDescription = remember { mutableStateOf("") } val modifyIndicatorLabel = if (currentDescription == null) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt index eb53679fd..895b15d80 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt @@ -72,7 +72,7 @@ class CardFeedContentState( val feedContent = _feedContent.asStateFlow() // Simple counter that changes when it needs to invalidate everything - private val _scrollToTop = MutableStateFlow(0) + private val _scrollToTop = MutableStateFlow(0) val scrollToTop = _scrollToTop.asStateFlow() var scrolltoTopPending = false diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportsFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportsFeedFilter.kt index 0d6f9d4fa..2027b5106 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportsFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportsFeedFilter.kt @@ -38,7 +38,7 @@ class UserProfileReportsFeedFilter( private fun innerApplyFilter(collection: Collection): Set = collection - .filterTo(mutableSetOf()) { + .filterTo(mutableSetOf()) { it.event is ReportEvent && it.event?.isTaggedUser(user.pubkeyHex) == true } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelaySuggestionState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelaySuggestionState.kt index cd772c2f9..538df3e00 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelaySuggestionState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/RelaySuggestionState.kt @@ -22,7 +22,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common import androidx.compose.runtime.Stable import com.vitorpamplona.amethyst.model.LocalCache -import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.MutableStateFlow @@ -48,7 +47,7 @@ class RelaySuggestionState { .sortedBy { it.url } .take(20) } else { - emptyList() + emptyList() } }.flowOn(Dispatchers.IO) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt index 8855dd149..2eefaafe8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt @@ -62,8 +62,8 @@ class SearchBarViewModel( val focusRequester = FocusRequester() var searchValue by mutableStateOf("") - val invalidations = MutableStateFlow(0) - val searchValueFlow = MutableStateFlow("") + val invalidations = MutableStateFlow(0) + val searchValueFlow = MutableStateFlow("") val searchTerm = searchValueFlow From 582153b1934c696fbcff8c788fbc58036531fa1d Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 19:32:49 +0100 Subject: [PATCH 14/15] remove unused imports --- .../amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt | 1 - .../ui/screen/loggedIn/chess/ChessRelaySettingsSheet.kt | 1 - .../amethyst/ui/screen/loggedIn/settings/AllSettingsScreen.kt | 2 -- 3 files changed, 4 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt index 3b669b127..ad9ad0e22 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessLobbyScreen.kt @@ -29,7 +29,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessRelaySettingsSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessRelaySettingsSheet.kt index 1c1b7fb6d..d1a7d0e55 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessRelaySettingsSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessRelaySettingsSheet.kt @@ -42,7 +42,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AllSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AllSettingsScreen.kt index 7d2bcf860..ebb8058e8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AllSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/AllSettingsScreen.kt @@ -41,8 +41,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color From 7f0b2c500f3ff32b9e4c586d19c5d512e98b80e4 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 6 Mar 2026 19:43:15 +0100 Subject: [PATCH 15/15] add names to boolean params --- .../com/vitorpamplona/amethyst/AppModules.kt | 2 +- .../amethyst/ui/note/types/Poll.kt | 24 +++++++++---------- .../amethyst/ui/note/types/TorrentComment.kt | 12 +++++----- .../ui/screen/loggedIn/AccountViewModel.kt | 6 ++--- .../feed/types/RenderCreateChannelNote.kt | 4 ++-- .../loggedIn/discover/nip90DVMs/DVMCard.kt | 2 +- .../settings/SecurityFiltersScreen.kt | 2 +- .../loggedIn/threadview/ThreadFeedView.kt | 12 +++++----- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt index c05fa392c..ab83011f0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt @@ -226,7 +226,7 @@ class AppModules( val relayStats = RelayStats(client) // Logs debug messages when needed - val detailedLogger = if (isDebug) RelayLogger(client, false, false) else null + val detailedLogger = if (isDebug) RelayLogger(client, debugSending = false, debugReceiving = false) else null val relayReqStats = if (isDebug) RelayReqStats(client) else null val logger = if (isDebug) RelaySpeedLogger(client) else null diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Poll.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Poll.kt index e972fc750..949b92473 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Poll.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Poll.kt @@ -649,12 +649,12 @@ fun RenderPollGameResultsPreview() { Column(Modifier.padding(10.dp)) { RenderPoll( note, - false, - true, - 2, - remember { mutableStateOf(Color.Transparent) }, - mockAccountViewModel(), - EmptyNav(), + makeItShort = false, + canPreview = true, + quotesLeft = 2, + backgroundColor = remember { mutableStateOf(Color.Transparent) }, + accountViewModel = mockAccountViewModel(), + nav = EmptyNav(), ) } } @@ -758,12 +758,12 @@ fun RenderPollColorResultsPreview() { Column(Modifier.padding(10.dp)) { RenderPoll( note, - false, - true, - 2, - remember { mutableStateOf(Color.Transparent) }, - mockAccountViewModel(), - EmptyNav(), + makeItShort = false, + canPreview = true, + quotesLeft = 2, + backgroundColor = remember { mutableStateOf(Color.Transparent) }, + accountViewModel = mockAccountViewModel(), + nav = EmptyNav(), ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt index 8b063890e..7c5442ff0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TorrentComment.kt @@ -139,12 +139,12 @@ fun TorrentCommentPreview() { toPreview = { RenderTorrentComment( comment, - false, - true, - 3, - ReplyRenderType.FULL, - remember { mutableStateOf(Color.Transparent) }, - EmptyState, + makeItShort = false, + canPreview = true, + quotesLeft = 3, + unPackReply = ReplyRenderType.FULL, + backgroundColor = remember { mutableStateOf(Color.Transparent) }, + editState = EmptyState, accountViewModel = accountViewModel, nav = nav, ) 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 8f6c73859..f1e4b5c51 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 @@ -357,10 +357,10 @@ class AccountViewModel( return if (isPostHidden || isDecryptedPostHidden) { // Spam + Blocked Users + Hidden Words + Sensitive Content - NoteComposeReportState(isPostHidden, false, false, isHiddenAuthor) + NoteComposeReportState(isPostHidden, isAcceptable = false, canPreview = false, isHiddenAuthor = isHiddenAuthor) } else if (isFromLoggedIn || isFromLoggedInFollow) { // No need to process if from trusted people - NoteComposeReportState(isPostHidden, true, true, isHiddenAuthor) + NoteComposeReportState(isPostHidden, isAcceptable = true, canPreview = true, isHiddenAuthor = isHiddenAuthor) } else { val newCanPreview = !note.hasAnyReports() @@ -368,7 +368,7 @@ class AccountViewModel( if (newCanPreview && newIsAcceptable) { // No need to process reports if nothing is wrong - NoteComposeReportState(isPostHidden, true, true, false) + NoteComposeReportState(isPostHidden, isAcceptable = true, canPreview = true, isHiddenAuthor = false) } else { NoteComposeReportState( isPostHidden, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderCreateChannelNote.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderCreateChannelNote.kt index c717b982d..ac2453dec 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderCreateChannelNote.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderCreateChannelNote.kt @@ -222,8 +222,8 @@ fun RenderRelayLinePreview() { "wss://nos.lol", "http://icon.com/icon.ico", Modifier, - true, - true, + showPicture = true, + loadRobohash = true, ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip90DVMs/DVMCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip90DVMs/DVMCard.kt index f75e7d737..6fa904415 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip90DVMs/DVMCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip90DVMs/DVMCard.kt @@ -189,7 +189,7 @@ fun RenderContentDVMThumb( card.personalized?.let { var color = Color.DarkGray var name = "generic" - if (card.personalized == true) { + if (card.personalized) { color = MaterialTheme.colorScheme.bitcoinColor name = "Personalized" } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt index 5b6f0cdbb..21760c45e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/SecurityFiltersScreen.kt @@ -376,7 +376,7 @@ fun MutedWordActionOptions( ) { val isMutedWord by observeAccountIsHiddenWord(accountViewModel.account, word) - if (isMutedWord == true) { + if (isMutedWord) { ShowWordButton { if (!accountViewModel.isWriteable()) { accountViewModel.toastManager.toast( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt index fac25dca4..c86825e77 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt @@ -635,12 +635,12 @@ private fun FullBleedNoteCompose( } else if (noteEvent is InteractiveStoryBaseEvent) { RenderInteractiveStory( baseNote, - false, - true, - 3, - backgroundColor, - accountViewModel, - nav, + makeItShort = false, + canPreview = true, + quotesLeft = 3, + backgroundColor = backgroundColor, + accountViewModel = accountViewModel, + nav = nav, ) } else if (noteEvent is GitPatchEvent) { RenderGitPatchEvent(baseNote, makeItShort = false, canPreview = true, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav)