diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 6580c6bb..502d0e86 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -57,6 +57,7 @@ class ContactInfoState extends ChangeNotifier { late bool _pinned; String? _acnCircuit; + String? _messageDraft; ContactInfoState(this.profileOnion, this.identifier, this.onion, {nickname = "", @@ -93,12 +94,14 @@ class ContactInfoState extends ChangeNotifier { keys = Map>(); } - String get nickname => this._nickname; + String get nickname => this._nickname + (this._messageDraft != null && this._messageDraft != "" ? "*" : ""); String get savePeerHistory => this._savePeerHistory; String? get acnCircuit => this._acnCircuit; + String? get messageDraft => this._messageDraft; + set acnCircuit(String? acnCircuit) { this._acnCircuit = acnCircuit; notifyListeners(); @@ -152,6 +155,11 @@ class ContactInfoState extends ChangeNotifier { notifyListeners(); } + set messageDraft(String? newVal) { + this._messageDraft = newVal; + notifyListeners(); + } + void selected() { this._newMarkerMsgIndex = this._unreadMessages - 1; this._unreadMessages = 0; diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 27bbe662..92d18915 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -65,6 +65,7 @@ class _MessageViewState extends State { showDown = false; } }); + ctrlrCompose.text = Provider.of(context, listen: false).messageDraft ?? ""; super.initState(); } @@ -348,6 +349,7 @@ class _MessageViewState extends State { ); } + Provider.of(context, listen: false).messageDraft = null; ctrlrCompose.clear(); focusNode.requestFocus(); @@ -545,6 +547,7 @@ class _MessageViewState extends State { enabled: true, // always allow editing... onChanged: (String x) { + Provider.of(context, listen: false).messageDraft = x; setState(() { // we need to force a rerender here to update the max length count });