fix: Notifications on web not working when avatar could not be pre downloaded

This commit is contained in:
Christian Kußowski 2025-10-28 07:25:55 +01:00
parent 1ae60dd2b9
commit 422e94ab45
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652

View file

@ -53,14 +53,18 @@ extension LocalNotificationsExtension on MatrixState {
const size = 128;
const thumbnailMethod = ThumbnailMethod.crop;
// Pre-cache so that we can later just set the thumbnail uri as icon:
await client.downloadMxcCached(
avatarUrl,
width: size,
height: size,
thumbnailMethod: thumbnailMethod,
isThumbnail: true,
rounded: true,
);
try {
await client.downloadMxcCached(
avatarUrl,
width: size,
height: size,
thumbnailMethod: thumbnailMethod,
isThumbnail: true,
rounded: true,
);
} catch (e, s) {
Logs().d('Unable to pre-download avatar for web notification', e, s);
}
thumbnailUri =
await event.senderFromMemoryOrFallback.avatarUrl?.getThumbnailUri(