improve matcher for encrypted media

This commit is contained in:
Henry Hiles 2026-07-29 12:06:19 -04:00
commit f0f426a647
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -17,18 +17,16 @@ class AttachmentController extends Notifier<(String, MessageContent?)?> {
final filename = basename(file.path);
state = (filename, null);
final room = ref.read(
RoomsController.provider.select((value) => value[roomId]),
final isEncrypted = ref.read(
RoomsController.provider.select(
(value) =>
value[roomId]?.state[EventType.encryption.type]?.isNotEmpty == true,
),
);
final content = await ref
.watch(ClientController.provider.notifier)
.uploadMedia(
.new(
path: file.path,
encrypt: room?.state[EventType.encryption.type]?.isNotEmpty == true,
),
);
.uploadMedia(.new(path: file.path, encrypt: isEncrypted));
state = (filename, content);
}