ChatUnreadState

struct ChatUnreadState

Summarizes the unread state of a single MailInbox for a single user. Built from one read of that inbox’s hash, so the chats the user was added to and the counts derived from them can never disagree with each other.

  • The IDs of the chats the user has been added to but has not yet viewed, in no particular order.

    Declaration

    Swift

    var addedToChatIDs: [UUID]
  • The number of chats with unread messages. Not the total number of unread messages; a single chat with 10 unread messages counts as 1. Chats the user was added to and hasn’t yet viewed aren’t counted here.

    Declaration

    Swift

    var unreadChatCount: Int
  • The number of chats the user has been added to but not yet viewed.

    Declaration

    Swift

    var addedToChatCount: Int { get }
  • Declaration

    Swift

    init()
  • Splits a raw “Unread-” hash into the two buckets. Chats the user was added to are stored with a value > 9000 (see userAddedToChat), so the value tells us which bucket a given chat belongs in.

    Declaration

    Swift

    init(unreadMailHash: [String : Int?])