Commit 37c2f375 authored by Lucio Maciel's avatar Lucio Maciel

Fix missing email crash on ProfileFragment

parent 7b7997d5
......@@ -30,11 +30,12 @@ class ProfilePresenter @Inject constructor(private val view: ProfileView,
val myself = retryIO("me") { client.me() }
myselfId = myself.id!!
val avatarUrl = serverUrl.avatarUrl(myself.username!!)
val email = myself.emails?.getOrNull(0)?.address
view.showProfile(
avatarUrl,
myself.name ?: "",
myself.username ?: "",
myself.emails?.get(0)?.address!!
email
)
} catch (exception: RocketChatException) {
view.showMessage(exception)
......
......@@ -2,7 +2,6 @@ package chat.rocket.android.profile.presentation
import chat.rocket.android.core.behaviours.LoadingView
import chat.rocket.android.core.behaviours.MessageView
import chat.rocket.core.model.Myself
interface ProfileView : LoadingView, MessageView {
......@@ -14,7 +13,7 @@ interface ProfileView : LoadingView, MessageView {
* @param username The user username.
* @param email The user email.
*/
fun showProfile(avatarUrl: String, name: String, username: String, email: String)
fun showProfile(avatarUrl: String, name: String, username: String, email: String?)
/**
* Shows a profile update successfully message
......
......@@ -55,18 +55,18 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
super.onDestroyView()
}
override fun showProfile(avatarUrl: String, name: String, username: String, email: String) {
override fun showProfile(avatarUrl: String, name: String, username: String, email: String?) {
ui {
image_avatar.setImageURI(avatarUrl)
text_name.textContent = name
text_username.textContent = username
text_email.textContent = email
text_email.textContent = email ?: ""
text_avatar_url.textContent = ""
currentName = name
currentUsername = username
currentEmail = email
currentEmail = email ?: ""
currentAvatar = avatarUrl
profile_container.setVisible(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