Let notifications use avatar fallback.

Extract code which handles Matrix image to its own api / impl / test modules.
This commit is contained in:
Benoit Marty 2025-11-12 11:15:02 +01:00
parent 4fa950b25e
commit 185d4fadde
42 changed files with 410 additions and 194 deletions

View file

@ -17,7 +17,8 @@ dependencies {
implementation(libs.androidx.corektx)
implementation(libs.coroutines.core)
implementation(libs.coil.compose)
implementation(projects.libraries.designsystem)
implementation(projects.libraries.matrix.api)
implementation(projects.libraries.matrixui)
implementation(projects.libraries.matrixmedia.api)
implementation(projects.libraries.pushproviders.api)
}

View file

@ -11,17 +11,18 @@ package io.element.android.libraries.push.api.notifications
import android.graphics.Bitmap
import androidx.core.graphics.drawable.IconCompat
import coil3.ImageLoader
import io.element.android.libraries.designsystem.components.avatar.AvatarData
import io.element.android.libraries.matrix.ui.media.AVATAR_THUMBNAIL_SIZE_IN_PIXEL
interface NotificationBitmapLoader {
/**
* Get icon of a room.
* @param path mxc url
* @param avatarData the data related to the Avatar
* @param imageLoader Coil image loader
* @param targetSize The size we want the bitmap to be resized to
*/
suspend fun getRoomBitmap(
path: String?,
avatarData: AvatarData,
imageLoader: ImageLoader,
targetSize: Long = AVATAR_THUMBNAIL_SIZE_IN_PIXEL,
): Bitmap?
@ -29,8 +30,11 @@ interface NotificationBitmapLoader {
/**
* Get icon of a user.
* Before Android P, this does nothing because the icon won't be used
* @param path mxc url
* @param avatarData the data related to the Avatar
* @param imageLoader Coil image loader
*/
suspend fun getUserIcon(path: String?, imageLoader: ImageLoader): IconCompat?
suspend fun getUserIcon(
avatarData: AvatarData,
imageLoader: ImageLoader,
): IconCompat?
}