Commit 4e5b2997 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Fix user status always being displayed as offline.

parent 7c524d97
......@@ -24,6 +24,7 @@ import chat.rocket.common.model.userStatusOf
import chat.rocket.common.util.ifNull
import chat.rocket.core.RocketChatClient
import chat.rocket.core.internal.realtime.setDefaultStatus
import chat.rocket.core.internal.rest.me
import chat.rocket.core.internal.rest.resetAvatar
import chat.rocket.core.internal.rest.setAvatar
import chat.rocket.core.internal.rest.updateProfile
......@@ -61,12 +62,16 @@ class ProfilePresenter @Inject constructor(
launchUI(strategy) {
view.showLoading()
try {
val me = retryIO(description = "serverInfo", times = 5) {
client.me()
}
view.showProfile(
user?.status.toString(),
serverUrl.avatarUrl(user?.username ?: ""),
user?.name ?: "",
user?.username ?: "",
user?.emails?.getOrNull(0)?.address ?: ""
me.status.toString(),
serverUrl.avatarUrl(me.username ?: ""),
me.name ?: "",
me.username ?: "",
me.emails?.getOrNull(0)?.address ?: ""
)
} catch (exception: RocketChatException) {
view.showMessage(exception)
......
......@@ -20,6 +20,7 @@ import chat.rocket.android.util.extensions.avatarUrl
import chat.rocket.android.util.retryIO
import chat.rocket.common.util.ifNull
import chat.rocket.core.internal.rest.deleteOwnAccount
import chat.rocket.core.internal.rest.me
import chat.rocket.core.internal.rest.serverInfo
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
......@@ -59,11 +60,16 @@ class SettingsPresenter @Inject constructor(
val serverInfo = retryIO(description = "serverInfo", times = 5) {
rocketChatClientFactory.get(currentServer).serverInfo()
}
val me = retryIO(description = "serverInfo", times = 5) {
rocketChatClientFactory.get(currentServer).me()
}
userHelper.user()?.let { user ->
view.setupSettingsView(
currentServer.avatarUrl(user.username ?: ""),
userHelper.displayName(user) ?: user.username ?: "",
user.status.toString(),
currentServer.avatarUrl(me.username ?: ""),
userHelper.displayName(user) ?: me.username ?: "",
me.status.toString(),
permissions.isAdministrationEnabled(),
analyticsTrackingInteractor.get(),
true,
......
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