fix encrypted uploads

This commit is contained in:
Henry Hiles 2026-07-21 21:34:49 -04:00
commit 2a91959333
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
3 changed files with 8 additions and 7 deletions

View file

@ -26,8 +26,7 @@ class AttachmentController extends Notifier<(String, MessageContent?)?> {
.uploadMedia(
.new(
path: file.path,
encrypted:
room?.state[EventType.encryption.name]?.isNotEmpty == true,
encrypt: room?.state[EventType.encryption.type]?.isNotEmpty == true,
),
);

View file

@ -7,6 +7,8 @@ import "package:nexus/models/info/video.dart";
part "message.freezed.dart";
part "message.g.dart";
typedef EncryptedFile = Map<String, dynamic>;
@Freezed(unionKey: "msgtype", fallbackUnion: "default")
abstract class MessageContent extends Content with _$MessageContent {
MessageContent._();
@ -38,7 +40,7 @@ abstract class MessageContent extends Content with _$MessageContent {
required String body,
MessageFormat? format,
String? formattedBody,
// EncryptedFile? file
EncryptedFile? file,
String? filename,
ImageInfo? info,
Uri? url,
@ -49,7 +51,7 @@ abstract class MessageContent extends Content with _$MessageContent {
required String body,
MessageFormat? format,
String? formattedBody,
// EncryptedFile? file
EncryptedFile? file,
String? filename,
FileInfo? info,
Uri? url,
@ -60,7 +62,7 @@ abstract class MessageContent extends Content with _$MessageContent {
required String body,
MessageFormat? format,
String? formattedBody,
// EncryptedFile? file
EncryptedFile? file,
String? filename,
AudioInfo? info,
Uri? url,
@ -71,7 +73,7 @@ abstract class MessageContent extends Content with _$MessageContent {
required String body,
MessageFormat? format,
String? formattedBody,
// EncryptedFile? file
EncryptedFile? file,
String? filename,
VideoInfo? info,
Uri? url,

View file

@ -6,7 +6,7 @@ part "upload_media.g.dart";
abstract class UploadMediaRequest with _$UploadMediaRequest {
const factory UploadMediaRequest({
required String path,
required bool encrypted,
required bool encrypt,
String? filename,
@Default(false) @JsonKey(name: "voice_message") bool isVoiceMessage,
@Default(false) bool forceFile,