Better peer info handler

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-03-18 13:48:56 +08:00
parent 7ee01c7e95
commit 602b53fe47

View File

@ -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<dynamic> 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();
}