diff --git a/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/channels/ChatGPTChannelsViewModel.kt b/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/channels/ChatGPTChannelsViewModel.kt
index 8ddfd849..77aadd54 100644
--- a/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/channels/ChatGPTChannelsViewModel.kt
+++ b/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/channels/ChatGPTChannelsViewModel.kt
@@ -21,8 +21,9 @@ import androidx.lifecycle.viewModelScope
import com.skydoves.chatgpt.core.data.repository.GPTChannelRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import io.getstream.chat.android.client.utils.onError
-import io.getstream.chat.android.client.utils.onSuccess
+import io.getstream.chat.android.client.utils.onSuccessSuspend
import javax.inject.Inject
+import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
@@ -54,8 +55,10 @@ class ChatGPTChannelsViewModel @Inject constructor(
viewModelScope.launch {
channelsMutableUiState.value = GPTChannelUiState.Loading
val result = gptChannelRepository.createRandomChannel()
- result.onSuccess {
+ result.onSuccessSuspend {
channelsMutableUiState.value = GPTChannelUiState.Success(it.id)
+ delay(100L)
+ channelsMutableUiState.value = GPTChannelUiState.Nothing
}.onError {
channelsMutableUiState.value = GPTChannelUiState.Error
}
diff --git a/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/messages/ChatGPTMessages.kt b/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/messages/ChatGPTMessages.kt
index 52b794cf..8ce56742 100644
--- a/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/messages/ChatGPTMessages.kt
+++ b/feature-chat/src/main/kotlin/com/skydoves/chatgpt/feature/chat/messages/ChatGPTMessages.kt
@@ -503,7 +503,7 @@ private fun HandleToastMessages(
LaunchedEffect(key1 = error) {
if (error.isNotEmpty()) {
- viewModel.sendStreamChatMessage(error)
+ viewModel.sendStreamChatMessage("$error: ${context.getString(R.string.toast_hello)}")
}
}
}
diff --git a/feature-chat/src/main/res/values/strings.xml b/feature-chat/src/main/res/values/strings.xml
index ecd88a9e..89e1f511 100644
--- a/feature-chat/src/main/res/values/strings.xml
+++ b/feature-chat/src/main/res/values/strings.xml
@@ -18,6 +18,6 @@
Stream
A random ChatGPT channel is created!
Hi, I\'m OpenAI\'s ChatGPT with Stream SDK. Ask me anything!
- Something went wrong
+ Something went wrong. Please re-install this app.
Something went wrong. Please check out your session and CF_CLEARANCE is valid.