hide invite avatars when such flag is on

This affects:
- Invited room preview inviter avatar
- Invited room preview room avatar
- Invited room cell inviter avatar in the room list
- Invited room cell room avatar in the room list
- Push notification for an invite
This commit is contained in:
Mauro Romito
2025-03-19 16:04:08 +01:00
committed by Mauro
parent a201f5a654
commit ff721f6577
13 changed files with 54 additions and 28 deletions
@@ -101,32 +101,24 @@ extension UNMutableNotificationContent {
func addSenderIcon(using mediaProvider: MediaProviderProtocol?,
senderID: String,
senderName: String,
icon: NotificationIcon) async throws -> UNMutableNotificationContent {
// We display the placeholder only if...
var needsPlaceholder = false
icon: NotificationIcon,
forcePlaceholder: Bool = false) async throws -> UNMutableNotificationContent {
var fetchedImage: INImage?
let image: INImage
if let mediaSource = icon.mediaSource {
if !forcePlaceholder, let mediaSource = icon.mediaSource {
switch await mediaProvider?.loadThumbnailForSource(source: mediaSource, size: .init(width: 100, height: 100)) {
case .success(let data):
fetchedImage = INImage(imageData: data)
case .failure(let error):
MXLog.error("Couldn't add sender icon: \(error)")
// ...The provider failed to fetch
needsPlaceholder = true
case .none:
break
}
} else {
// ...There is no media
needsPlaceholder = true
}
if let fetchedImage {
image = fetchedImage
} else if needsPlaceholder,
let data = await getPlaceholderAvatarImageData(name: icon.groupInfo?.name ?? senderName,
} else if let data = await getPlaceholderAvatarImageData(name: icon.groupInfo?.name ?? senderName,
id: icon.groupInfo?.id ?? senderID) {
image = INImage(imageData: data)
} else {