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
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 size = 128;
const thumbnailMethod = ThumbnailMethod.crop; const thumbnailMethod = ThumbnailMethod.crop;
// Pre-cache so that we can later just set the thumbnail uri as icon: // Pre-cache so that we can later just set the thumbnail uri as icon:
await client.downloadMxcCached( try {
avatarUrl, await client.downloadMxcCached(
width: size, avatarUrl,
height: size, width: size,
thumbnailMethod: thumbnailMethod, height: size,
isThumbnail: true, thumbnailMethod: thumbnailMethod,
rounded: true, isThumbnail: true,
); rounded: true,
);
} catch (e, s) {
Logs().d('Unable to pre-download avatar for web notification', e, s);
}
thumbnailUri = thumbnailUri =
await event.senderFromMemoryOrFallback.avatarUrl?.getThumbnailUri( await event.senderFromMemoryOrFallback.avatarUrl?.getThumbnailUri(