Commit 7d813c93 authored by Lucio Maciel's avatar Lucio Maciel

Compilation fixes

parent 9876f654
...@@ -10,6 +10,7 @@ import chat.rocket.android.server.domain.* ...@@ -10,6 +10,7 @@ import chat.rocket.android.server.domain.*
import chat.rocket.android.server.domain.model.Account import chat.rocket.android.server.domain.model.Account
import chat.rocket.android.server.infraestructure.RocketChatClientFactory import chat.rocket.android.server.infraestructure.RocketChatClientFactory
import chat.rocket.android.util.extensions.launchUI import chat.rocket.android.util.extensions.launchUI
import chat.rocket.android.util.extensions.registerPushToken
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.RocketChatClient import chat.rocket.core.RocketChatClient
...@@ -27,6 +28,7 @@ class SignupPresenter @Inject constructor(private val view: SignupView, ...@@ -27,6 +28,7 @@ class SignupPresenter @Inject constructor(private val view: SignupView,
private val serverInteractor: GetCurrentServerInteractor, private val serverInteractor: GetCurrentServerInteractor,
private val factory: RocketChatClientFactory, private val factory: RocketChatClientFactory,
private val saveAccountInteractor: SaveAccountInteractor, private val saveAccountInteractor: SaveAccountInteractor,
private val getAccountsInteractor: GetAccountsInteractor,
settingsInteractor: GetSettingsInteractor) { settingsInteractor: GetSettingsInteractor) {
private val currentServer = serverInteractor.get()!! private val currentServer = serverInteractor.get()!!
private val client: RocketChatClient = factory.create(currentServer) private val client: RocketChatClient = factory.create(currentServer)
...@@ -98,9 +100,10 @@ class SignupPresenter @Inject constructor(private val view: SignupView, ...@@ -98,9 +100,10 @@ class SignupPresenter @Inject constructor(private val view: SignupView,
private suspend fun registerPushToken() { private suspend fun registerPushToken() {
localRepository.get(LocalRepository.KEY_PUSH_TOKEN)?.let { localRepository.get(LocalRepository.KEY_PUSH_TOKEN)?.let {
client.registerPushToken(it) client.registerPushToken(it, getAccountsInteractor.get(), factory)
} }
// TODO: Schedule push token registering when it comes up null // TODO: When the push token is null, at some point we should receive it with
// onTokenRefresh() on FirebaseTokenService, we need to confirm it.
} }
private suspend fun saveAccount(me: Myself) { private suspend fun saveAccount(me: Myself) {
......
...@@ -101,21 +101,52 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView, ...@@ -101,21 +101,52 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
private suspend fun usersToChatRooms(users: List<User>): List<ChatRoom> { private suspend fun usersToChatRooms(users: List<User>): List<ChatRoom> {
return users.map { return users.map {
ChatRoom(it.id, RoomType.DIRECT_MESSAGE, SimpleUser( ChatRoom(id = it.id,
username = it.username, name = it.name, id = null), it.name ?: "", type = RoomType.DIRECT_MESSAGE,
it.name, false, null, null, null, user = SimpleUser(username = it.username, name = it.name, id = null),
null, null, false, false, false, name = it.name ?: "",
0L, null, 0L, null, client fullName = it.name,
readonly = false,
updatedAt = null,
timestamp = null,
lastSeen = null,
topic = null,
description = null,
announcement = null,
default = false,
open = false,
alert = false,
unread = 0L,
userMenstions = null,
groupMentions = 0L,
lastMessage = null,
client = client
) )
} }
} }
private suspend fun roomsToChatRooms(rooms: List<Room>): List<ChatRoom> { private suspend fun roomsToChatRooms(rooms: List<Room>): List<ChatRoom> {
return rooms.map { return rooms.map {
ChatRoom(it.id, it.type, it.user, it.name ?: "", ChatRoom(id = it.id,
it.fullName, it.readonly, it.updatedAt, null, null, type = it.type,
it.topic, it.announcement, false, false, false, user = it.user,
0L, null, 0L, it.lastMessage, client name = it.name ?: "",
fullName = it.fullName,
readonly = it.readonly,
updatedAt = it.updatedAt,
timestamp = null,
lastSeen = null,
topic = it.topic,
description = it.description,
announcement = it.announcement,
default = false,
open = false,
alert = false,
unread = 0L,
userMenstions = null,
groupMentions = 0L,
lastMessage = it.lastMessage,
client = client
) )
} }
} }
...@@ -255,6 +286,7 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView, ...@@ -255,6 +286,7 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
timestamp, timestamp,
lastSeen, lastSeen,
room.topic, room.topic,
room.description,
room.announcement, room.announcement,
default, default,
open, open,
...@@ -286,6 +318,7 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView, ...@@ -286,6 +318,7 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
subscription.timestamp ?: timestamp, subscription.timestamp ?: timestamp,
subscription.lastSeen ?: lastSeen, subscription.lastSeen ?: lastSeen,
topic, topic,
description,
announcement, announcement,
subscription.isDefault, subscription.isDefault,
subscription.open, subscription.open,
......
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