From 602b53fe4733af561a10e9e09b1a96c5a56a9999 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 18 Mar 2023 13:48:56 +0800 Subject: [PATCH] Better peer info handler Signed-off-by: fufesou --- flutter/lib/models/model.dart | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 70e8c7d60..f7ccc4a13 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -402,10 +402,12 @@ class FfiModel with ChangeNotifier { // } + final connType = parent.target?.connType; + if (isPeerAndroid) { _touchMode = true; - if (parent.target != null && - parent.target!.connType == ConnType.defaultConn && + if (connType == ConnType.defaultConn && + parent.target != null && parent.target!.ffiModel.permissions['keyboard'] != false) { Timer( const Duration(milliseconds: 100), @@ -417,10 +419,9 @@ class FfiModel with ChangeNotifier { await bind.sessionGetOption(id: peerId, arg: 'touch-mode') != ''; } - if (parent.target != null && - parent.target!.connType == ConnType.fileTransfer) { + if (connType == ConnType.fileTransfer) { parent.target?.fileModel.onReady(); - } else { + } else if (connType == ConnType.defaultConn) { _pi.displays = []; List displays = json.decode(evt['displays']); for (int i = 0; i < displays.length; ++i) { @@ -450,8 +451,10 @@ class FfiModel with ChangeNotifier { handleResolutions(peerId, evt["resolutions"]); parent.target?.elevationModel.onPeerInfo(_pi); } - setViewOnly( - peerId, bind.sessionGetToggleOptionSync(id: peerId, arg: 'view-only')); + if (connType == ConnType.defaultConn) { + setViewOnly(peerId, + bind.sessionGetToggleOptionSync(id: peerId, arg: 'view-only')); + } notifyListeners(); }