forked from Henry-Hiles/nexus
working sync complete
This commit is contained in:
parent
4862bf47c7
commit
97f2673b55
11 changed files with 61 additions and 100 deletions
|
|
@ -1,14 +0,0 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
part "content_uri.freezed.dart";
|
||||
part "content_uri.g.dart";
|
||||
|
||||
@freezed
|
||||
abstract class ContentUri with _$ContentUri {
|
||||
const factory ContentUri({
|
||||
required String homeserver,
|
||||
required String fileID,
|
||||
}) = _ContentUri;
|
||||
|
||||
factory ContentUri.fromJson(Map<String, Object?> json) =>
|
||||
_$ContentUriFromJson(json);
|
||||
}
|
||||
|
|
@ -9,24 +9,24 @@ abstract class Event with _$Event {
|
|||
@JsonKey(name: "rowid") required int rowId,
|
||||
@JsonKey(name: "timeline_rowid") required int timelineRowId,
|
||||
required String roomId,
|
||||
required int eventId,
|
||||
@JsonKey(name: "sender") required int authorId,
|
||||
required String eventId,
|
||||
@JsonKey(name: "sender") required String authorId,
|
||||
required String type,
|
||||
required String stateKey,
|
||||
String? stateKey,
|
||||
@EpochDateTimeConverter() required DateTime timestamp,
|
||||
required Map<String, dynamic> content,
|
||||
required Map<String, dynamic> decrypted,
|
||||
required Map<String, dynamic> decryptedType,
|
||||
required Map<String, dynamic> unsigned,
|
||||
required LocalContent localContent,
|
||||
required String transactionId,
|
||||
required String redactedBy,
|
||||
required String relatesTo,
|
||||
required String relatesType,
|
||||
required String decryptionError,
|
||||
required String sendError,
|
||||
required Map<String, int> reactions,
|
||||
required int lastEditRowId,
|
||||
Map<String, dynamic>? decrypted,
|
||||
String? decryptedType,
|
||||
@Default({}) Map<String, dynamic> unsigned,
|
||||
LocalContent? localContent,
|
||||
String? transactionId,
|
||||
String? redactedBy,
|
||||
String? relatesTo,
|
||||
String? relatesType,
|
||||
String? decryptionError,
|
||||
String? sendError,
|
||||
@Default({}) Map<String, int> reactions,
|
||||
int? lastEditRowId,
|
||||
@UnreadTypeConverter() UnreadType? unreadType,
|
||||
}) = _Event;
|
||||
|
||||
|
|
@ -36,13 +36,11 @@ abstract class Event with _$Event {
|
|||
@freezed
|
||||
abstract class LocalContent with _$LocalContent {
|
||||
const factory LocalContent({
|
||||
required String sanitizedHtml,
|
||||
required String htmlVersion,
|
||||
required bool wasPlaintext,
|
||||
required bool bigEmoji,
|
||||
required bool hasMath,
|
||||
required String editSource,
|
||||
required String replyFallbackRemoved,
|
||||
String? sanitizedHtml,
|
||||
bool? wasPlaintext,
|
||||
bool? bigEmoji,
|
||||
bool? hasMath,
|
||||
bool? replyFallbackRemoved,
|
||||
}) = _LocalContent;
|
||||
|
||||
factory LocalContent.fromJson(Map<String, Object?> json) =>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ part "lazy_load_summary.g.dart";
|
|||
@freezed
|
||||
abstract class LazyLoadSummary with _$LazyLoadSummary {
|
||||
const factory LazyLoadSummary({
|
||||
required List<String> heroes,
|
||||
required List<String>? heroes,
|
||||
required int? joinedMemberCount,
|
||||
required int? invitedMemberCount,
|
||||
}) = _LazyLoadSummary;
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ part "room.g.dart";
|
|||
abstract class Room with _$Room {
|
||||
const factory Room({
|
||||
@JsonKey(name: "meta") RoomMetadata? metadata,
|
||||
required List<TimelineRowTuple> timeline,
|
||||
@Default([]) List<TimelineRowTuple> timeline,
|
||||
required bool reset,
|
||||
required Map<String, Map> state,
|
||||
// required Map<String, AccountData> accountData,
|
||||
required List<Event> events,
|
||||
required Map<String, List<ReadReceipt>> receipts,
|
||||
@Default({}) Map<String, List<ReadReceipt>> receipts,
|
||||
required bool dismissNotifications,
|
||||
// required List<Notification> notifications,
|
||||
}) = _Room;
|
||||
|
|
@ -26,7 +26,7 @@ abstract class Room with _$Room {
|
|||
abstract class TimelineRowTuple with _$TimelineRowTuple {
|
||||
const factory TimelineRowTuple({
|
||||
@JsonKey(name: "timeline_rowid") required int timelineRowId,
|
||||
@JsonKey(name: "timeline_eventid") required int eventRowId,
|
||||
@JsonKey(name: "timeline_eventid") int? eventRowId,
|
||||
}) = _TimelineRowTuple;
|
||||
|
||||
factory TimelineRowTuple.fromJson(Map<String, Object?> json) =>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/content_uri.dart";
|
||||
import "package:nexus/models/epoch_date_time_converter.dart";
|
||||
import "package:nexus/models/lazy_load_summary.dart";
|
||||
part "room_metadata.freezed.dart";
|
||||
|
|
@ -12,12 +11,12 @@ abstract class RoomMetadata with _$RoomMetadata {
|
|||
// required CreateEventContent creationContent,
|
||||
// required TombstoneEventContent tombstoneEventContent,
|
||||
String? name,
|
||||
ContentUri? avatar,
|
||||
Uri? avatar,
|
||||
String? topic,
|
||||
String? canonicalAlias,
|
||||
LazyLoadSummary? lazyLoadSummary,
|
||||
required bool hasMemberList,
|
||||
@JsonKey(name: "preview_event_rowid") required String previewEventRowID,
|
||||
@JsonKey(name: "preview_event_rowid") required int previewEventRowID,
|
||||
@EpochDateTimeConverter() required DateTime sortingTimestamp,
|
||||
@Default(false) bool markedUnread,
|
||||
}) = _RoomMetadata;
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/room.dart";
|
||||
part "sync_complete.freezed.dart";
|
||||
part "sync_complete.g.dart";
|
||||
|
||||
@freezed
|
||||
abstract class SyncComplete with _$SyncComplete {
|
||||
const factory SyncComplete({
|
||||
@Default(false) bool clearState,
|
||||
// required Map<String, AccountData> accountData,
|
||||
required Map<String, Room> rooms,
|
||||
required List<String> leftRooms,
|
||||
// required List<InvitedRoom> invitedRooms,
|
||||
// required List<SpaceEdge> spaceEdges,
|
||||
required List<String> topLevelSpaces,
|
||||
}) = _SyncComplete;
|
||||
|
||||
factory SyncComplete.fromJson(Map<String, Object?> json) =>
|
||||
_$SyncCompleteFromJson(json);
|
||||
}
|
||||
20
lib/models/sync_data.dart
Normal file
20
lib/models/sync_data.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/room.dart";
|
||||
part "sync_data.freezed.dart";
|
||||
part "sync_data.g.dart";
|
||||
|
||||
@freezed
|
||||
abstract class SyncData with _$SyncData {
|
||||
const factory SyncData({
|
||||
@Default(false) bool clearState,
|
||||
// required Map<String, AccountData> accountData,
|
||||
@Default({}) Map<String, Room> rooms,
|
||||
@Default([]) List<String> leftRooms,
|
||||
// required List<InvitedRoom> invitedRooms,
|
||||
// required List<SpaceEdge> spaceEdges,
|
||||
@Default([]) List<String> topLevelSpaces,
|
||||
}) = _SyncData;
|
||||
|
||||
factory SyncData.fromJson(Map<String, Object?> json) =>
|
||||
_$SyncDataFromJson(json);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue