parent
e14ab3e708
commit
e38307657d
5 changed files with 445 additions and 63 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/event.dart";
|
||||
import "package:nexus/models/read_receipt.dart";
|
||||
|
||||
part "paginate.freezed.dart";
|
||||
part "paginate.g.dart";
|
||||
|
|
@ -10,6 +11,9 @@ part "paginate.g.dart";
|
|||
class const Paginate({
|
||||
required final IList<Event> events,
|
||||
required final IList<Event> relatedEvents,
|
||||
|
||||
/// Read receipts for the events, by event ID.
|
||||
final IMap<String, IList<ReadReceipt>> receipts = const .empty(),
|
||||
required final bool hasMore,
|
||||
}) with _$Paginate {
|
||||
Map<String, Object?> toJson() => _$PaginateToJson(this);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class const ReadReceipt({
|
|||
required final String eventId,
|
||||
@EpochDateTimeConverter() required final DateTime timestamp,
|
||||
}) with _$ReadReceipt {
|
||||
String get thread => switch (threadId) {
|
||||
final threadId? when threadId.isNotEmpty => threadId,
|
||||
_ => "main",
|
||||
};
|
||||
|
||||
Map<String, Object?> toJson() => _$ReadReceiptToJson(this);
|
||||
|
||||
factory ReadReceipt.fromJson(Map<String, Object?> json) =>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import "package:material_ui/material_ui.dart";
|
||||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/room_order.dart";
|
||||
import "package:nexus/models/typing_indicators.dart";
|
||||
import "package:nexus/models/show_and_send.dart";
|
||||
|
||||
part "settings.freezed.dart";
|
||||
part "settings.g.dart";
|
||||
|
|
@ -17,7 +17,11 @@ class const Settings({
|
|||
final bool swipeToReply = false,
|
||||
final bool hideMembershipEvents = false,
|
||||
final RoomOrder roomOrder = .unreadFirst,
|
||||
final TypingIndicators typingIndicators = .showAndSend,
|
||||
final ShowAndSend typingIndicators = .showAndSend,
|
||||
|
||||
/// When not sending, read receipts are still sent privately, so that the
|
||||
/// user's other devices know what has been read.
|
||||
final ShowAndSend readReceipts = .showAndSend,
|
||||
}) with _$Settings {
|
||||
Map<String, Object?> toJson() => _$SettingsToJson(this);
|
||||
|
||||
|
|
|
|||
2
lib/models/show_and_send.dart
Normal file
2
lib/models/show_and_send.dart
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/// Whether to show something from others, and send it to them, e.g. typing indicators or read receipts.
|
||||
enum ShowAndSend { showAndSend, show, neither }
|
||||
|
|
@ -1 +0,0 @@
|
|||
enum TypingIndicators { showAndSend, show, neither }
|
||||
Loading…
Reference in a new issue