When joining a room show already sent chat messages
This commit is contained in:
@@ -190,22 +190,31 @@ class VlcSyncApp(QMainWindow):
|
||||
|
||||
self.room_widget.setup_room(self.room_code, self.username, self.local_file_name, self.local_file_path, start_time_s)
|
||||
|
||||
chat_history = msg.get("chatHistory", [])
|
||||
if chat_history:
|
||||
for chat in chat_history:
|
||||
self.room_widget.add_chat_message(chat.get("username", "Unknown"), chat.get("message", ""), chat.get("timestamp", 0))
|
||||
|
||||
users = msg.get("users", [])
|
||||
if users:
|
||||
self.room_widget.update_users(users)
|
||||
|
||||
if state:
|
||||
self.room_widget.handle_sync_event(state)
|
||||
|
||||
chat_history = msg.get("chatHistory", [])
|
||||
if chat_history:
|
||||
for chat in chat_history:
|
||||
self.room_widget.add_chat_message(chat.get("username", "Unknown"), chat.get("message", ""), chat.get("timestamp", 0))
|
||||
|
||||
self.room_widget.add_system_message("Welcome to the room! 👋")
|
||||
|
||||
def on_room_rejoined(self, msg: dict):
|
||||
self.room_widget.set_room_code_display(self.room_code)
|
||||
self.room_widget.add_system_message("✅ Reconnected to the room.")
|
||||
|
||||
chat_history = msg.get("chatHistory", [])
|
||||
if chat_history:
|
||||
self.room_widget.clear_chat()
|
||||
for chat in chat_history:
|
||||
self.room_widget.add_chat_message(chat.get("username", "Unknown"), chat.get("message", ""), chat.get("timestamp", 0))
|
||||
|
||||
self.room_widget.add_system_message("✅ Reconnected to the room.")
|
||||
|
||||
users = msg.get("users", [])
|
||||
if users:
|
||||
self.room_widget.update_users(users)
|
||||
|
||||
Reference in New Issue
Block a user