Commit 63c8303c authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Updates ChatRoomsPresenter.kt

parent 96411414
...@@ -127,10 +127,12 @@ class ChatRoomsPresenter @Inject constructor( ...@@ -127,10 +127,12 @@ class ChatRoomsPresenter @Inject constructor(
id = it.id, id = it.id,
type = RoomType.DIRECT_MESSAGE, type = RoomType.DIRECT_MESSAGE,
user = SimpleUser(username = it.username, name = it.name, id = null), user = SimpleUser(username = it.username, name = it.name, id = null),
status = getActiveUsersInteractor.getActiveUserByUsername( status = if (it.name != null) {
currentServer, getActiveUsersInteractor.getActiveUserByUsername(currentServer, it.name!!)
it.name!! ?.status
)?.status, } else {
null
},
name = it.name ?: "", name = it.name ?: "",
fullName = it.name, fullName = it.name,
readonly = false, readonly = false,
...@@ -158,10 +160,12 @@ class ChatRoomsPresenter @Inject constructor( ...@@ -158,10 +160,12 @@ class ChatRoomsPresenter @Inject constructor(
id = it.id, id = it.id,
type = it.type, type = it.type,
user = it.user, user = it.user,
status = getActiveUsersInteractor.getActiveUserByUsername( status = if (it.name != null) {
currentServer, getActiveUsersInteractor.getActiveUserByUsername(currentServer, it.name!!)
it.name!! ?.status
)?.status, } else {
null
},
name = it.name ?: "", name = it.name ?: "",
fullName = it.fullName, fullName = it.fullName,
readonly = it.readonly, readonly = it.readonly,
...@@ -392,7 +396,7 @@ class ChatRoomsPresenter @Inject constructor( ...@@ -392,7 +396,7 @@ class ChatRoomsPresenter @Inject constructor(
user = room.user ?: user, user = room.user ?: user,
status = getActiveUsersInteractor.getActiveUserByUsername( status = getActiveUsersInteractor.getActiveUserByUsername(
currentServer, currentServer,
room.name!! room.name ?: name
)?.status, )?.status,
name = room.name ?: name, name = room.name ?: name,
fullName = room.fullName ?: fullName, fullName = room.fullName ?: fullName,
...@@ -471,8 +475,10 @@ class ChatRoomsPresenter @Inject constructor( ...@@ -471,8 +475,10 @@ class ChatRoomsPresenter @Inject constructor(
private suspend fun subscribeActiveUsers() { private suspend fun subscribeActiveUsers() {
manager.addActiveUserChannel(activeUserChannel) manager.addActiveUserChannel(activeUserChannel)
for (user in activeUserChannel) { launch(CommonPool + strategy.jobs) {
processActiveUser(user) for (user in activeUserChannel) {
processActiveUser(user)
}
} }
} }
......
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