Compare commits
No commits in common. "9caff33154c65e3f5ad34daec8e9aa88d7e22751" and "c520516d518a5090b1f4225d3006bec4efa83ad4" have entirely different histories.
9caff33154
...
c520516d51
6 changed files with 1 additions and 66 deletions
|
|
@ -123,7 +123,6 @@ class MessageController extends AsyncNotifier<Message?> {
|
|||
text: "Unable to decrypt message.",
|
||||
metadata: {...metadata, "body": "Unable to decrypt message."},
|
||||
),
|
||||
|
||||
// "org.matrix.msc3381.poll.start" => Message.custom(
|
||||
// metadata: {
|
||||
// ...metadata,
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
import "package:nexus/models/content/encrypted.dart";
|
||||
import "package:nexus/models/content/membership.dart";
|
||||
import "package:nexus/models/content/message.dart";
|
||||
|
||||
class Content {
|
||||
Content();
|
||||
factory Content.fromJson(Map<String, dynamic> json) => Content();
|
||||
|
||||
Map<String, dynamic> toJson() => {};
|
||||
static Content fromEventJson(Map<String, dynamic> eventJson) =>
|
||||
switch (eventJson["type"]) {
|
||||
EncryptedContent.type => EncryptedContent.fromJson,
|
||||
MembershipContent.type => MembershipContent.fromJson,
|
||||
MessageContent.type => MessageContent.fromJson,
|
||||
_ => Content.fromJson,
|
||||
}(eventJson);
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import "package:nexus/models/content/content.dart";
|
||||
|
||||
class EncryptedContent extends Content {
|
||||
EncryptedContent();
|
||||
factory EncryptedContent.fromJson(Map<String, dynamic> json) =>
|
||||
EncryptedContent();
|
||||
|
||||
static const type = "m.room.encrypted";
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/content/content.dart";
|
||||
import "package:nexus/models/membership_status.dart";
|
||||
part "membership.freezed.dart";
|
||||
part "membership.g.dart";
|
||||
|
||||
@freezed
|
||||
abstract class MembershipContent extends Content with _$MembershipContent {
|
||||
static const type = "m.room.membership";
|
||||
|
||||
MembershipContent._();
|
||||
const factory MembershipContent({
|
||||
@JsonKey(name: "displayname") required String displayName,
|
||||
required MembershipStatus membership,
|
||||
required String? avatarUrl,
|
||||
required String? reason,
|
||||
}) = _MembershipContent;
|
||||
|
||||
factory MembershipContent.fromJson(Map<String, Object?> json) =>
|
||||
_$MembershipContentFromJson(json);
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/content/content.dart";
|
||||
import "package:nexus/models/membership_status.dart";
|
||||
part "message.freezed.dart";
|
||||
part "message.g.dart";
|
||||
|
||||
@freezed
|
||||
abstract class MessageContent extends Content with _$MessageContent {
|
||||
static const type = "m.room.message";
|
||||
|
||||
MessageContent._();
|
||||
const factory MessageContent({required String msgtype}) = _MessageContent;
|
||||
|
||||
factory MessageContent.fromJson(Map<String, Object?> json) =>
|
||||
_$MessageContentFromJson(json);
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/content/content.dart";
|
||||
import "package:nexus/models/epoch_date_time_converter.dart";
|
||||
part "event.freezed.dart";
|
||||
part "event.g.dart";
|
||||
|
|
@ -16,6 +15,7 @@ abstract class Event with _$Event {
|
|||
required String type,
|
||||
String? stateKey,
|
||||
@EpochDateTimeConverter() required DateTime timestamp,
|
||||
required IMap<String, dynamic> content,
|
||||
IMap<String, dynamic>? decrypted,
|
||||
String? decryptedType,
|
||||
@Default(IMap.empty()) IMap<String, dynamic> unsigned,
|
||||
|
|
@ -29,7 +29,6 @@ abstract class Event with _$Event {
|
|||
@Default(IMap.empty()) IMap<String, int> reactions,
|
||||
@JsonKey(name: "last_edit_rowid") int? lastEditRowId,
|
||||
@UnreadTypeConverter() UnreadType? unreadType,
|
||||
@JsonKey(fromJson: Content.fromJson) required Content content,
|
||||
}) = _Event;
|
||||
|
||||
factory Event.fromJson(Map<String, Object?> json) => _$EventFromJson(json);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue