Resolving some stability issues
This commit is contained in:
+2
@@ -21,12 +21,14 @@
|
|||||||
package com.vitorpamplona.amethyst.model.nip11RelayInfo
|
package com.vitorpamplona.amethyst.model.nip11RelayInfo
|
||||||
|
|
||||||
import android.util.LruCache
|
import android.util.LruCache
|
||||||
|
import androidx.compose.runtime.Stable
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl
|
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.toHttp
|
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.toHttp
|
||||||
import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation
|
import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
@Stable
|
||||||
class Nip11CachedRetriever(
|
class Nip11CachedRetriever(
|
||||||
val okHttpClient: (NormalizedRelayUrl) -> OkHttpClient,
|
val okHttpClient: (NormalizedRelayUrl) -> OkHttpClient,
|
||||||
) {
|
) {
|
||||||
|
|||||||
+2
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.service.relayClient.authCommand.model
|
package com.vitorpamplona.amethyst.service.relayClient.authCommand.model
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Stable
|
||||||
import com.vitorpamplona.amethyst.isDebug
|
import com.vitorpamplona.amethyst.isDebug
|
||||||
import com.vitorpamplona.amethyst.model.Account
|
import com.vitorpamplona.amethyst.model.Account
|
||||||
import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient
|
import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient
|
||||||
@@ -32,6 +33,7 @@ class ScreenAuthAccount(
|
|||||||
val account: Account,
|
val account: Account,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Stable
|
||||||
class AuthCoordinator(
|
class AuthCoordinator(
|
||||||
client: INostrClient,
|
client: INostrClient,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import androidx.compose.ui.platform.LocalClipboardManager
|
|||||||
import androidx.compose.ui.text.AnnotatedString
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
|
import com.vitorpamplona.amethyst.ui.components.toasts.ThrowableToastMsg
|
||||||
import com.vitorpamplona.amethyst.ui.stringRes
|
import com.vitorpamplona.amethyst.ui.stringRes
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size16dp
|
import com.vitorpamplona.amethyst.ui.theme.Size16dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
|
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
|
||||||
@@ -52,25 +53,23 @@ import java.io.StringWriter
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InformationDialog(
|
fun InformationDialog(
|
||||||
title: String,
|
obj: ThrowableToastMsg,
|
||||||
textContent: String?,
|
|
||||||
throwable: Throwable,
|
|
||||||
buttonColors: ButtonColors = ButtonDefaults.buttonColors(),
|
buttonColors: ButtonColors = ButtonDefaults.buttonColors(),
|
||||||
onDismiss: () -> Unit,
|
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 =
|
val stack =
|
||||||
remember(throwable) {
|
remember(obj) {
|
||||||
val writer = StringWriter()
|
val writer = StringWriter()
|
||||||
writer.append("\n")
|
writer.append("\n")
|
||||||
|
|
||||||
throwable.printStackTrace(PrintWriter(writer))
|
obj.throwable.printStackTrace(PrintWriter(writer))
|
||||||
|
|
||||||
writer.toString()
|
writer.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
InformationDialog(title = title, textContent = str, moreInfo = stack, buttonColors, onDismiss)
|
InformationDialog(title = stringRes(obj.titleResId), textContent = str, moreInfo = stack, buttonColors, onDismiss)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
+1
-5
@@ -77,11 +77,7 @@ fun DisplayErrorMessages(
|
|||||||
}
|
}
|
||||||
|
|
||||||
is ThrowableToastMsg -> {
|
is ThrowableToastMsg -> {
|
||||||
InformationDialog(
|
InformationDialog(obj) {
|
||||||
stringRes(obj.titleResId),
|
|
||||||
obj.msg,
|
|
||||||
obj.throwable,
|
|
||||||
) {
|
|
||||||
toastManager.clearToasts()
|
toastManager.clearToasts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user