diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip11RelayInfo/Nip11CachedRetriever.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip11RelayInfo/Nip11CachedRetriever.kt index 2a9b56068..ed87c5deb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip11RelayInfo/Nip11CachedRetriever.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip11RelayInfo/Nip11CachedRetriever.kt @@ -21,12 +21,14 @@ package com.vitorpamplona.amethyst.model.nip11RelayInfo import android.util.LruCache +import androidx.compose.runtime.Stable import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.toHttp import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation import okhttp3.OkHttpClient +@Stable class Nip11CachedRetriever( val okHttpClient: (NormalizedRelayUrl) -> OkHttpClient, ) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/AuthCoordinator.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/AuthCoordinator.kt index 245d6b543..2437c21a2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/AuthCoordinator.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/authCommand/model/AuthCoordinator.kt @@ -20,6 +20,7 @@ */ package com.vitorpamplona.amethyst.service.relayClient.authCommand.model +import androidx.compose.runtime.Stable import com.vitorpamplona.amethyst.isDebug import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient @@ -32,6 +33,7 @@ class ScreenAuthAccount( val account: Account, ) +@Stable class AuthCoordinator( client: INostrClient, scope: CoroutineScope, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt index 04c6da4b6..411996a8f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/InformationDialog.kt @@ -44,6 +44,7 @@ import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.ui.components.toasts.ThrowableToastMsg import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.Size16dp import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer @@ -52,25 +53,23 @@ import java.io.StringWriter @Composable fun InformationDialog( - title: String, - textContent: String?, - throwable: Throwable, + obj: ThrowableToastMsg, buttonColors: ButtonColors = ButtonDefaults.buttonColors(), onDismiss: () -> Unit, ) { - val str = textContent ?: throwable.localizedMessage ?: throwable.message ?: throwable.javaClass.simpleName + val str = obj.msg ?: obj.throwable.localizedMessage ?: obj.throwable.message ?: obj.throwable.javaClass.simpleName val stack = - remember(throwable) { + remember(obj) { val writer = StringWriter() writer.append("\n") - throwable.printStackTrace(PrintWriter(writer)) + obj.throwable.printStackTrace(PrintWriter(writer)) writer.toString() } - InformationDialog(title = title, textContent = str, moreInfo = stack, buttonColors, onDismiss) + InformationDialog(title = stringRes(obj.titleResId), textContent = str, moreInfo = stack, buttonColors, onDismiss) } @Composable diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt index 936d50d7f..89c945c91 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/toasts/DisplayErrorMessages.kt @@ -77,11 +77,7 @@ fun DisplayErrorMessages( } is ThrowableToastMsg -> { - InformationDialog( - stringRes(obj.titleResId), - obj.msg, - obj.throwable, - ) { + InformationDialog(obj) { toastManager.clearToasts() } }