forked from Nexus/nexus
include avatars on notifs
This commit is contained in:
parent
2beb6dcb9b
commit
74207e405b
4 changed files with 23 additions and 3 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import "dart:io";
|
||||
|
||||
import "package:flutter_local_notifications/flutter_local_notifications.dart";
|
||||
// ignore: implementation_imports
|
||||
import "package:flutter_local_notifications_linux/src/model/hint.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
class NotificationsController
|
||||
|
|
@ -75,7 +77,16 @@ class NotificationsController
|
|||
),
|
||||
iOS: .new(),
|
||||
macOS: .new(),
|
||||
linux: .new(icon: icon == null ? null : FilePathLinuxIcon(icon.path)),
|
||||
linux: .new(
|
||||
customHints: icon == null
|
||||
? null
|
||||
: [
|
||||
.new(
|
||||
name: "image-path",
|
||||
value: LinuxHintStringValue(icon.path),
|
||||
),
|
||||
],
|
||||
),
|
||||
windows: .new(),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,11 +53,19 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
|||
RoomsController.provider.select((rooms) => rooms[event.roomId]),
|
||||
);
|
||||
|
||||
final avatar = room?.metadata?.avatar;
|
||||
final icon = avatar == null
|
||||
? null
|
||||
: await ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.downloadMedia(.new(mxc: avatar, isAvatar: true));
|
||||
|
||||
await ref
|
||||
.read(NotificationsController.provider.notifier)
|
||||
.send(
|
||||
id: event.eventId.hashCode & 0x7fffffff,
|
||||
title: room?.metadata?.name ?? "New Message",
|
||||
icon: icon,
|
||||
body: switch (event.content) {
|
||||
MessageContent(:final body) => body,
|
||||
// TODO: Handle more types
|
||||
|
|
|
|||
Loading…
Reference in a new issue