chore: Follow up notification action

dependabot/pub/unifiedpush-6.1.0
Christian Kußowski 7 days ago
parent a88849c2db
commit 1bef2dcbbb
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652

@ -9,6 +9,7 @@ import 'package:matrix/matrix.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:fluffychat/l10n/l10n.dart';
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';
@ -157,16 +158,37 @@ Future<void> notificationTap(
final eventId = await room.sendTextEvent(input);
if (PlatformInfos.isAndroid) {
final ownProfile = await room.client.fetchOwnProfile();
final avatar = ownProfile.avatarUrl;
final avatarFile = avatar == null
? null
: await client
.downloadMxcCached(
avatar,
thumbnailMethod: ThumbnailMethod.crop,
width: notificationAvatarDimension,
height: notificationAvatarDimension,
animated: false,
isThumbnail: true,
rounded: true,
)
.timeout(const Duration(seconds: 3));
final messagingStyleInformation =
await AndroidFlutterLocalNotificationsPlugin()
.getActiveNotificationMessagingStyle(room.id.hashCode);
if (messagingStyleInformation == null) return;
l10n ??= await lookupL10n(const Locale('en'));
l10n ??= await lookupL10n(PlatformDispatcher.instance.locale);
messagingStyleInformation.messages?.add(
Message(
input,
DateTime.now(),
Person(key: room.client.userID, name: l10n.you),
Person(
key: room.client.userID,
name: l10n.you,
icon: avatarFile == null
? null
: ByteArrayAndroidIcon(avatarFile),
),
),
);

@ -38,7 +38,7 @@ Future<void> pushHelper(
} catch (e, s) {
Logs().e('Push Helper has crashed! Writing into temporary file', e, s);
l10n ??= await lookupL10n(const Locale('en'));
l10n ??= await lookupL10n(PlatformDispatcher.instance.locale);
flutterLocalNotificationsPlugin.show(
notification.roomId?.hashCode ?? 0,
l10n.newMessageInFluffyChat,

Loading…
Cancel
Save