mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
Use correct model
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
54d1512fff
commit
5fd8541ddc
@ -6,9 +6,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.nextcloud.talk.openconversations.data
|
package com.nextcloud.talk.openconversations.data
|
||||||
|
|
||||||
|
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
|
|
||||||
interface OpenConversationsRepository {
|
interface OpenConversationsRepository {
|
||||||
|
|
||||||
fun fetchConversations(): Observable<OpenConversationsModel>
|
fun fetchConversations(): Observable<List<Conversation>>
|
||||||
}
|
}
|
||||||
|
@ -21,23 +21,11 @@ class OpenConversationsRepositoryImpl(private val ncApi: NcApi, currentUserProvi
|
|||||||
|
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.API_V4, ApiUtils.API_V3, 1))
|
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.API_V4, ApiUtils.API_V3, 1))
|
||||||
|
|
||||||
override fun fetchConversations(): Observable<OpenConversationsModel> {
|
override fun fetchConversations(): Observable<List<Conversation>> {
|
||||||
return ncApi.getOpenConversations(
|
val roomOverall = ncApi.getOpenConversations(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForOpenConversations(apiVersion, currentUser.baseUrl!!)
|
ApiUtils.getUrlForOpenConversations(apiVersion, currentUser.baseUrl!!)
|
||||||
).map { mapToOpenConversationsModel(it.ocs?.data!!) }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun mapToOpenConversationsModel(conversations: List<Conversation>): OpenConversationsModel {
|
|
||||||
return OpenConversationsModel(
|
|
||||||
conversations.map { conversation ->
|
|
||||||
OpenConversation(
|
|
||||||
// conversation.roomId!!,
|
|
||||||
conversation.token!!,
|
|
||||||
conversation.name!!,
|
|
||||||
conversation.description ?: ""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
return roomOverall.map { it.ocs?.data!! }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user