mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
get correct api version for chat
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
7a8eb3ca22
commit
66686d7602
4 changed files with 7 additions and 5 deletions
|
@ -746,7 +746,8 @@ class ConversationInfoActivity :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun clearHistory() {
|
private fun clearHistory() {
|
||||||
viewModel.clearChatHistory(conversationToken)
|
val apiVersion = ApiUtils.getChatApiVersion(spreedCapabilities, intArrayOf(1))
|
||||||
|
viewModel.clearChatHistory(apiVersion,conversationToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteConversation() {
|
private fun deleteConversation() {
|
||||||
|
|
|
@ -285,10 +285,10 @@ class ConversationInfoViewModel @Inject constructor(
|
||||||
conversationsRepository.unarchiveConversation(user.getCredentials(), url)
|
conversationsRepository.unarchiveConversation(user.getCredentials(), url)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clearChatHistory(roomToken:String){
|
fun clearChatHistory(apiVersion:Int,roomToken:String){
|
||||||
viewModelScope.launch{
|
viewModelScope.launch{
|
||||||
try{
|
try{
|
||||||
val clearChatResult = conversationsRepository.clearChatHistory(roomToken)
|
val clearChatResult = conversationsRepository.clearChatHistory(apiVersion,roomToken)
|
||||||
val statusCode: GenericMeta? = clearChatResult.ocs?.meta
|
val statusCode: GenericMeta? = clearChatResult.ocs?.meta
|
||||||
val result = statusCode?.statusCode == STATUS_CODE_OK
|
val result = statusCode?.statusCode == STATUS_CODE_OK
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
|
@ -27,5 +27,5 @@ interface ConversationsRepository {
|
||||||
|
|
||||||
fun setConversationReadOnly(credentials: String, url: String, state: Int): Observable<GenericOverall>
|
fun setConversationReadOnly(credentials: String, url: String, state: Int): Observable<GenericOverall>
|
||||||
|
|
||||||
suspend fun clearChatHistory(roomToken:String): GenericOverall
|
suspend fun clearChatHistory(apiVersion:Int,roomToken:String): GenericOverall
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,9 +92,10 @@ class ConversationsRepositoryImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun clearChatHistory(roomToken:String): GenericOverall {
|
override suspend fun clearChatHistory(roomToken:String): GenericOverall {
|
||||||
|
override suspend fun clearChatHistory(apiVersion:Int,roomToken:String): GenericOverall {
|
||||||
return coroutineApi.clearChatHistory(
|
return coroutineApi.clearChatHistory(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForChat(apiVersion(), user.baseUrl!!, roomToken)
|
ApiUtils.getUrlForChat(apiVersion, user.baseUrl!!, roomToken)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue