14 private array $chatIds = [];
15 private array $messageIds = [];
16 private array $recentChatIds = [];
17 private array $dialogIds = [];
18 private array $shortInfoChatIds = [];
19 private array $deletedChatIds = [];
20 private array $completeDeleteChatIds = [];
21 private bool $readAll =
false;
42 $this->readAll =
true;
51 if (!isset($this->recent))
55 $entities = $this->recent->getEntityIds();
56 $this->recentChatIds = $entities[
'chatIds'];
57 $this->messageIds = $entities[
'messageIds'];
58 $this->dialogIds = $entities[
'dialogIds'];
66 return $this->shortInfoChatIds;
71 return $this->messageIds;
76 return new ChatsSync($this->getChats(), $this->getRecent());
79 private function getChats():
array
81 if (isset($this->chats))
87 foreach ($this->chatIds as $chatId)
95 unset($this->chatIds[$chatId]);
99 $this->fillDialogId($chat);
100 $this->chats[$chatId] = $chat;
107 private function fillDialogId(Chat $chat): void
109 if (!$chat instanceof PrivateChat)
114 $dialogId = $this->dialogIds[$chat->getId()] ??
null;
115 if ($dialogId !==
null)
117 $chat->setDialogId((
string)$dialogId);
131 'addedRecent' => $this->recentChatIds,
132 'addedChats' => $this->chatIds,
133 'deletedChats' => $this->deletedChatIds,
134 'completeDeletedChats' => $this->completeDeleteChatIds,
139 $result[
'readAllChats'] =
true;