File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
app/src/main/java/com/troplo/privateuploader/screens Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ import com.troplo.privateuploader.data.model.Message
7575import com.troplo.privateuploader.data.model.MessageEvent
7676import com.troplo.privateuploader.data.model.MessageRequest
7777import kotlinx.coroutines.Dispatchers
78+ import kotlinx.coroutines.delay
7879import kotlinx.coroutines.launch
7980import kotlinx.coroutines.withContext
8081import org.json.JSONObject
@@ -143,6 +144,13 @@ fun ChatScreen(
143144 }
144145 }
145146
147+ LaunchedEffect (message.value) {
148+ if (message.value.isNotEmpty()) {
149+ chatViewModel.typing(associationId)
150+ }
151+ delay(3000 )
152+ }
153+
146154 Scaffold (
147155 bottomBar = {
148156 if (editId.value != 0 ) {
@@ -225,11 +233,6 @@ fun ChatScreen(
225233 Text (" ${message.value.length} /4000" )
226234 }
227235 },
228- keyboardActions = KeyboardActions (
229- onAny = {
230- chatViewModel.typing(associationId)
231- }
232- ),
233236 trailingIcon = {
234237 IconButton (
235238 onClick = {
@@ -531,7 +534,7 @@ class ChatViewModel : ViewModel() {
531534 id,
532535 chatId = associationId,
533536 userId = user.id,
534- content = message,
537+ content = message.trim() ,
535538 createdAt = TpuFunctions .currentISODate(),
536539 updatedAt = TpuFunctions .currentISODate(),
537540 user = user,
You can’t perform that action at this time.
0 commit comments