Commit d99a39ec authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Remove filtering.

parent 9f6519b9
package chat.rocket.android.favoritemessages.presentation package chat.rocket.android.favoritemessages.presentation
import chat.rocket.android.chatroom.viewmodel.BaseViewModel
import chat.rocket.android.chatroom.viewmodel.ImageAttachmentViewModel
import chat.rocket.android.chatroom.viewmodel.ViewModelMapper import chat.rocket.android.chatroom.viewmodel.ViewModelMapper
import chat.rocket.android.core.lifecycle.CancelStrategy import chat.rocket.android.core.lifecycle.CancelStrategy
import chat.rocket.android.server.domain.GetChatRoomsInteractor import chat.rocket.android.server.domain.GetChatRoomsInteractor
...@@ -9,7 +11,6 @@ import chat.rocket.android.util.extensions.launchUI ...@@ -9,7 +11,6 @@ import chat.rocket.android.util.extensions.launchUI
import chat.rocket.common.RocketChatException import chat.rocket.common.RocketChatException
import chat.rocket.common.util.ifNull import chat.rocket.common.util.ifNull
import chat.rocket.core.internal.rest.getFavoriteMessages import chat.rocket.core.internal.rest.getFavoriteMessages
import chat.rocket.core.model.isSystemMessage
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
...@@ -22,7 +23,7 @@ class FavoriteMessagesPresenter @Inject constructor( ...@@ -22,7 +23,7 @@ class FavoriteMessagesPresenter @Inject constructor(
factory: RocketChatClientFactory factory: RocketChatClientFactory
) { ) {
private val client = factory.create(serverInteractor.get()!!) private val client = factory.create(serverInteractor.get()!!)
private var favoriteMessagesListOffset: Int = 0 private var offset: Int = 0
/** /**
* Loads all favorite messages for room. the given room id. * Loads all favorite messages for room. the given room id.
...@@ -37,10 +38,10 @@ class FavoriteMessagesPresenter @Inject constructor( ...@@ -37,10 +38,10 @@ class FavoriteMessagesPresenter @Inject constructor(
chatRoom?.let { room -> chatRoom?.let { room ->
view.showLoading() view.showLoading()
val favoriteMessages = val favoriteMessages =
client.getFavoriteMessages(roomId, room.type, favoriteMessagesListOffset) client.getFavoriteMessages(roomId, room.type, offset)
favoriteMessagesListOffset = favoriteMessages.offset.toInt() offset = favoriteMessages.offset.toInt()
val messageList = val messageList =
mapper.map(favoriteMessages.result.filterNot { it.isSystemMessage() }) mapper.map(favoriteMessages.result)
view.showFavoriteMessages(messageList) view.showFavoriteMessages(messageList)
view.hideLoading() view.hideLoading()
}.ifNull { }.ifNull {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment