From eefb76ba77896da646d3517f9d1b0fd123cef2a0 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 25 Mar 2026 17:14:14 -0400 Subject: [PATCH] refactor(wip): add TextFieldState to ViewModels and update call sites https://claude.ai/code/session_014FZPV258VfdeE1mcyeU7wU --- .../discover/nip99Classifieds/NewProductViewModel.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 826fa4eaa4..295132723a 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 @@ -21,6 +21,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.nip99Classifieds import android.content.Context +import androidx.compose.foundation.text.input.TextFieldState import androidx.compose.runtime.Stable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableLongStateOf @@ -131,7 +132,8 @@ open class NewProductViewModel : var productImages by mutableStateOf>(emptyList()) val iMetaDescription = IMetaAttachments() - override var message by mutableStateOf(TextFieldValue("")) + override val messageState = TextFieldState() + var message by mutableStateOf(TextFieldValue("")) val urlPreviews = PreviewState() @@ -151,8 +153,11 @@ open class NewProductViewModel : val strippingFailureConfirmation = SuspendableConfirmation() // Classifieds + val titleState = TextFieldState() var title by mutableStateOf(TextFieldValue("")) + val priceState = TextFieldState() var price by mutableStateOf(TextFieldValue("")) + val locationTextState = TextFieldState() var locationText by mutableStateOf(TextFieldValue("")) var category by mutableStateOf(TextFieldValue("")) var condition by mutableStateOf(ConditionTag.CONDITION.USED_LIKE_NEW) @@ -505,7 +510,7 @@ open class NewProductViewModel : this.multiOrchestrator?.remove(selected) } - override fun updateMessage(newMessage: TextFieldValue) { + fun updateMessage(newMessage: TextFieldValue) { message = newMessage urlPreviews.update(message)