use uuid as session id

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-06-06 07:39:44 +08:00
parent 71838ad821
commit 2ececed0c1
36 changed files with 706 additions and 546 deletions

View File

@@ -73,7 +73,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
gFFI.dialogManager
.showLoading(translate('Connecting...'), onCancel: closeConnection);
});
gFFI.ffiModel.updateEventListener(widget.id);
gFFI.ffiModel.updateEventListener(gFFI.sessionId, widget.id);
Wakelock.enable();
}
@@ -104,7 +104,8 @@ class _FileManagerPageState extends State<FileManagerPage> {
leading: Row(children: [
IconButton(
icon: Icon(Icons.close),
onPressed: () => clientClose(widget.id, gFFI.dialogManager)),
onPressed: () =>
clientClose(gFFI.sessionId, gFFI.dialogManager)),
]),
centerTitle: true,
title: ToggleSwitch(

View File

@@ -54,6 +54,7 @@ class _RemotePageState extends State<RemotePage> {
var _showEdit = false; // use soft keyboard
InputModel get inputModel => gFFI.inputModel;
SessionID get sessionId => gFFI.sessionId;
@override
void initState() {
@@ -66,9 +67,9 @@ class _RemotePageState extends State<RemotePage> {
});
Wakelock.enable();
_physicalFocusNode.requestFocus();
gFFI.ffiModel.updateEventListener(widget.id);
gFFI.ffiModel.updateEventListener(sessionId, widget.id);
gFFI.inputModel.listenToMouse(true);
gFFI.qualityMonitorModel.checkShowQualityMonitor(widget.id);
gFFI.qualityMonitorModel.checkShowQualityMonitor(sessionId);
keyboardSubscription =
keyboardVisibilityController.onChange.listen(onSoftKeyboardChanged);
_blockableOverlayState.applyFfi(gFFI);
@@ -130,7 +131,7 @@ class _RemotePageState extends State<RemotePage> {
if (newValue.length > common) {
var s = newValue.substring(common);
if (s.length > 1) {
bind.sessionInputString(id: widget.id, value: s);
bind.sessionInputString(sessionId: sessionId, value: s);
} else {
inputChar(s);
}
@@ -164,11 +165,11 @@ class _RemotePageState extends State<RemotePage> {
content == '' ||
content == '【】')) {
// can not only input content[0], because when input ], [ are also auo insert, which cause ] never be input
bind.sessionInputString(id: widget.id, value: content);
bind.sessionInputString(sessionId: sessionId, value: content);
openKeyboard();
return;
}
bind.sessionInputString(id: widget.id, value: content);
bind.sessionInputString(sessionId: sessionId, value: content);
} else {
inputChar(content);
}
@@ -213,7 +214,7 @@ class _RemotePageState extends State<RemotePage> {
return WillPopScope(
onWillPop: () async {
clientClose(widget.id, gFFI.dialogManager);
clientClose(sessionId, gFFI.dialogManager);
return false;
},
child: getRawPointerAndKeyBody(Scaffold(
@@ -305,7 +306,7 @@ class _RemotePageState extends State<RemotePage> {
color: Colors.white,
icon: Icon(Icons.clear),
onPressed: () {
clientClose(widget.id, gFFI.dialogManager);
clientClose(sessionId, gFFI.dialogManager);
},
)
] +
@@ -476,7 +477,7 @@ class _RemotePageState extends State<RemotePage> {
},
onTwoFingerScaleEnd: (d) {
_scale = 1;
bind.sessionSetViewStyle(id: widget.id, value: "");
bind.sessionSetViewStyle(sessionId: sessionId, value: "");
},
onThreeFingerVerticalDragUpdate: gFFI.ffiModel.isPeerAndroid
? null
@@ -535,7 +536,7 @@ class _RemotePageState extends State<RemotePage> {
var paints = <Widget>[ImagePaint()];
if (!gFFI.canvasModel.cursorEmbedded) {
final cursor = bind.sessionGetToggleOptionSync(
id: widget.id, arg: 'show-remote-cursor');
sessionId: sessionId, arg: 'show-remote-cursor');
if (keyboard || cursor) {
paints.add(CursorPaint());
}
@@ -579,7 +580,7 @@ class _RemotePageState extends State<RemotePage> {
gFFI.ffiModel.toggleTouchMode();
final v = gFFI.ffiModel.touchMode ? 'Y' : '';
bind.sessionPeerOption(
id: widget.id, name: "touch", value: v);
sessionId: sessionId, name: "touch", value: v);
})));
}
@@ -830,7 +831,7 @@ void showOptions(
children.add(InkWell(
onTap: () {
if (i == cur) return;
bind.sessionSwitchDisplay(id: id, value: i);
bind.sessionSwitchDisplay(sessionId: gFFI.sessionId, value: i);
gFFI.dialogManager.dismissAll();
},
child: Ink(