save message drafts (until cwtch close)
continuous-integration/drone/pr Build was killed
Details
continuous-integration/drone/pr Build was killed
Details
This commit is contained in:
parent
93284708e0
commit
cac2064731
|
@ -57,6 +57,7 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
late bool _pinned;
|
late bool _pinned;
|
||||||
|
|
||||||
String? _acnCircuit;
|
String? _acnCircuit;
|
||||||
|
String? _messageDraft;
|
||||||
|
|
||||||
ContactInfoState(this.profileOnion, this.identifier, this.onion,
|
ContactInfoState(this.profileOnion, this.identifier, this.onion,
|
||||||
{nickname = "",
|
{nickname = "",
|
||||||
|
@ -93,12 +94,14 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
keys = Map<String, GlobalKey<MessageRowState>>();
|
keys = Map<String, GlobalKey<MessageRowState>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
String get nickname => this._nickname;
|
String get nickname => this._nickname + (this._messageDraft != null && this._messageDraft != "" ? "*" : "");
|
||||||
|
|
||||||
String get savePeerHistory => this._savePeerHistory;
|
String get savePeerHistory => this._savePeerHistory;
|
||||||
|
|
||||||
String? get acnCircuit => this._acnCircuit;
|
String? get acnCircuit => this._acnCircuit;
|
||||||
|
|
||||||
|
String? get messageDraft => this._messageDraft;
|
||||||
|
|
||||||
set acnCircuit(String? acnCircuit) {
|
set acnCircuit(String? acnCircuit) {
|
||||||
this._acnCircuit = acnCircuit;
|
this._acnCircuit = acnCircuit;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -152,6 +155,11 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set messageDraft(String? newVal) {
|
||||||
|
this._messageDraft = newVal;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void selected() {
|
void selected() {
|
||||||
this._newMarkerMsgIndex = this._unreadMessages - 1;
|
this._newMarkerMsgIndex = this._unreadMessages - 1;
|
||||||
this._unreadMessages = 0;
|
this._unreadMessages = 0;
|
||||||
|
|
|
@ -41,7 +41,7 @@ class MessageView extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MessageViewState extends State<MessageView> {
|
class _MessageViewState extends State<MessageView> {
|
||||||
final ctrlrCompose = TextEditingController();
|
var ctrlrCompose = TextEditingController();
|
||||||
final focusNode = FocusNode();
|
final focusNode = FocusNode();
|
||||||
int selectedContact = -1;
|
int selectedContact = -1;
|
||||||
ItemPositionsListener scrollListener = ItemPositionsListener.create();
|
ItemPositionsListener scrollListener = ItemPositionsListener.create();
|
||||||
|
@ -65,6 +65,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
showDown = false;
|
showDown = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ctrlrCompose.text = Provider.of<ContactInfoState>(context).messageDraft ?? "";
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,6 +349,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Provider.of<ContactInfoState>(context).messageDraft = null;
|
||||||
ctrlrCompose.clear();
|
ctrlrCompose.clear();
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
|
|
||||||
|
@ -545,6 +547,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
enabled: true, // always allow editing...
|
enabled: true, // always allow editing...
|
||||||
|
|
||||||
onChanged: (String x) {
|
onChanged: (String x) {
|
||||||
|
Provider.of<ContactInfoState>(context).messageDraft = x;
|
||||||
setState(() {
|
setState(() {
|
||||||
// we need to force a rerender here to update the max length count
|
// we need to force a rerender here to update the max length count
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue