Mark as seen msgs when opening chat

This commit is contained in:
Paul Nameless 2020-05-21 14:16:57 +08:00
parent c4d4574d17
commit 7f6d910544
2 changed files with 9 additions and 6 deletions

View file

@ -159,6 +159,7 @@ class Controller:
def handle_msgs(self) -> str:
self.chat_size = 0.2
self.resize()
self.model.view_current_msg()
while True:

View file

@ -76,15 +76,19 @@ class Model:
return True
return False
def view_current_msg(self):
chat_id = self.chats.id_by_index(self.current_chat)
msg = MsgProxy(self.current_msg())
msg_id = msg["id"]
self.tg.view_messages(chat_id, [msg_id])
def next_msg(self, step: int = 1) -> bool:
chat_id = self.chats.id_by_index(self.current_chat)
if not chat_id:
return False
is_next = self.msgs.next_msg(chat_id, step)
if is_next:
msg = MsgProxy(self.current_msg())
msg_id = msg["id"]
self.tg.view_messages(chat_id, [msg_id])
self.view_current_msg()
return is_next
def prev_msg(self, step: int = 1) -> bool:
@ -93,9 +97,7 @@ class Model:
return False
is_prev = self.msgs.prev_msg(chat_id, step)
if is_prev:
msg = MsgProxy(self.current_msg())
msg_id = msg["id"]
self.tg.view_messages(chat_id, [msg_id])
self.view_current_msg()
return is_prev
def get_chats(