Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ serviceAccount.json
# Maestro screenshot test artifacts
maestro/screenshots/results/
maestro/screenshots/diffs/

docs/superpowers/
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.flipcash.app.messenger.internal

import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.foundation.text.input.clearText
import androidx.compose.foundation.text.input.setTextAndPlaceCursorAtEnd
import androidx.compose.runtime.snapshotFlow
import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
Expand Down Expand Up @@ -465,7 +466,7 @@ internal class ChatViewModel @Inject constructor(
val chatId = stateFlow.value.chatId ?: return@onEach
if (textToSend.isBlank()) return@onEach

stateFlow.value.chatInputState.clearText()
stateFlow.value.chatInputState.setTextAndPlaceCursorAtEnd("")

viewModelScope.launch {
chatCoordinator.sendMessage(chatId, textToSend)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ private fun UserControlBottomBar(
focusRequester = focusRequester,
hint = "Message",
state = state.chatInputState,
onSendMessage = { dispatch(ChatViewModel.Event.SendMessage) },
onSendMessage = {
dispatch(ChatViewModel.Event.SendMessage)
keyboard.restartInput()
},
)

LaunchedEffect(Unit) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.getcode.ui.utils

import android.annotation.SuppressLint
import android.content.Context
import android.view.View
import android.view.ViewTreeObserver
import android.view.inputmethod.InputMethodManager
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.State
Expand Down Expand Up @@ -55,6 +57,12 @@ class KeyboardController(
softwareController?.hide()
}

fun restartInput() {
val imm = view.context.getSystemService(Context.INPUT_METHOD_SERVICE)
as InputMethodManager
imm.restartInput(view)
}

fun hideIfVisible(block: () -> Unit = { }) {
coroutineScope.launch {
if (visible) {
Expand Down
Loading