Merge pull request #2834 from coreymull/gif-keyboard-chat-upload

Add GIF keyboard uploads to chat composers
This commit is contained in:
Vitor Pamplona
2026-05-11 08:19:54 -04:00
committed by GitHub
3 changed files with 13 additions and 0 deletions
@@ -67,6 +67,7 @@ import com.vitorpamplona.amethyst.ui.theme.EditFieldTrailingIconModifier
import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.placeholderText
import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.HexKey
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -164,6 +165,9 @@ fun MarmotGroupMessageComposer(
Column(modifier = EditFieldModifier) { Column(modifier = EditFieldModifier) {
ThinPaddingTextField( ThinPaddingTextField(
state = messageState, state = messageState,
onContentReceived = { uri, mimeType ->
uploadState.load(persistentListOf(SelectedMedia(uri, mimeType)))
},
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
shape = EditFieldBorder, shape = EditFieldBorder,
placeholder = { placeholder = {
@@ -57,6 +57,7 @@ import com.vitorpamplona.amethyst.ui.actions.MentionPreservingInputTransformatio
import com.vitorpamplona.amethyst.ui.actions.StrippingFailureDialog import com.vitorpamplona.amethyst.ui.actions.StrippingFailureDialog
import com.vitorpamplona.amethyst.ui.actions.UrlUserTagOutputTransformation import com.vitorpamplona.amethyst.ui.actions.UrlUserTagOutputTransformation
import com.vitorpamplona.amethyst.ui.actions.uploads.SelectFromGallery import com.vitorpamplona.amethyst.ui.actions.uploads.SelectFromGallery
import com.vitorpamplona.amethyst.ui.actions.uploads.SelectedMedia
import com.vitorpamplona.amethyst.ui.components.ThinPaddingTextField import com.vitorpamplona.amethyst.ui.components.ThinPaddingTextField
import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav import com.vitorpamplona.amethyst.ui.navigation.navs.EmptyNav
import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.navs.INav
@@ -204,6 +205,9 @@ fun EditField(
ThinPaddingTextField( ThinPaddingTextField(
state = channelScreenModel.message, state = channelScreenModel.message,
onTextChanged = { channelScreenModel.onMessageChanged() }, onTextChanged = { channelScreenModel.onMessageChanged() },
onContentReceived = { uri, mimeType ->
channelScreenModel.pickedMedia(persistentListOf(SelectedMedia(uri, mimeType)))
},
inputTransformation = MentionPreservingInputTransformation, inputTransformation = MentionPreservingInputTransformation,
keyboardOptions = PostKeyboard, keyboardOptions = PostKeyboard,
shape = EditFieldBorder, shape = EditFieldBorder,
@@ -41,6 +41,7 @@ import com.vitorpamplona.amethyst.ui.actions.MentionPreservingInputTransformatio
import com.vitorpamplona.amethyst.ui.actions.StrippingFailureDialog import com.vitorpamplona.amethyst.ui.actions.StrippingFailureDialog
import com.vitorpamplona.amethyst.ui.actions.UrlUserTagOutputTransformation import com.vitorpamplona.amethyst.ui.actions.UrlUserTagOutputTransformation
import com.vitorpamplona.amethyst.ui.actions.uploads.SelectFromGallery import com.vitorpamplona.amethyst.ui.actions.uploads.SelectFromGallery
import com.vitorpamplona.amethyst.ui.actions.uploads.SelectedMedia
import com.vitorpamplona.amethyst.ui.components.ThinPaddingTextField import com.vitorpamplona.amethyst.ui.components.ThinPaddingTextField
import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.navs.INav
import com.vitorpamplona.amethyst.ui.note.creators.emojiSuggestions.ShowEmojiSuggestionList import com.vitorpamplona.amethyst.ui.note.creators.emojiSuggestions.ShowEmojiSuggestionList
@@ -54,6 +55,7 @@ import com.vitorpamplona.amethyst.ui.theme.EditFieldModifier
import com.vitorpamplona.amethyst.ui.theme.EditFieldTrailingIconModifier import com.vitorpamplona.amethyst.ui.theme.EditFieldTrailingIconModifier
import com.vitorpamplona.amethyst.ui.theme.SuggestionListDefaultHeightChat import com.vitorpamplona.amethyst.ui.theme.SuggestionListDefaultHeightChat
import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.placeholderText
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.FlowPreview
@OptIn(FlowPreview::class) @OptIn(FlowPreview::class)
@@ -117,6 +119,9 @@ fun EditFieldRow(
ThinPaddingTextField( ThinPaddingTextField(
state = channelScreenModel.message, state = channelScreenModel.message,
onTextChanged = { channelScreenModel.onMessageChanged() }, onTextChanged = { channelScreenModel.onMessageChanged() },
onContentReceived = { uri, mimeType ->
channelScreenModel.pickedMedia(persistentListOf(SelectedMedia(uri, mimeType)))
},
inputTransformation = MentionPreservingInputTransformation, inputTransformation = MentionPreservingInputTransformation,
keyboardOptions = keyboardOptions =
KeyboardOptions.Default.copy( KeyboardOptions.Default.copy(