Unverified Commit cc896775 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge pull request #997 from RocketChat/fix/missing-chatroom-param

Add missing parameter to ChatRoom
parents b6b86885 477d12ab
...@@ -2,11 +2,16 @@ package chat.rocket.android.chatrooms.presentation ...@@ -2,11 +2,16 @@ package chat.rocket.android.chatrooms.presentation
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.main.presentation.MainNavigator
import chat.rocket.android.helper.ChatRoomsSortOrder import chat.rocket.android.helper.ChatRoomsSortOrder
import chat.rocket.android.helper.Constants import chat.rocket.android.helper.Constants
import chat.rocket.android.helper.SharedPreferenceHelper import chat.rocket.android.helper.SharedPreferenceHelper
import chat.rocket.android.server.domain.* import chat.rocket.android.main.presentation.MainNavigator
import chat.rocket.android.server.domain.GetChatRoomsInteractor
import chat.rocket.android.server.domain.GetCurrentServerInteractor
import chat.rocket.android.server.domain.RefreshSettingsInteractor
import chat.rocket.android.server.domain.SaveChatRoomsInteractor
import chat.rocket.android.server.domain.SettingsRepository
import chat.rocket.android.server.domain.useRealName
import chat.rocket.android.server.infraestructure.ConnectionManager import chat.rocket.android.server.infraestructure.ConnectionManager
import chat.rocket.android.server.infraestructure.ConnectionManagerFactory import chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import chat.rocket.android.server.infraestructure.chatRooms import chat.rocket.android.server.infraestructure.chatRooms
...@@ -23,14 +28,16 @@ import chat.rocket.core.internal.realtime.StreamMessage ...@@ -23,14 +28,16 @@ import chat.rocket.core.internal.realtime.StreamMessage
import chat.rocket.core.internal.realtime.Type import chat.rocket.core.internal.realtime.Type
import chat.rocket.core.internal.rest.spotlight import chat.rocket.core.internal.rest.spotlight
import chat.rocket.core.model.ChatRoom import chat.rocket.core.model.ChatRoom
import chat.rocket.core.model.Message
import chat.rocket.core.model.Room import chat.rocket.core.model.Room
import kotlinx.coroutines.experimental.* import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.Deferred
import kotlinx.coroutines.experimental.android.UI import kotlinx.coroutines.experimental.android.UI
import kotlinx.coroutines.experimental.async
import kotlinx.coroutines.experimental.channels.Channel import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.launch
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
import kotlin.reflect.KProperty
import kotlin.reflect.KProperty1 import kotlin.reflect.KProperty1
class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView, class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
...@@ -341,26 +348,27 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView, ...@@ -341,26 +348,27 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
val chatRooms = getChatRoomsInteractor.get(currentServer).toMutableList() val chatRooms = getChatRoomsInteractor.get(currentServer).toMutableList()
val chatRoom = chatRooms.find { chatRoom -> chatRoom.id == room.id } val chatRoom = chatRooms.find { chatRoom -> chatRoom.id == room.id }
chatRoom?.apply { chatRoom?.apply {
val newRoom = ChatRoom(room.id, val newRoom = ChatRoom(id = room.id,
room.type, type = room.type,
room.user ?: user, user = room.user ?: user,
room.name ?: name, name = room.name ?: name,
room.fullName ?: fullName, fullName = room.fullName ?: fullName,
room.readonly, readonly = room.readonly,
room.updatedAt ?: updatedAt, updatedAt = room.updatedAt ?: updatedAt,
timestamp, timestamp = timestamp,
lastSeen, lastSeen = lastSeen,
room.topic, topic = room.topic,
room.description, description = room.description,
room.announcement, announcement = room.announcement,
default, default = default,
open, favorite = favorite,
alert, open = open,
unread, alert = alert,
userMenstions, unread = unread,
groupMentions, userMenstions = userMenstions,
room.lastMessage, groupMentions = groupMentions,
client) lastMessage = room.lastMessage,
client = client)
removeRoom(room.id, chatRooms) removeRoom(room.id, chatRooms)
chatRooms.add(newRoom) chatRooms.add(newRoom)
saveChatRoomsInteractor.save(currentServer, sortRooms(chatRooms)) saveChatRoomsInteractor.save(currentServer, sortRooms(chatRooms))
...@@ -373,26 +381,27 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView, ...@@ -373,26 +381,27 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
val chatRooms = getChatRoomsInteractor.get(currentServer).toMutableList() val chatRooms = getChatRoomsInteractor.get(currentServer).toMutableList()
val chatRoom = chatRooms.find { chatRoom -> chatRoom.id == subscription.roomId } val chatRoom = chatRooms.find { chatRoom -> chatRoom.id == subscription.roomId }
chatRoom?.apply { chatRoom?.apply {
val newRoom = ChatRoom(subscription.roomId, val newRoom = ChatRoom(id = subscription.roomId,
subscription.type, type = subscription.type,
subscription.user ?: user, user = subscription.user ?: user,
subscription.name, name = subscription.name,
subscription.fullName ?: fullName, fullName = subscription.fullName ?: fullName,
subscription.readonly ?: readonly, readonly = subscription.readonly ?: readonly,
subscription.updatedAt ?: updatedAt, updatedAt = subscription.updatedAt ?: updatedAt,
subscription.timestamp ?: timestamp, timestamp = subscription.timestamp ?: timestamp,
subscription.lastSeen ?: lastSeen, lastSeen = subscription.lastSeen ?: lastSeen,
topic, topic = topic,
description, description = description,
announcement, announcement = announcement,
subscription.isDefault, default = subscription.isDefault,
subscription.open, favorite = subscription.isFavorite,
subscription.alert, open = subscription.open,
subscription.unread, alert = subscription.alert,
subscription.userMentions, unread = subscription.unread,
subscription.groupMentions, userMenstions = subscription.userMentions,
lastMessage, groupMentions = subscription.groupMentions,
client) lastMessage = lastMessage,
client = client)
removeRoom(subscription.roomId, chatRooms) removeRoom(subscription.roomId, chatRooms)
chatRooms.add(newRoom) chatRooms.add(newRoom)
saveChatRoomsInteractor.save(currentServer, sortRooms(chatRooms)) saveChatRoomsInteractor.save(currentServer, sortRooms(chatRooms))
......
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