File tree 1 file changed +9
-6
lines changed
app/src/main/java/com/troplo/privateuploader/screens
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
75
75
import com.troplo.privateuploader.data.model.MessageEvent
76
76
import com.troplo.privateuploader.data.model.MessageRequest
77
77
import kotlinx.coroutines.Dispatchers
78
+ import kotlinx.coroutines.delay
78
79
import kotlinx.coroutines.launch
79
80
import kotlinx.coroutines.withContext
80
81
import org.json.JSONObject
@@ -143,6 +144,13 @@ fun ChatScreen(
143
144
}
144
145
}
145
146
147
+ LaunchedEffect (message.value) {
148
+ if (message.value.isNotEmpty()) {
149
+ chatViewModel.typing(associationId)
150
+ }
151
+ delay(3000 )
152
+ }
153
+
146
154
Scaffold (
147
155
bottomBar = {
148
156
if (editId.value != 0 ) {
@@ -225,11 +233,6 @@ fun ChatScreen(
225
233
Text (" ${message.value.length} /4000" )
226
234
}
227
235
},
228
- keyboardActions = KeyboardActions (
229
- onAny = {
230
- chatViewModel.typing(associationId)
231
- }
232
- ),
233
236
trailingIcon = {
234
237
IconButton (
235
238
onClick = {
@@ -531,7 +534,7 @@ class ChatViewModel : ViewModel() {
531
534
id,
532
535
chatId = associationId,
533
536
userId = user.id,
534
- content = message,
537
+ content = message.trim() ,
535
538
createdAt = TpuFunctions .currentISODate(),
536
539
updatedAt = TpuFunctions .currentISODate(),
537
540
user = user,
You can’t perform that action at this time.
0 commit comments