Skip to content
Snippets Groups Projects
Select Git revision
  • edb401b212c28a07e78f83363a1446e36e2b1b27
  • release default
  • 11-22-implement-kv-interface-defined-in-collectiveversionedkvgo
  • master protected
  • XX-4688/DbEncoding
  • hotfix/update
  • @XX-4682/Files
  • hotfix/XX-4655
  • dev protected
  • project/HavenNotifications
  • XX-4602/SilentMessageType
  • jono/npmTest
  • wasmTest2
  • XX-4461/FileUpload
  • XX-4505/blockuser
  • XX-4441
  • Jakub/Emoji-CI-Test
  • testing/websockets
  • fastReg
  • fast-registration
  • NewHostPool
  • v0.3.22
  • v0.3.21
  • v0.3.20
  • v0.3.18
  • v0.3.17
  • v0.3.16
  • v0.3.15
  • v0.3.14
  • v0.3.13
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • 812b395df518ce096d01d5292596ca26f8fe92d9c4487ddfa515e190a51aa1a1
  • 76ba08e2dfa1798412a265404fa271840b52c035869111fce8e8cdb23a036a5a
41 results

indexedDbEncryptionTrack_test.go

Blame
  • ContactChatInfo.swift 3.24 KiB
    /// Represents chat with a contact
    public struct ContactChatInfo: Identifiable, Equatable, Hashable, Codable {
      /// Unique identifier of contact chat
      public typealias ID = Contact.ID
    
      /// Instantiate contact chat representation
      ///
      /// - Parameters:
      ///   - contact: Contact
      ///   - lastMessage: Last message sent to or received from the contact
      ///   - unreadCount: Number of unread messages in the chat
      public init(
        contact: Contact,
        lastMessage: Message,
        unreadCount: Int
      ) {
        self.contact = contact
        self.lastMessage = lastMessage
        self.unreadCount = unreadCount
      }
    
      /// Unique identifier of contact chat
      ///
      /// Matches contact's ID
      public var id: ID { contact.id }
    
      /// Contact
      public var contact: Contact
    
      /// Last message sent to or received from the contact
      public var lastMessage: Message
    
      /// Number of unread messages in the chat
      public var unreadCount: Int
    }
    
    extension ContactChatInfo {
      /// Fetch contact chat infos operation
      public typealias Fetch = XXModels.Fetch<ContactChatInfo, Query>
    
      /// Fetch contact chat infos operation publisher
      public typealias FetchPublisher = XXModels.FetchPublisher<ContactChatInfo, Query>
    
      /// Query used for fetching chat infos
      public struct Query: Equatable {
        /// Instantiate query
        ///
        /// - Parameters:
        ///   - userId: Current user's contact ID.
        ///   - authStatus: Filter by other contact auth status.
        ///     If set, only chats with contacts that have any of the provided
        ///     auth statuses will be included.
        ///     If `nil` (default), the filter is not used.
        ///   - isBlocked: Filter by other contact's `isBlocked` status.
        ///     If `true`, only chats with blocked contacts are included.
        ///     If `false`, only chats with non-blocked contacts are included.
        ///     If `nil` (default), the filter is not used.
        ///   - isBanned: Filter by other contact's `isBanned` status
        ///     If `true`, only chats with banned contacts are included.
        ///     If `false`, only chats with non-banned contacts are included.
        ///     If `nil` (default), the filter is not used.
        public init(
          userId: Contact.ID,
          authStatus: Set<Contact.AuthStatus>? = nil,
          isBlocked: Bool? = nil,
          isBanned: Bool? = nil
        ) {
          self.userId = userId
          self.authStatus = authStatus
          self.isBlocked = isBlocked
          self.isBanned = isBanned
        }
    
        /// Current user's contact ID
        public var userId: Contact.ID
    
        /// Filter by other contact auth status
        ///
        /// If set, only chats with contacts that have any of the provided
        /// auth statuses will be included.
        /// If `nil`, the filter is not used.
        public var authStatus: Set<Contact.AuthStatus>?
    
        /// Filter by other contact's `isBlocked` status
        ///
        /// If `true`, only chats with blocked contacts are included.
        /// If `false`, only chats with non-blocked contacts are included.
        /// If `nil`, the filter is not used.
        public var isBlocked: Bool?
    
        /// Filter by other contact's `isBanned` status
        ///
        /// If `true`, only chats with banned contacts are included.
        /// If `false`, only chats with non-banned contacts are included.
        /// If `nil`, the filter is not used.
        public var isBanned: Bool?
      }
    }