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

Show server name (when not null) on server bottom sheet view instead of its url

parent 7e98a305
......@@ -15,6 +15,7 @@ import chat.rocket.android.server.domain.favicon
import chat.rocket.android.server.domain.isLdapAuthenticationEnabled
import chat.rocket.android.server.domain.isPasswordResetEnabled
import chat.rocket.android.server.domain.model.Account
import chat.rocket.android.server.domain.siteName
import chat.rocket.android.server.domain.wideTile
import chat.rocket.android.server.infrastructure.RocketChatClientFactory
import chat.rocket.android.util.extension.launchUI
......@@ -142,7 +143,14 @@ class LoginPresenter @Inject constructor(
currentServer.serverLogoUrl(it)
}
val thumb = currentServer.avatarUrl(username, token?.userId, token?.authToken)
val account = Account(currentServer, icon, logo, username, thumb)
val account = Account(
settings.siteName() ?: currentServer,
currentServer,
icon,
logo,
username,
thumb
)
saveAccountInteractor.save(account)
}
......
......@@ -14,6 +14,7 @@ import chat.rocket.android.server.domain.SaveCurrentServerInteractor
import chat.rocket.android.server.domain.TokenRepository
import chat.rocket.android.server.domain.favicon
import chat.rocket.android.server.domain.model.Account
import chat.rocket.android.server.domain.siteName
import chat.rocket.android.server.domain.wideTile
import chat.rocket.android.server.infrastructure.RocketChatClientFactory
import chat.rocket.android.util.extension.launchUI
......@@ -182,7 +183,14 @@ class LoginOptionsPresenter @Inject constructor(
currentServer.serverLogoUrl(it)
}
val thumb = currentServer.avatarUrl(username, token?.userId, token?.authToken)
val account = Account(currentServer, icon, logo, username, thumb)
val account = Account(
settings.siteName() ?: currentServer,
currentServer,
icon,
logo,
username,
thumb
)
saveAccountInteractor.save(account)
}
......
......@@ -12,6 +12,7 @@ import chat.rocket.android.server.domain.SaveCurrentServerInteractor
import chat.rocket.android.server.domain.TokenRepository
import chat.rocket.android.server.domain.favicon
import chat.rocket.android.server.domain.model.Account
import chat.rocket.android.server.domain.siteName
import chat.rocket.android.server.domain.wideTile
import chat.rocket.android.server.infrastructure.RocketChatClientFactory
import chat.rocket.android.util.extension.launchUI
......@@ -81,7 +82,14 @@ class RegisterUsernamePresenter @Inject constructor(
currentServer.serverLogoUrl(it)
}
val thumb = currentServer.avatarUrl(username, token?.userId, token?.authToken)
val account = Account(currentServer, icon, logo, username, thumb)
val account = Account(
settings.siteName() ?: currentServer,
currentServer,
icon,
logo,
username,
thumb
)
saveAccountInteractor.save(account)
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import chat.rocket.android.server.domain.SaveCurrentServerInteractor
import chat.rocket.android.server.domain.TokenRepository
import chat.rocket.android.server.domain.favicon
import chat.rocket.android.server.domain.model.Account
import chat.rocket.android.server.domain.siteName
import chat.rocket.android.server.domain.wideTile
import chat.rocket.android.server.infrastructure.RocketChatClientFactory
import chat.rocket.android.util.extension.launchUI
......@@ -102,7 +103,14 @@ class SignupPresenter @Inject constructor(
currentServer.serverLogoUrl(it)
}
val thumb = currentServer.avatarUrl(me.username!!, token?.userId, token?.authToken)
val account = Account(currentServer, icon, logo, me.username!!, thumb)
val account = Account(
settings.siteName() ?: currentServer,
currentServer,
icon,
logo,
me.username!!,
thumb
)
saveAccountInteractor.save(account)
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import chat.rocket.android.server.domain.SaveCurrentServerInteractor
import chat.rocket.android.server.domain.TokenRepository
import chat.rocket.android.server.domain.favicon
import chat.rocket.android.server.domain.model.Account
import chat.rocket.android.server.domain.siteName
import chat.rocket.android.server.domain.wideTile
import chat.rocket.android.server.infrastructure.RocketChatClientFactory
import chat.rocket.android.util.extension.launchUI
......@@ -103,7 +104,14 @@ class TwoFAPresenter @Inject constructor(
currentServer.serverLogoUrl(it)
}
val thumb = currentServer.avatarUrl(me.username!!, token?.userId, token?.authToken)
val account = Account(currentServer, icon, logo, me.username!!, thumb)
val account = Account(
settings.siteName() ?: currentServer,
currentServer,
icon,
logo,
me.username!!,
thumb
)
saveAccountInteractor.save(account)
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import se.ansman.kotshi.JsonSerializable
@JsonSerializable
data class Account(
val serverName: String?,
val serverUrl: String,
val serverLogo: String?,
val serverBg: String?,
......
......@@ -13,7 +13,7 @@ class ServerViewHolder(itemView: View, private val currentServerUrl: String) :
fun bind(account: Account) {
with(itemView) {
Glide.with(context).load(account.serverLogo).into(image_server)
text_server_name.text = account.serverUrl
text_server_name.text = account.serverName ?: account.serverUrl
text_server_url.text = account.serverUrl
image_check.isInvisible = currentServerUrl != account.serverUrl
}
......
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