Fix. Multi sub windows, sync peer options (#7247)

* Fix. Multi window, sync peer options

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* Remove unused `use`

Signed-off-by: fufesou <shuanglongchen@yeah.net>

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2024-02-23 22:49:53 +08:00
committed by GitHub
parent cce1ce0ee0
commit 2459bcd206
7 changed files with 136 additions and 57 deletions

View File

@@ -357,12 +357,26 @@ class FfiModel with ChangeNotifier {
if (isDesktop) {
gFFI.cmFileModel.onFileTransferLog(evt);
}
} else if (name == 'sync_peer_option') {
_handleSyncPeerOption(evt, peerId);
} else {
debugPrint('Unknown event name: $name');
}
};
}
_handleSyncPeerOption(Map<String, dynamic> evt, String peer) {
final k = evt['k'];
final v = evt['v'];
if (k == kOptionViewOnly) {
setViewOnly(peer, v as bool);
} else if (k == 'keyboard_mode') {
parent.target?.inputModel.updateKeyboardMode();
} else if (k == 'input_source') {
stateGlobal.getInputSource(force: true);
}
}
onUrlSchemeReceived(Map<String, dynamic> evt) {
final url = evt['url'].toString().trim();
if (url.startsWith(kUniLinksPrefix) && handleUriLink(uriString: url)) {
@@ -728,7 +742,7 @@ class FfiModel with ChangeNotifier {
setViewOnly(
peerId,
bind.sessionGetToggleOptionSync(
sessionId: sessionId, arg: 'view-only'));
sessionId: sessionId, arg: kOptionViewOnly));
}
if (connType == ConnType.defaultConn) {
final platformAdditions = evt['platform_additions'];