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); final filename = basename(file.path);
state = (filename, null); state = (filename, null);
final room = ref.read( final isEncrypted = ref.read(
RoomsController.provider.select((value) => value[roomId]), RoomsController.provider.select(
(value) =>
value[roomId]?.state[EventType.encryption.type]?.isNotEmpty == true,
),
); );
final content = await ref final content = await ref
.watch(ClientController.provider.notifier) .watch(ClientController.provider.notifier)
.uploadMedia( .uploadMedia(.new(path: file.path, encrypt: isEncrypted));
.new(
path: file.path,
encrypt: room?.state[EventType.encryption.type]?.isNotEmpty == true,
),
);
state = (filename, content); state = (filename, content);
} }