diff --git a/flutter/lib/common/widgets/dialog.dart b/flutter/lib/common/widgets/dialog.dart index 8fa7b9068..2e60304be 100644 --- a/flutter/lib/common/widgets/dialog.dart +++ b/flutter/lib/common/widgets/dialog.dart @@ -1098,14 +1098,13 @@ showSetOSAccount( }); } -showAuditDialog(SessionID sessionId, dialogManager) async { - final controller = TextEditingController(); - dialogManager.show((setState, close, context) { +showAuditDialog(FFI ffi) async { + final controller = TextEditingController(text: ffi.auditNote); + ffi.dialogManager.show((setState, close, context) { submit() { - var text = controller.text.trim(); - if (text != '') { - bind.sessionSendNote(sessionId: sessionId, note: text); - } + var text = controller.text; + bind.sessionSendNote(sessionId: ffi.sessionId, note: text); + ffi.auditNote = text; close(); } diff --git a/flutter/lib/common/widgets/toolbar.dart b/flutter/lib/common/widgets/toolbar.dart index 21af68097..98621a87e 100644 --- a/flutter/lib/common/widgets/toolbar.dart +++ b/flutter/lib/common/widgets/toolbar.dart @@ -116,7 +116,7 @@ List toolbarControls(BuildContext context, String id, FFI ffi) { v.add( TTextMenu( child: Text(translate('Note')), - onPressed: () => showAuditDialog(sessionId, ffi.dialogManager)), + onPressed: () => showAuditDialog(ffi)), ); } // divider diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index b78001a3f..1fa3255c9 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1575,6 +1575,7 @@ class FFI { var version = ''; var connType = ConnType.defaultConn; var closed = false; + var auditNote = ''; /// dialogManager use late to ensure init after main page binding [globalKey] late final dialogManager = OverlayDialogManager(); @@ -1624,6 +1625,7 @@ class FFI { String? password, bool? forceRelay}) { closed = false; + auditNote = ''; assert(!(isFileTransfer && isPortForward), 'more than one connect type'); if (isFileTransfer) { connType = ConnType.fileTransfer; diff --git a/src/ui/header.tis b/src/ui/header.tis index 52b2a7f07..2d79db8fa 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -342,8 +342,8 @@ class Header: Reactor.Component { , "", function(res=null) { if (!res) return; - if (!res.text) return; - self.conn_note = res.text; + if (res.text == null || res.text == undefined) return; + self.conn_note = res.text ?? ""; handler.send_note(res.text); }, 280); } diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index aec45bdcc..e821b71dd 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -1348,6 +1348,6 @@ async fn start_one_port_forward( #[tokio::main(flavor = "current_thread")] async fn send_note(url: String, id: String, conn_id: i32, note: String) { - let body = serde_json::json!({ "id": id, "Id": conn_id, "note": note }); + let body = serde_json::json!({ "id": id, "conn_id": conn_id, "note": note }); allow_err!(crate::post_request(url, body.to_string(), "").await); }