From 6f44d7c28a222c53813438e683e9057be75cbbac Mon Sep 17 00:00:00 2001 From: davotoula Date: Wed, 17 Sep 2025 16:09:54 +0200 Subject: [PATCH 1/8] remove unused imports amethyst Fix ThreadDualAxisChartAssemblerTest (not sure how it was not breaking the build) --- .../ThreadDualAxisChartAssemblerTest.kt | 23 +++++++++++++++++++ .../model/preferences/TorSharedPreferences.kt | 1 - .../torState/AccountsTorStateConnector.kt | 1 - .../EventNotificationConsumer.kt | 1 - .../reqCommand/channel/ChannelObservers.kt | 1 - .../vitorpamplona/amethyst/ui/MainActivity.kt | 1 - .../loggedIn/privacy/PrivacyOptionsScreen.kt | 1 - .../profile/relays/RelayFeedViewModel.kt | 2 -- .../profile/relays/RelaysTabHeader.kt | 1 - .../common/BasicRelaySetupInfoDialog.kt | 1 - .../ui/screen/loggedOff/TorSettingsSetup.kt | 1 - 11 files changed, 23 insertions(+), 11 deletions(-) diff --git a/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ThreadDualAxisChartAssemblerTest.kt b/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ThreadDualAxisChartAssemblerTest.kt index 99db5b628..1292e6b5f 100644 --- a/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ThreadDualAxisChartAssemblerTest.kt +++ b/amethyst/src/androidTest/java/com/vitorpamplona/amethyst/ThreadDualAxisChartAssemblerTest.kt @@ -27,13 +27,17 @@ import com.vitorpamplona.amethyst.model.AccountSettings import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.service.location.LocationState import com.vitorpamplona.amethyst.service.okhttp.OkHttpWebSocket +import com.vitorpamplona.amethyst.service.relayClient.reqCommand.nwc.NWCPaymentFilterAssembler import com.vitorpamplona.amethyst.ui.screen.loggedIn.threadview.dal.ThreadFeedFilter import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.jackson.JsonMapper +import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag import com.vitorpamplona.quartz.nip01Core.verify +import com.vitorpamplona.quartz.nip03Timestamp.ots.okhttp.OkHttpOtsResolverBuilder +import com.vitorpamplona.quartz.nip03Timestamp.ots.okhttp.OtsBlockHeightCache import junit.framework.TestCase import junit.framework.TestCase.assertEquals import kotlinx.coroutines.CoroutineScope @@ -67,6 +71,25 @@ class ThreadDualAxisChartAssemblerTest { }, CoroutineScope(Dispatchers.IO + SupervisorJob()), ), + nwcFilterAssembler = + NWCPaymentFilterAssembler( + NostrClient( + OkHttpWebSocket.Builder { + OkHttpClient + .Builder() + .followRedirects(true) + .followSslRedirects(true) + .build() + }, + CoroutineScope(Dispatchers.IO + SupervisorJob()), + ), + ), + otsResolverBuilder = + OkHttpOtsResolverBuilder( + okHttpClient = { OkHttpClient.Builder().build() }, + isTorActive = { false }, + cache = OtsBlockHeightCache(), + ), ) val db = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/TorSharedPreferences.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/TorSharedPreferences.kt index af7fdaa96..89a19d8c3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/TorSharedPreferences.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/TorSharedPreferences.kt @@ -27,7 +27,6 @@ import androidx.datastore.preferences.core.booleanPreferencesKey import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.intPreferencesKey import androidx.datastore.preferences.core.stringPreferencesKey -import com.vitorpamplona.amethyst.ui.actions.MediaSaverToDisk.save import com.vitorpamplona.amethyst.ui.tor.TorSettings import com.vitorpamplona.amethyst.ui.tor.TorSettingsFlow import com.vitorpamplona.amethyst.ui.tor.TorType diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/torState/AccountsTorStateConnector.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/torState/AccountsTorStateConnector.kt index cea459d20..538ac3c50 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/torState/AccountsTorStateConnector.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/torState/AccountsTorStateConnector.kt @@ -34,7 +34,6 @@ import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.transformLatest -import kotlin.collections.ifEmpty class AccountsTorStateConnector( accountsCache: AccountCacheState, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt index 3b0727d02..f5e625416 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt @@ -29,7 +29,6 @@ import com.vitorpamplona.amethyst.LocalPreferences import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.LocalCache -import com.vitorpamplona.amethyst.model.LocalCache.chatroomList import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.sendDMNotification import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.sendZapNotification diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt index 4400ed68a..0e60c26c7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt @@ -26,7 +26,6 @@ import androidx.compose.runtime.remember import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.model.Channel import com.vitorpamplona.amethyst.model.ChannelState -import com.vitorpamplona.amethyst.model.LocalCache.notes import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatChannel import com.vitorpamplona.amethyst.model.nip53LiveActivities.LiveActivitiesChannel diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt index 2b8a9e1f4..9cb4de2e4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/MainActivity.kt @@ -28,7 +28,6 @@ import androidx.activity.enableEdgeToEdge import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.getValue import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.debugState diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/privacy/PrivacyOptionsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/privacy/PrivacyOptionsScreen.kt index 2ea3f5fc3..887a7b177 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/privacy/PrivacyOptionsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/privacy/PrivacyOptionsScreen.kt @@ -33,7 +33,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R -import com.vitorpamplona.amethyst.model.preferences.AccountPreferenceStores.Companion.torSettings import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.topbars.SavingTopBar import com.vitorpamplona.amethyst.ui.tor.PrivacySettingsBody diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt index 2ebbcd3fe..078ed2623 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt @@ -41,12 +41,10 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flowOn -import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.transformLatest import kotlinx.coroutines.launch -import kotlin.collections.map @Stable class RelayFeedViewModel : diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelaysTabHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelaysTabHeader.kt index 58ade6e62..4c211d588 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelaysTabHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelaysTabHeader.kt @@ -22,7 +22,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.relays import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt index 6e036b25b..575c6a1d7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/common/BasicRelaySetupInfoDialog.kt @@ -21,7 +21,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.Route import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/TorSettingsSetup.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/TorSettingsSetup.kt index c991b54df..d23445c1f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/TorSettingsSetup.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedOff/TorSettingsSetup.kt @@ -32,7 +32,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R -import com.vitorpamplona.amethyst.model.preferences.AccountPreferenceStores.Companion.torSettings import com.vitorpamplona.amethyst.ui.components.appendLink import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.tor.ConnectTorDialog From 4f3b7b24f2b6dcb208666eb2912d4f11722f6965 Mon Sep 17 00:00:00 2001 From: davotoula Date: Wed, 17 Sep 2025 16:19:40 +0200 Subject: [PATCH 2/8] remove unused imports --- .../kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt | 1 - .../com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt | 1 - 2 files changed, 2 deletions(-) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt index a33a6c2ad..085c2cfb5 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt @@ -47,7 +47,6 @@ import com.vitorpamplona.quartz.nip19Bech32.eventIds import com.vitorpamplona.quartz.nip19Bech32.pubKeyHints import com.vitorpamplona.quartz.nip19Bech32.pubKeys import com.vitorpamplona.quartz.nip23LongContent.tags.PublishedAtTag -import com.vitorpamplona.quartz.nip23LongContent.tags.PublishedAtTag.Companion.parse import com.vitorpamplona.quartz.nip31Alts.AltTag import com.vitorpamplona.quartz.nip50Search.SearchableEvent import com.vitorpamplona.quartz.utils.TimeUtils diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt index 39738bb91..4701b216a 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt @@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.nip01Core.tags.dTags.dTag import com.vitorpamplona.quartz.nip22Comments.RootScope import com.vitorpamplona.quartz.nip31Alts.alt -import com.vitorpamplona.quartz.nip71Video.videoIMetas import com.vitorpamplona.quartz.utils.TimeUtils import java.util.UUID From b20eb860ffb5a571b8ed247a80cc9a99c683c2a2 Mon Sep 17 00:00:00 2001 From: davotoula Date: Wed, 17 Sep 2025 20:38:40 +0200 Subject: [PATCH 3/8] Increase LruCache max size from 100 to 1,000 since we have so many more relays active with outbox --- .../quartz/nip01Core/relay/client/stats/RelayStats.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/stats/RelayStats.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/stats/RelayStats.kt index a282c9e49..4f1ee25e7 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/stats/RelayStats.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/stats/RelayStats.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl object RelayStats { private val innerCache = - object : LruCache(100) { + object : LruCache(1000) { override fun create(key: NormalizedRelayUrl?) = RelayStat() } From 50f173e4065f4f0444b126f056ede310b9612030 Mon Sep 17 00:00:00 2001 From: davotoula Date: Thu, 18 Sep 2025 13:08:31 +0200 Subject: [PATCH 4/8] replace repeated text string with top-level constant --- .../com/vitorpamplona/amethyst/DebugUtils.kt | 44 +++++++++---------- .../service/crashreports/CrashReportCache.kt | 8 ++-- .../EventNotificationConsumer.kt | 25 +++++------ .../amethyst/ui/note/RelayListRow.kt | 16 ++++--- .../amethyst/ui/note/TimeAgoFormatter.kt | 31 +++++++------ .../chats/feed/layouts/ChatBubbleLayout.kt | 10 +++-- 6 files changed, 70 insertions(+), 64 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt index 9224b615d..a702fdc62 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/DebugUtils.kt @@ -33,34 +33,32 @@ import kotlin.time.measureTimedValue @Suppress("SENSELESS_COMPARISON") val isDebug = BuildConfig.DEBUG || BuildConfig.BUILD_TYPE == "benchmark" -fun debugState(context: Context) { - // Amethyst.instance.client - // .allSubscriptions() - // .forEach { Log.d("STATE DUMP", "${it.key} ${it.value.filters.joinToString { it.filter.toJson() }}") } +private const val STATE_DUMP_TAG = "STATE DUMP" +fun debugState(context: Context) { val totalMemoryMb = Runtime.getRuntime().totalMemory() / (1024 * 1024) val freeMemoryMb = Runtime.getRuntime().freeMemory() / (1024 * 1024) val maxMemoryMb = Runtime.getRuntime().maxMemory() / (1024 * 1024) val jvmHeapAllocatedMb = totalMemoryMb - freeMemoryMb - Log.d("STATE DUMP", "Total Heap Allocated: $jvmHeapAllocatedMb/$maxMemoryMb MB") + Log.d(STATE_DUMP_TAG, "Total Heap Allocated: $jvmHeapAllocatedMb/$maxMemoryMb MB") val nativeHeap = Debug.getNativeHeapAllocatedSize() / (1024 * 1024) val maxNative = Debug.getNativeHeapSize() / (1024 * 1024) - Log.d("STATE DUMP", "Total Native Heap Allocated: $nativeHeap/$maxNative MB") + Log.d(STATE_DUMP_TAG, "Total Native Heap Allocated: $nativeHeap/$maxNative MB") val activityManager: ActivityManager? = context.getSystemService() if (activityManager != null) { val isLargeHeap = (context.applicationInfo.flags and ApplicationInfo.FLAG_LARGE_HEAP) != 0 val memClass = if (isLargeHeap) activityManager.largeMemoryClass else activityManager.memoryClass - Log.d("STATE DUMP", "Memory Class $memClass MB (largeHeap $isLargeHeap)") + Log.d(STATE_DUMP_TAG, "Memory Class $memClass MB (largeHeap $isLargeHeap)") } Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Connected Relays: " + Amethyst.instance.client .relayStatusFlow() @@ -71,16 +69,16 @@ fun debugState(context: Context) { ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Image Disk Cache ${(Amethyst.instance.diskCache.size) / (1024 * 1024)}/${(Amethyst.instance.diskCache.maxSize) / (1024 * 1024)} MB", ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Image Memory Cache ${(Amethyst.instance.memoryCache.size) / (1024 * 1024)}/${(Amethyst.instance.memoryCache.maxSize) / (1024 * 1024)} MB", ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Notes: " + LocalCache.notes.filter { _, it -> it.flowSet != null }.size + " / " + @@ -89,7 +87,7 @@ fun debugState(context: Context) { LocalCache.notes.size(), ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Addressables: " + LocalCache.addressables.filter { _, it -> it.flowSet != null }.size + " / " + @@ -98,7 +96,7 @@ fun debugState(context: Context) { LocalCache.addressables.size(), ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Users: " + LocalCache.users.filter { _, it -> it.flowSet != null }.size + " / " + @@ -107,7 +105,7 @@ fun debugState(context: Context) { LocalCache.users.size(), ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Public Chat Channels: " + LocalCache.publicChatChannels.filter { _, it -> it.flowSet != null }.size + " / " + @@ -116,7 +114,7 @@ fun debugState(context: Context) { LocalCache.publicChatChannels.values().sumOf { it.notes.size() }, ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Live Chat Channels: " + LocalCache.liveChatChannels.filter { _, it -> it.flowSet != null }.size + " / " + @@ -125,7 +123,7 @@ fun debugState(context: Context) { LocalCache.liveChatChannels.values().sumOf { it.notes.size() }, ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Ephemeral Chat Channels: " + LocalCache.ephemeralChannels.filter { _, it -> it.flowSet != null }.size + " / " + @@ -135,7 +133,7 @@ fun debugState(context: Context) { ) LocalCache.chatroomList.forEach { key, room -> Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Private Chats $key: " + room.rooms.size() + " / " + @@ -143,12 +141,12 @@ fun debugState(context: Context) { ) } Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Deletion Events: " + LocalCache.deletionIndex.size(), ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Observable Events: " + LocalCache.observablesByKindAndETag.size + " / " + @@ -156,13 +154,13 @@ fun debugState(context: Context) { ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Spam: " + LocalCache.antiSpam.spamMessages.size() + " / " + LocalCache.antiSpam.recentEventIds.size() + " / " + LocalCache.antiSpam.recentAddressables.size(), ) Log.d( - "STATE DUMP", + STATE_DUMP_TAG, "Memory used by Events: " + LocalCache.notes.sumOf { _, note -> note.event?.countMemory() ?: 0 } / (1024 * 1024) + " MB", @@ -179,10 +177,10 @@ fun debugState(context: Context) { .sumByGroup(groupMap = { _, it -> it.event?.kind }, sumOf = { _, it -> it.event?.countMemory()?.toLong() ?: 0L }) qttNotes.toList().sortedByDescending { bytesNotes[it.first] }.forEach { (kind, qtt) -> - Log.d("STATE DUMP", "Kind ${kind.toString().padStart(5,' ')}:\t${qtt.toString().padStart(6,' ')} elements\t${bytesNotes[kind]?.div((1024 * 1024))}MB ") + Log.d(STATE_DUMP_TAG, "Kind ${kind.toString().padStart(5,' ')}:\t${qtt.toString().padStart(6,' ')} elements\t${bytesNotes[kind]?.div((1024 * 1024))}MB ") } qttAddressables.toList().sortedByDescending { bytesNotes[it.first] }.forEach { (kind, qtt) -> - Log.d("STATE DUMP", "Kind ${kind.toString().padStart(5,' ')}:\t${qtt.toString().padStart(6,' ')} elements\t${bytesAddressables[kind]?.div((1024 * 1024))}MB ") + Log.d(STATE_DUMP_TAG, "Kind ${kind.toString().padStart(5,' ')}:\t${qtt.toString().padStart(6,' ')} elements\t${bytesAddressables[kind]?.div((1024 * 1024))}MB ") } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/crashreports/CrashReportCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/crashreports/CrashReportCache.kt index 64d4c2795..e57037850 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/crashreports/CrashReportCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/crashreports/CrashReportCache.kt @@ -27,16 +27,18 @@ import okio.FileNotFoundException import java.io.FileInputStream import java.io.InputStreamReader +private const val STACK_TRACE_FILENAME = "stack.trace" + class CrashReportCache( val appContext: Context, ) { - private fun outputStream() = appContext.openFileOutput("stack.trace", Context.MODE_PRIVATE) + private fun outputStream() = appContext.openFileOutput(STACK_TRACE_FILENAME, Context.MODE_PRIVATE) - private fun deleteReport() = appContext.deleteFile("stack.trace") + private fun deleteReport() = appContext.deleteFile(STACK_TRACE_FILENAME) private fun inputStreamOrNull(): FileInputStream? = try { - appContext.openFileInput("stack.trace") + appContext.openFileInput(STACK_TRACE_FILENAME) } catch (_: FileNotFoundException) { null } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt index f5e625416..cff44ff47 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt @@ -52,13 +52,12 @@ import com.vitorpamplona.quartz.utils.TimeUtils import java.math.BigDecimal import kotlin.coroutines.cancellation.CancellationException +private const val TAG = "EventNotificationConsumer" +private const val ACCOUNT_QUERY_PARAM = "?account=" + class EventNotificationConsumer( private val applicationContext: Context, ) { - companion object { - const val TAG = "EventNotificationConsumer" - } - suspend fun consume(event: GiftWrapEvent) { Log.d(TAG, "New Notification Arrived") @@ -210,7 +209,7 @@ class EventNotificationConsumer( val user = chatNote.author?.toBestDisplayName() ?: "" val userPicture = chatNote.author?.profilePicture() val noteUri = - chatNote.toNEvent() + "?account=" + + chatNote.toNEvent() + ACCOUNT_QUERY_PARAM + account.signer.pubKey .hexToByteArray() .toNpub() @@ -255,7 +254,7 @@ class EventNotificationConsumer( val user = chatNote.author?.toBestDisplayName() ?: "" val userPicture = chatNote.author?.profilePicture() val noteUri = - chatNote.toNEvent() + "?account=" + + chatNote.toNEvent() + ACCOUNT_QUERY_PARAM + account.signer.pubKey .hexToByteArray() .toNpub() @@ -297,7 +296,7 @@ class EventNotificationConsumer( val user = note.author?.toBestDisplayName() ?: "" val userPicture = note.author?.profilePicture() val noteUri = - note.toNEvent() + "?account=" + + note.toNEvent() + ACCOUNT_QUERY_PARAM + account.signer.pubKey .hexToByteArray() .toNpub() @@ -324,17 +323,17 @@ class EventNotificationConsumer( signer: NostrSigner, ): String? { val event = note.event - when (event) { + return when (event) { is PrivateDmEvent -> { - return event.decryptContent(signer) + event.decryptContent(signer) } is LnZapRequestEvent -> { - return decryptZapContentAuthor(event, signer)?.content + decryptZapContentAuthor(event, signer)?.content } else -> { - return event?.content + event?.content } } } @@ -402,7 +401,7 @@ class EventNotificationConsumer( } val userPicture = senderInfo.first.profilePicture() val noteUri = - "notifications?account=" + + "notifications$ACCOUNT_QUERY_PARAM" + account.signer.pubKey .hexToByteArray() .toNpub() @@ -437,7 +436,7 @@ class EventNotificationConsumer( val userPicture = senderInfo.first.profilePicture() val noteUri = - "notifications?account=" + + "notifications$ACCOUNT_QUERY_PARAM" + account.signer.pubKey .hexToByteArray() .toNpub() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt index a9d5370f8..43bbc572c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/RelayListRow.kt @@ -72,8 +72,10 @@ import com.vitorpamplona.amethyst.ui.theme.ripple24dp import com.vitorpamplona.amethyst.ui.theme.warningColorOnSecondSurface import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl +private const val DAMUS_RELAY_URL = "wss://relay.damus.io" + @Composable -public fun RelayBadgesHorizontal( +fun RelayBadgesHorizontal( baseNote: Note, accountViewModel: AccountViewModel, nav: INav, @@ -162,24 +164,24 @@ fun RenderRelayIconPreview() { ThemeComparisonColumn { Row { RenderRelayIcon( - displayUrl = "wss://relay.damus.io", - iconUrl = "wss://relay.damus.io", + displayUrl = DAMUS_RELAY_URL, + iconUrl = DAMUS_RELAY_URL, loadProfilePicture = true, pingInMs = 100, loadRobohash = true, iconModifier = LargeRelayIconModifier, ) RenderRelayIcon( - displayUrl = "wss://relay.damus.io", - iconUrl = "wss://relay.damus.io", + displayUrl = DAMUS_RELAY_URL, + iconUrl = DAMUS_RELAY_URL, loadProfilePicture = true, pingInMs = 300, loadRobohash = true, iconModifier = LargeRelayIconModifier, ) RenderRelayIcon( - displayUrl = "wss://relay.damus.io", - iconUrl = "wss://relay.damus.io", + displayUrl = DAMUS_RELAY_URL, + iconUrl = DAMUS_RELAY_URL, loadProfilePicture = true, pingInMs = 500, loadRobohash = true, 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 9f10562d3..4bc9a21e4 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 @@ -28,9 +28,12 @@ import com.vitorpamplona.quartz.utils.TimeUtils import java.text.SimpleDateFormat import java.util.Locale +private const val YEAR_DATE_FORMAT = "MMM dd, yyyy" +private const val MONTH_DATE_FORMAT = "MMM dd" + var locale = Locale.getDefault() -var yearFormatter = SimpleDateFormat("MMM dd, yyyy", locale) -var monthFormatter = SimpleDateFormat("MMM dd", locale) +var yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) +var monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) fun timeAgo( time: Long?, @@ -46,8 +49,8 @@ fun timeAgo( if (locale != Locale.getDefault()) { locale = Locale.getDefault() - yearFormatter = SimpleDateFormat("MMM dd, yyyy", locale) - monthFormatter = SimpleDateFormat("MMM dd", locale) + yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) + monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) } " • " + yearFormatter.format(time * 1000) @@ -55,8 +58,8 @@ fun timeAgo( // Dec 12 if (locale != Locale.getDefault()) { locale = Locale.getDefault() - yearFormatter = SimpleDateFormat("MMM dd, yyyy", locale) - monthFormatter = SimpleDateFormat("MMM dd", locale) + yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) + monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) } " • " + monthFormatter.format(time * 1000) @@ -86,8 +89,8 @@ fun timeAgoNoDot( if (locale != Locale.getDefault()) { locale = Locale.getDefault() - yearFormatter = SimpleDateFormat("MMM dd, yyyy", locale) - monthFormatter = SimpleDateFormat("MMM dd", locale) + yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) + monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) } yearFormatter.format(time * 1000) @@ -95,8 +98,8 @@ fun timeAgoNoDot( // Dec 12 if (locale != Locale.getDefault()) { locale = Locale.getDefault() - yearFormatter = SimpleDateFormat("MMM dd, yyyy", locale) - monthFormatter = SimpleDateFormat("MMM dd", locale) + yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) + monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) } monthFormatter.format(time * 1000) @@ -127,8 +130,8 @@ fun dateFormatter( if (locale != Locale.getDefault()) { locale = Locale.getDefault() - yearFormatter = SimpleDateFormat("MMM dd, yyyy", locale) - monthFormatter = SimpleDateFormat("MMM dd", locale) + yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) + monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) } yearFormatter.format(time * 1000) @@ -136,8 +139,8 @@ fun dateFormatter( // Dec 12 if (locale != Locale.getDefault()) { locale = Locale.getDefault() - yearFormatter = SimpleDateFormat("MMM dd, yyyy", locale) - monthFormatter = SimpleDateFormat("MMM dd", locale) + yearFormatter = SimpleDateFormat(YEAR_DATE_FORMAT, locale) + monthFormatter = SimpleDateFormat(MONTH_DATE_FORMAT, locale) } monthFormatter.format(time * 1000) 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 e58ab7c67..39ab2db9d 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 @@ -59,6 +59,8 @@ import com.vitorpamplona.amethyst.ui.theme.chatDraftBackground import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink import com.vitorpamplona.amethyst.ui.theme.messageBubbleLimits +private const val RELAYS_AND_ACTIONS_TEXT = "Relays and Actions" + @OptIn(ExperimentalFoundationApi::class) @Composable fun ChatBubbleLayout( @@ -205,7 +207,7 @@ private fun BubblePreview() { }, ) }, - detailRow = { Text("Relays and Actions") }, + detailRow = { Text(RELAYS_AND_ACTIONS_TEXT) }, ) { bgColor -> Text("This is my note") } @@ -239,7 +241,7 @@ private fun BubblePreview() { }, ) }, - detailRow = { Text("Relays and Actions") }, + detailRow = { Text(RELAYS_AND_ACTIONS_TEXT) }, ) { bgColor -> Text("This is a very long long loong note") } @@ -273,7 +275,7 @@ private fun BubblePreview() { }, ) }, - detailRow = { Text("Relays and Actions") }, + detailRow = { Text(RELAYS_AND_ACTIONS_TEXT) }, ) { bgColor -> Text("This is a draft note") } @@ -307,7 +309,7 @@ private fun BubblePreview() { }, ) }, - detailRow = { Text("Relays and Actions") }, + detailRow = { Text(RELAYS_AND_ACTIONS_TEXT) }, ) { bgColor -> Text("Short note") } From fdf372719c6caac5126fa67a7e356359e71c93ce Mon Sep 17 00:00:00 2001 From: davotoula Date: Thu, 18 Sep 2025 13:26:04 +0200 Subject: [PATCH 5/8] Replace with interface delegation using "by" in the class header Replace abstract class with an interface --- .../ui/navigation/navs/ObservableNav.kt | 19 +++--------- .../chats/rooms/twopane/TwoPaneNav.kt | 31 ++----------------- .../loggedIn/notifications/CardFeedState.kt | 16 +++++----- 3 files changed, 14 insertions(+), 52 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/ObservableNav.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/ObservableNav.kt index 03bfae269..458ea14f0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/ObservableNav.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/navs/ObservableNav.kt @@ -20,27 +20,16 @@ */ package com.vitorpamplona.amethyst.ui.navigation.navs -import androidx.compose.material3.DrawerState import com.vitorpamplona.amethyst.ui.navigation.routes.Route import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import kotlin.reflect.KClass class ObservableNav( - val sourceNav: INav, + private val sourceNav: INav, override val navigationScope: CoroutineScope, val onBeforeNavigate: () -> Unit, -) : INav { - override val drawerState: DrawerState = sourceNav.drawerState - - override fun closeDrawer() { - sourceNav.closeDrawer() - } - - override fun openDrawer() { - sourceNav.openDrawer() - } - +) : INav by sourceNav { override fun nav(route: Route) { navigationScope.launch { onBeforeNavigate() @@ -71,11 +60,11 @@ class ObservableNav( override fun popUpTo( route: Route, - upToClass: KClass, + klass: KClass, ) { navigationScope.launch { onBeforeNavigate() } - sourceNav.popUpTo(route, upToClass) + sourceNav.popUpTo(route, klass) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/twopane/TwoPaneNav.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/twopane/TwoPaneNav.kt index e0a3c12da..5c83da672 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/twopane/TwoPaneNav.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/twopane/TwoPaneNav.kt @@ -20,20 +20,16 @@ */ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.twopane -import androidx.compose.material3.DrawerState import androidx.compose.runtime.mutableStateOf import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.Route import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch -import kotlin.reflect.KClass class TwoPaneNav( - val nav: INav, + private val nav: INav, override val navigationScope: CoroutineScope, -) : INav { - override val drawerState: DrawerState = nav.drawerState - +) : INav by nav { val innerNav = mutableStateOf(null) override fun nav(route: Route) { @@ -56,27 +52,4 @@ class TwoPaneNav( } } } - - override fun newStack(route: Route) { - nav.newStack(route) - } - - override fun popBack() { - nav.popBack() - } - - override fun popUpTo( - route: Route, - klass: KClass, - ) { - nav.popUpTo(route, klass) - } - - override fun closeDrawer() { - nav.closeDrawer() - } - - override fun openDrawer() { - nav.openDrawer() - } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedState.kt index 7baa1fee9..2e9322086 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedState.kt @@ -33,16 +33,16 @@ import kotlinx.collections.immutable.toImmutableMap import kotlinx.coroutines.flow.MutableStateFlow @Immutable -abstract class Card { - abstract fun createdAt(): Long +interface Card { + fun createdAt(): Long - abstract fun id(): String + fun id(): String } @Immutable class BadgeCard( val note: Note, -) : Card() { +) : Card { override fun createdAt(): Long = note.createdAt() ?: 0L override fun id() = note.idHex @@ -51,7 +51,7 @@ class BadgeCard( @Immutable class NoteCard( val note: Note, -) : Card() { +) : Card { override fun createdAt(): Long = note.createdAt() ?: 0L override fun id() = note.idHex @@ -61,7 +61,7 @@ class NoteCard( class ZapUserSetCard( val user: User, val zapEvents: ImmutableList, -) : Card() { +) : Card { val createdAt = zapEvents.maxOfOrNull { it.createdAt() ?: 0L } ?: 0L override fun createdAt(): Long = createdAt @@ -75,7 +75,7 @@ class MultiSetCard( val boostEvents: ImmutableList, val likeEvents: ImmutableList, val zapEvents: ImmutableList, -) : Card() { +) : Card { val maxCreatedAt = maxOf( zapEvents.maxOfOrNull { it.createdAt() ?: 0L } ?: 0L, @@ -108,7 +108,7 @@ class MultiSetCard( @Immutable class MessageSetCard( val note: Note, -) : Card() { +) : Card { override fun createdAt(): Long = note.createdAt() ?: 0L override fun id() = note.idHex From 4cd86c8b1cf56c2b8f1273c689ebcb917313ea79 Mon Sep 17 00:00:00 2001 From: davotoula Date: Thu, 18 Sep 2025 15:06:46 +0200 Subject: [PATCH 6/8] return the boolean results from file(npub).delete() --- .../amethyst/model/preferences/AccountPreferenceStores.kt | 5 +++-- .../model/preferences/AccountSecretsEncryptedStores.kt | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountPreferenceStores.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountPreferenceStores.kt index d84767041..65ecf3981 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountPreferenceStores.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountPreferenceStores.kt @@ -75,8 +75,9 @@ class AccountPreferenceStores( ) } - fun removeAccount(npub: String) { - file(npub).delete() + fun removeAccount(npub: String): Boolean { + val deleted = file(npub).delete() storeCache.remove(npub) + return deleted } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountSecretsEncryptedStores.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountSecretsEncryptedStores.kt index fadcad035..3b6687ac8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountSecretsEncryptedStores.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/preferences/AccountSecretsEncryptedStores.kt @@ -69,8 +69,9 @@ class AccountSecretsEncryptedStores( serializer = Nip47WalletConnect.Nip47URI::serializer, ) - fun removeAccount(npub: String) { - file(npub).delete() + fun removeAccount(npub: String): Boolean { + val deleted = file(npub).delete() storeCache.remove(npub) + return deleted } } From 64cf81b523c9dcfb1550bd31a963bbcd76d1acf8 Mon Sep 17 00:00:00 2001 From: davotoula Date: Thu, 18 Sep 2025 16:33:32 +0200 Subject: [PATCH 7/8] remove void.cat from default servers --- .../vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt index a7698c60a..3f2e6d8f3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/mediaServers/ServerName.kt @@ -37,7 +37,6 @@ val DEFAULT_MEDIA_SERVERS: List = ServerName("Nostr.Build", "https://nostr.build", ServerType.NIP96), ServerName("NostrCheck.me (NIP-96)", "https://nostrcheck.me", ServerType.NIP96), ServerName("Sovbit", "https://files.sovbit.host", ServerType.NIP96), - ServerName("Void.cat", "https://void.cat", ServerType.NIP96), ServerName("Satellite (Paid)", "https://cdn.satellite.earth", ServerType.Blossom), ServerName("NostrCheck.me (Blossom)", "https://cdn.nostrcheck.me", ServerType.Blossom), ServerName("Nostr.Download", "https://nostr.download", ServerType.Blossom), From ee39b3ae189a22a86d61595ff0337535d18034ae Mon Sep 17 00:00:00 2001 From: davotoula Date: Thu, 18 Sep 2025 20:37:56 +0200 Subject: [PATCH 8/8] Fix for properly switch between single and two-pane layouts on rotation --- .../amethyst/ui/screen/loggedIn/chats/rooms/MessagesScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/MessagesScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/MessagesScreen.kt index f38fcbc57..404d170f2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/MessagesScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/MessagesScreen.kt @@ -43,7 +43,7 @@ fun MessagesScreen( val act = LocalContext.current.getActivity() val windowSizeClass = calculateWindowSizeClass(act) - val twoPane by remember { + val twoPane by remember(windowSizeClass.widthSizeClass) { derivedStateOf { when (windowSizeClass.widthSizeClass) { WindowWidthSizeClass.Compact -> false