chore: Follow up crop circle notification avatars

This commit is contained in:
krille-chan 2025-05-15 15:47:35 +02:00
commit e7034184d6
No known key found for this signature in database
3 changed files with 18 additions and 46 deletions

View file

@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/foundation.dart';
@ -15,7 +16,6 @@ import 'package:fluffychat/utils/client_download_content_extension.dart';
import 'package:fluffychat/utils/client_manager.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/shortcut_memory_icon.dart';
Future<void> pushHelper(
PushNotification notification, {
@ -164,11 +164,12 @@ Future<void> _tryPushHelper(
: await client
.downloadMxcCached(
avatar,
thumbnailMethod: ThumbnailMethod.scale,
thumbnailMethod: ThumbnailMethod.crop,
width: 256,
height: 256,
animated: false,
isThumbnail: true,
rounded: true,
)
.timeout(const Duration(seconds: 3));
} catch (e, s) {
@ -182,11 +183,12 @@ Future<void> _tryPushHelper(
: await client
.downloadMxcCached(
senderAvatar,
thumbnailMethod: ThumbnailMethod.scale,
thumbnailMethod: ThumbnailMethod.crop,
width: 256,
height: 256,
animated: false,
isThumbnail: true,
rounded: true,
)
.timeout(const Duration(seconds: 3));
} catch (e, s) {
@ -313,10 +315,7 @@ Future<void> _setShortcut(
action: AppConfig.inviteLinkPrefix + event.room.id,
shortLabel: title,
conversationShortcut: true,
icon: await avatarFile?.toShortcutMemoryIcon(
event.room.id,
event.room.client.database,
),
icon: avatarFile == null ? null : base64Encode(avatarFile),
shortcutIconAsset: avatarFile == null
? ShortcutIconAsset.androidAsset
: ShortcutIconAsset.memoryAsset,