Commit d9980439 authored by Cool-fire's avatar Cool-fire

check for user details

parent a1cc6722
package chat.rocket.android.userdetails.presentation package chat.rocket.android.userdetails.presentation
import android.util.Log
import chat.rocket.android.chatroom.presentation.ChatRoomNavigator import chat.rocket.android.chatroom.presentation.ChatRoomNavigator
import chat.rocket.android.chatrooms.domain.FetchChatRoomsInteractor import chat.rocket.android.chatrooms.domain.FetchChatRoomsInteractor
import chat.rocket.android.core.lifecycle.CancelStrategy import chat.rocket.android.core.lifecycle.CancelStrategy
...@@ -60,7 +61,8 @@ class UserDetailsPresenter @Inject constructor( ...@@ -60,7 +61,8 @@ class UserDetailsPresenter @Inject constructor(
val utcOffset = val utcOffset =
userEntity.utcOffset // TODO Convert UTC and display like the mockup userEntity.utcOffset // TODO Convert UTC and display like the mockup
if (avatarUrl != null && username != null && name != null && utcOffset != null) { Log.d("profile",avatarUrl+" " + username+" " +name+" " + utcOffset)
if (avatarUrl != null || username != null || name != null || utcOffset != null) {
view.showUserDetailsAndActions( view.showUserDetailsAndActions(
avatarUrl = avatarUrl, avatarUrl = avatarUrl,
name = name, name = name,
......
...@@ -16,11 +16,11 @@ interface UserDetailsView : LoadingView, MessageView { ...@@ -16,11 +16,11 @@ interface UserDetailsView : LoadingView, MessageView {
* @param isVideoCallAllowed True if the video call is allowed, false otherwise. * @param isVideoCallAllowed True if the video call is allowed, false otherwise.
*/ */
fun showUserDetailsAndActions( fun showUserDetailsAndActions(
avatarUrl: String, avatarUrl: String?,
name: String, name: String?,
username: String, username: String?,
status: String, status: String?,
utcOffset: String, utcOffset: String?,
isVideoCallAllowed: Boolean isVideoCallAllowed: Boolean
) )
} }
...@@ -79,11 +79,11 @@ class UserDetailsFragment : Fragment(), UserDetailsView { ...@@ -79,11 +79,11 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
} }
override fun showUserDetailsAndActions( override fun showUserDetailsAndActions(
avatarUrl: String, avatarUrl: String?,
name: String, name: String?,
username: String, username: String?,
status: String, status: String?,
utcOffset: String, utcOffset: String?,
isVideoCallAllowed: Boolean isVideoCallAllowed: Boolean
) { ) {
val requestBuilder = Glide.with(this).load(avatarUrl) val requestBuilder = Glide.with(this).load(avatarUrl)
...@@ -97,19 +97,27 @@ class UserDetailsFragment : Fragment(), UserDetailsView { ...@@ -97,19 +97,27 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
requestBuilder.apply(RequestOptions.bitmapTransform(RoundedCorners(14))) requestBuilder.apply(RequestOptions.bitmapTransform(RoundedCorners(14)))
.into(image_avatar) .into(image_avatar)
text_name.text = name text_name.text = name ?: ""
text_username.text = username text_username.text = username ?: ""
text_description_status.text = status.substring(0, 1).toUpperCase() + status.substring(1)
text_description_timezone.text = utcOffset
// We should also setup the user details listeners. val userStatus = if(status != null) status.substring(0, 1).toUpperCase() + status.substring(1) else ""
text_message.setOnClickListener { presenter.createDirectMessage(username) } text_description_status.text = userStatus
if (isVideoCallAllowed) { if(utcOffset != "null") {
text_video_call.isVisible = true text_description_timezone.text = utcOffset
text_video_call.setOnClickListener { presenter.toVideoConference(username) }
} else { } else {
text_video_call.isVisible = false text_title_timezone.isVisible = false
}
// We should also setup the user details listeners.
if(username != null){
text_message.setOnClickListener { presenter.createDirectMessage(username) }
if (isVideoCallAllowed) {
text_video_call.isVisible = true
text_video_call.setOnClickListener { presenter.toVideoConference(username) }
} else {
text_video_call.isVisible = false
}
} }
} }
......
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