Unverified Commit 723d155d authored by Filipe Brito's avatar Filipe Brito Committed by GitHub

Merge pull request #2273 from Cool-fire/issue-profile-render

[FIX] Fixes unable to see other User profile details
parents 1fd253cc 0c89d0b6
......@@ -47,31 +47,21 @@ class UserDetailsPresenter @Inject constructor(
view.showLoading()
dbManager.getUser(userId)?.let {
userEntity = it
val avatarUrl =
userEntity.username?.let { username ->
currentServer.avatarUrl(
username,
token?.userId,
token?.authToken
)
}
val avatarUrl = userEntity.username?.let { username ->
currentServer.avatarUrl(username, token?.userId, token?.authToken)
}
val username = userEntity.username
val name = userEntity.name
val utcOffset =
userEntity.utcOffset // TODO Convert UTC and display like the mockup
val utcOffset = userEntity.utcOffset // FIXME Convert UTC
if (avatarUrl != null && username != null && name != null && utcOffset != null) {
view.showUserDetailsAndActions(
avatarUrl = avatarUrl,
name = name,
username = username,
status = userEntity.status,
utcOffset = utcOffset.toString(),
isVideoCallAllowed = settings.isJitsiEnabled()
)
} else {
throw Exception()
}
view.showUserDetailsAndActions(
avatarUrl = avatarUrl,
name = name,
username = username,
status = userEntity.status,
utcOffset = utcOffset.toString(),
isVideoCallAllowed = settings.isJitsiEnabled()
)
}
} catch (ex: Exception) {
Timber.e(ex)
......
......@@ -16,11 +16,11 @@ interface UserDetailsView : LoadingView, MessageView {
* @param isVideoCallAllowed True if the video call is allowed, false otherwise.
*/
fun showUserDetailsAndActions(
avatarUrl: String,
name: String,
username: String,
status: String,
utcOffset: String,
avatarUrl: String?,
name: String?,
username: String?,
status: String?,
utcOffset: String?,
isVideoCallAllowed: Boolean
)
}
......@@ -79,14 +79,15 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
}
override fun showUserDetailsAndActions(
avatarUrl: String,
name: String,
username: String,
status: String,
utcOffset: String,
avatarUrl: String?,
name: String?,
username: String?,
status: String?,
utcOffset: String?,
isVideoCallAllowed: Boolean
) {
val requestBuilder = Glide.with(this).load(avatarUrl)
val requestBuilder = Glide.with(this)
.load(avatarUrl)
.apply(RequestOptions.skipMemoryCacheOf(true))
.apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE))
......@@ -97,19 +98,21 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
requestBuilder.apply(RequestOptions.bitmapTransform(RoundedCorners(14)))
.into(image_avatar)
text_name.text = name
text_username.text = username
text_description_status.text = status.substring(0, 1).toUpperCase() + status.substring(1)
text_description_timezone.text = utcOffset
text_name.text = name ?: getString(R.string.msg_unknown)
text_username.text = username ?: getString(R.string.msg_unknown)
// We should also setup the user details listeners.
text_message.setOnClickListener { presenter.createDirectMessage(username) }
text_description_status.text = status?.capitalize() ?: getString(R.string.msg_unknown)
text_description_timezone.text = utcOffset ?: getString(R.string.msg_unknown)
text_video_call.isVisible = isVideoCallAllowed
if (isVideoCallAllowed) {
text_video_call.isVisible = true
text_video_call.setOnClickListener { presenter.toVideoConference(username) }
} else {
text_video_call.isVisible = false
// We should also setup the user details listeners.
username?.run {
text_message.setOnClickListener { presenter.createDirectMessage(this) }
if (isVideoCallAllowed) {
text_video_call.setOnClickListener { presenter.toVideoConference(this) }
}
}
}
......
......@@ -143,6 +143,6 @@
android:id="@+id/group_user_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="image_blur, image_avatar, text_name, text_username, text_message, text_title_status, text_description_status, text_title_timezone, text_description_timezone" />
app:constraint_referenced_ids="image_blur, image_avatar, text_name, text_username, text_message, text_title_status, text_description_status, text_title_timezone, text_description_timezone, text_video_call" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
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