Merge pull request #4917 from 21pages/fix_chat

Fix chat
This commit is contained in:
RustDesk 2023-07-08 16:40:31 +08:00 committed by GitHub
commit 91c53b1db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 13 deletions

View File

@ -104,6 +104,12 @@ class ConnectionManagerState extends State<ConnectionManager> {
final client =
gFFI.serverModel.clients.firstWhereOrNull((e) => e.id == client_id);
if (client != null) {
if (client.unreadChatMessageCount.value > 0) {
Future.delayed(Duration.zero, () {
client.unreadChatMessageCount.value = 0;
gFFI.chatModel.showChatPage(client.id);
});
}
windowManager.setTitle(getWindowNameWithId(client.peerId));
}
}
@ -168,7 +174,13 @@ class ConnectionManagerState extends State<ConnectionManager> {
builder: (_, model, child) => model.isShowCMChatPage
? Expanded(
child: buildRemoteBlock(
child: ChatPage(),
child: Container(
decoration: BoxDecoration(
border: Border(
right: BorderSide(
color: Theme.of(context)
.dividerColor))),
child: ChatPage()),
),
flex: (kConnectionManagerWindowSizeOpenChat.width -
kConnectionManagerWindowSizeClosedChat

View File

@ -234,13 +234,21 @@ class ChatModel with ChangeNotifier {
}
showChatPage(int id) async {
if (isConnManager) {
if (!_isShowCMChatPage) {
await toggleCMChatPage(id);
if (isDesktop) {
if (isConnManager) {
if (!_isShowCMChatPage) {
await toggleCMChatPage(id);
}
} else {
if (_isChatOverlayHide()) {
await toggleChatOverlay();
}
}
} else {
if (_isChatOverlayHide()) {
await toggleChatOverlay();
if (id == clientModeID) {
if (_isChatOverlayHide()) {
await toggleChatOverlay();
}
}
}
}

View File

@ -462,13 +462,7 @@ class ServerModel with ChangeNotifier {
key: client.id.toString(),
label: client.name,
closable: false,
onTap: () {
if (client.unreadChatMessageCount.value > 0) {
client.unreadChatMessageCount.value = 0;
final chatModel = parent.target!.chatModel;
chatModel.showChatPage(client.id);
}
},
onTap: () {},
page: desktop.buildConnectionCard(client)));
Future.delayed(Duration.zero, () async {
if (!hideCm) window_on_top(null);