fix to use correct cloudId.

Without this fix, the avatars for "normal" messages were not able to show avatars.
Only the messages that contained messageParameters with actor were able to show avatars(for example "userX invited userY")

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-03-21 14:20:17 +01:00 committed by Andy Scherzinger
parent 870ef03d61
commit c0c671bccf
7 changed files with 7 additions and 10 deletions

View File

@ -173,7 +173,7 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) :
binding.messageUserAvatar.loadChangelogBotAvatar()
} else if (message.actorType == "bots") {
binding.messageUserAvatar.loadBotsAvatar()
} else if (message.actorType == "federated_users" && message.messageParameters?.get("actor") != null) {
} else if (message.actorType == "federated_users") {
binding.messageUserAvatar.loadFederatedUserAvatar(message)
}
}

View File

@ -149,7 +149,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
binding.messageUserAvatar.loadChangelogBotAvatar()
} else if (message.actorType == "bots") {
binding.messageUserAvatar.loadBotsAvatar()
} else if (message.actorType == "federated_users" && message.messageParameters?.get("actor") != null) {
} else if (message.actorType == "federated_users") {
binding.messageUserAvatar.loadFederatedUserAvatar(message)
}
} else {

View File

@ -180,7 +180,7 @@ class IncomingPollMessageViewHolder(incomingView: View, payload: Any) :
binding.messageUserAvatar.loadChangelogBotAvatar()
} else if (message.actorType == "bots") {
binding.messageUserAvatar.loadBotsAvatar()
} else if (message.actorType == "federated_users" && message.messageParameters?.get("actor") != null) {
} else if (message.actorType == "federated_users") {
binding.messageUserAvatar.loadFederatedUserAvatar(message)
}
}

View File

@ -183,7 +183,7 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
binding.messageUserAvatar.loadChangelogBotAvatar()
} else if (message.actorType == "bots") {
binding.messageUserAvatar.loadBotsAvatar()
} else if (message.actorType == "federated_users" && message.messageParameters?.get("actor") != null) {
} else if (message.actorType == "federated_users") {
binding.messageUserAvatar.loadFederatedUserAvatar(message)
}
}

View File

@ -286,7 +286,7 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) :
)
binding.messageUserAvatar.visibility = View.VISIBLE
binding.messageUserAvatar.setImageDrawable(drawable)
} else if (message.actorType == "federated_users" && message.messageParameters?.get("actor") != null) {
} else if (message.actorType == "federated_users") {
binding.messageUserAvatar.loadFederatedUserAvatar(message)
}
}

View File

@ -195,7 +195,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
}
if (ACTOR_TYPE_BOTS == message.actorType && ACTOR_ID_CHANGELOG == message.actorId) {
userAvatar.loadChangelogBotAvatar()
} else if (message.actorType == "federated_users" && message.messageParameters?.get("actor") != null) {
} else if (message.actorType == "federated_users") {
userAvatar.loadFederatedUserAvatar(message)
}
}

View File

@ -128,10 +128,7 @@ fun ImageView.loadUserAvatar(
}
fun ImageView.loadFederatedUserAvatar(message: ChatMessage): io.reactivex.disposables.Disposable {
val map = message.messageParameters?.get("actor")
val url = map?.get("server")!!
val id = map["id"]
val cloudId = "$id@$url"
val cloudId = message.actorId!!
val darkTheme = if (DisplayUtils.isDarkModeOn(context)) 1 else 0
val ignoreCache = false
val requestBigSize = true