From 6ec46daa31a60fc9f0ddbd9f83ea889946b5e36d Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 25 Mar 2026 17:40:39 -0400 Subject: [PATCH] refactor(wip): add TextFieldState to ViewModels and update call sites https://claude.ai/code/session_014FZPV258VfdeE1mcyeU7wU --- .../amethyst/ui/note/nip22Comments/CommentPostViewModel.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 da55dd4665..a02b10cd24 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 @@ -21,6 +21,7 @@ package com.vitorpamplona.amethyst.ui.note.nip22Comments 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 @@ -147,7 +148,8 @@ open class CommentPostViewModel : var notifying by mutableStateOf?>(null) - override var message by mutableStateOf(TextFieldValue("")) + override val messageState = TextFieldState() + var message by mutableStateOf(TextFieldValue("")) val urlPreviews = PreviewState() @@ -176,6 +178,7 @@ open class CommentPostViewModel : var wantsForwardZapTo by mutableStateOf(false) override var forwardZapTo = mutableStateOf>(SplitBuilder()) override var forwardZapToEditting = mutableStateOf(TextFieldValue("")) + override val forwardZapToEdittingState = TextFieldState() // NSFW, Sensitive var wantsToMarkAsSensitive by mutableStateOf(false) @@ -618,7 +621,7 @@ open class CommentPostViewModel : notifying = notifying?.filter { it != userToRemove } } - override fun updateMessage(newMessage: TextFieldValue) { + fun updateMessage(newMessage: TextFieldValue) { message = newMessage urlPreviews.update(message)