use cache for user avatars again (ignore flickering)

in the future, avatarVersion might be available for user avatars as well..

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-04-30 16:53:45 +02:00
parent d560a4a2a9
commit 898728cef9
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 8 additions and 6 deletions

View File

@ -68,8 +68,6 @@ class ConversationItem(
IFilterable<String?> { IFilterable<String?> {
private var header: GenericTextHeaderItem? = null private var header: GenericTextHeaderItem? = null
private var isInitialLoad = true
constructor( constructor(
conversation: Conversation, conversation: Conversation,
user: User, user: User,
@ -172,7 +170,12 @@ class ConversationItem(
when (model.type) { when (model.type) {
ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL -> { ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL -> {
if (!TextUtils.isEmpty(model.name)) { if (!TextUtils.isEmpty(model.name)) {
holder.binding.dialogAvatar.loadUserAvatar(user, model.name!!, true, isInitialLoad) holder.binding.dialogAvatar.loadUserAvatar(
user,
model.name!!,
true,
false
)
} else { } else {
holder.binding.dialogAvatar.visibility = View.GONE holder.binding.dialogAvatar.visibility = View.GONE
} }
@ -186,7 +189,6 @@ class ConversationItem(
else -> holder.binding.dialogAvatar.visibility = View.GONE else -> holder.binding.dialogAvatar.visibility = View.GONE
} }
} }
isInitialLoad = false
} }
private fun shouldLoadAvatar( private fun shouldLoadAvatar(

View File

@ -84,7 +84,7 @@ fun ImageView.loadUserAvatar(
user: User, user: User,
avatarId: String, avatarId: String,
requestBigSize: Boolean = true, requestBigSize: Boolean = true,
replace: Boolean ignoreCache: Boolean
): io.reactivex.disposables ): io.reactivex.disposables
.Disposable { .Disposable {
val imageRequestUri = ApiUtils.getUrlForAvatar( val imageRequestUri = ApiUtils.getUrlForAvatar(
@ -93,7 +93,7 @@ fun ImageView.loadUserAvatar(
requestBigSize requestBigSize
) )
return loadAvatarInternal(user, imageRequestUri, replace, null) return loadAvatarInternal(user, imageRequestUri, ignoreCache, null)
} }
@OptIn(ExperimentalCoilApi::class) @OptIn(ExperimentalCoilApi::class)