get correct api version for chat

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-11-15 15:33:55 +01:00
parent 7a8eb3ca22
commit 66686d7602
No known key found for this signature in database
GPG key ID: F7AA2A8B65B50220
4 changed files with 7 additions and 5 deletions

View file

@ -746,7 +746,8 @@ class ConversationInfoActivity :
}
private fun clearHistory() {
viewModel.clearChatHistory(conversationToken)
val apiVersion = ApiUtils.getChatApiVersion(spreedCapabilities, intArrayOf(1))
viewModel.clearChatHistory(apiVersion,conversationToken)
}
private fun deleteConversation() {

View file

@ -285,10 +285,10 @@ class ConversationInfoViewModel @Inject constructor(
conversationsRepository.unarchiveConversation(user.getCredentials(), url)
}
fun clearChatHistory(roomToken:String){
fun clearChatHistory(apiVersion:Int,roomToken:String){
viewModelScope.launch{
try{
val clearChatResult = conversationsRepository.clearChatHistory(roomToken)
val clearChatResult = conversationsRepository.clearChatHistory(apiVersion,roomToken)
val statusCode: GenericMeta? = clearChatResult.ocs?.meta
val result = statusCode?.statusCode == STATUS_CODE_OK
if (result) {

View file

@ -27,5 +27,5 @@ interface ConversationsRepository {
fun setConversationReadOnly(credentials: String, url: String, state: Int): Observable<GenericOverall>
suspend fun clearChatHistory(roomToken:String): GenericOverall
suspend fun clearChatHistory(apiVersion:Int,roomToken:String): GenericOverall
}

View file

@ -92,9 +92,10 @@ class ConversationsRepositoryImpl(
}
override suspend fun clearChatHistory(roomToken:String): GenericOverall {
override suspend fun clearChatHistory(apiVersion:Int,roomToken:String): GenericOverall {
return coroutineApi.clearChatHistory(
credentials,
ApiUtils.getUrlForChat(apiVersion(), user.baseUrl!!, roomToken)
ApiUtils.getUrlForChat(apiVersion, user.baseUrl!!, roomToken)
)
}