mirror of
https://github.com/paul-nameless/tg
synced 2025-02-16 18:48:24 +00:00
Mark as seen msgs when opening chat
This commit is contained in:
parent
c4d4574d17
commit
7f6d910544
2 changed files with 9 additions and 6 deletions
|
@ -159,6 +159,7 @@ class Controller:
|
||||||
def handle_msgs(self) -> str:
|
def handle_msgs(self) -> str:
|
||||||
self.chat_size = 0.2
|
self.chat_size = 0.2
|
||||||
self.resize()
|
self.resize()
|
||||||
|
self.model.view_current_msg()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
|
|
|
@ -76,15 +76,19 @@ class Model:
|
||||||
return True
|
return True
|
||||||
return False
|
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:
|
def next_msg(self, step: int = 1) -> bool:
|
||||||
chat_id = self.chats.id_by_index(self.current_chat)
|
chat_id = self.chats.id_by_index(self.current_chat)
|
||||||
if not chat_id:
|
if not chat_id:
|
||||||
return False
|
return False
|
||||||
is_next = self.msgs.next_msg(chat_id, step)
|
is_next = self.msgs.next_msg(chat_id, step)
|
||||||
if is_next:
|
if is_next:
|
||||||
msg = MsgProxy(self.current_msg())
|
self.view_current_msg()
|
||||||
msg_id = msg["id"]
|
|
||||||
self.tg.view_messages(chat_id, [msg_id])
|
|
||||||
return is_next
|
return is_next
|
||||||
|
|
||||||
def prev_msg(self, step: int = 1) -> bool:
|
def prev_msg(self, step: int = 1) -> bool:
|
||||||
|
@ -93,9 +97,7 @@ class Model:
|
||||||
return False
|
return False
|
||||||
is_prev = self.msgs.prev_msg(chat_id, step)
|
is_prev = self.msgs.prev_msg(chat_id, step)
|
||||||
if is_prev:
|
if is_prev:
|
||||||
msg = MsgProxy(self.current_msg())
|
self.view_current_msg()
|
||||||
msg_id = msg["id"]
|
|
||||||
self.tg.view_messages(chat_id, [msg_id])
|
|
||||||
return is_prev
|
return is_prev
|
||||||
|
|
||||||
def get_chats(
|
def get_chats(
|
||||||
|
|
Loading…
Add table
Reference in a new issue