Use cases: Chats and messages

It's a place for chats and messages imlementations / behaviors that separate attention could be paid to. You can treat it as a "Good to know" section.

Conversation fetching

We have 2 types of conversation - chats (one-to-one conversations) and Groups. Chats are fetched from DB and from server on each app start (while initial recovery process), groups are fetched only from DB on app start. In case client receives message that belongs to unknown (unsaved previously) group then this new group info is fetched from server via separate request after chat message receiving.

Working with Message

Message structure contains a lot of fields. The interesting one is contentState - that's the field that gets encrypted on message sending and decrypted on message receiving. contentState contains message all content related to message (it could be just text for text messages, attachment for attachment-type messages, etc).