keep message drafts on room switches
this is for you courge
This commit is contained in:
parent
7f7bdbf525
commit
e899bb3929
1 changed files with 357 additions and 194 deletions
29
lib/models/composer_draft.dart
Normal file
29
lib/models/composer_draft.dart
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:fluttertagger/fluttertagger.dart";
|
||||
import "package:freezed_annotation/freezed_annotation.dart";
|
||||
import "package:nexus/models/bot_command_draft.dart";
|
||||
import "package:nexus/models/content/image_pack.dart";
|
||||
import "package:nexus/models/content/message.dart";
|
||||
import "package:nexus/models/content/poll_start.dart";
|
||||
import "package:nexus/models/relation_type.dart";
|
||||
|
||||
part "composer_draft.freezed.dart";
|
||||
|
||||
@Freezed(toJson: false, fromJson: false)
|
||||
class const ComposerDraft({
|
||||
// Formatted like ":id#name#", see the composer's tagTextFormatter
|
||||
final String text = "",
|
||||
final IList<Tag> tags = const .empty(),
|
||||
final int? relatedEvent,
|
||||
final RelationType relationType = .reply,
|
||||
|
||||
// Replace the text field until they are sent or removed
|
||||
final (String, PackImage)? sticker,
|
||||
final PollStart? poll,
|
||||
final LocationMessageContent? location,
|
||||
|
||||
// The draft from before an edit, restored once it is sent or cancelled
|
||||
final ({ComposerDraft draft, BotCommandDraft? botCommand})? beforeEdit,
|
||||
}) with _$ComposerDraft {
|
||||
bool get isEditing => beforeEdit != null;
|
||||
}
|
||||
Loading…
Reference in a new issue