QNChatRepository
public class QNChatRepository
Represents a chat
-
Define wether a chat is a group or not
- oneToOne
- groupChat
Declaration
Swift
public enum ChatType
-
Expose chat type (1-1 or group)
Declaration
Swift
public var type: ChatType { get } -
Chat identifier (remote user for 1-1 and UUID for group chats)
Declaration
Swift
public var identifier: String { get } -
Group actions for group chats like invite a participant or expel one
Declaration
Swift
public private(set) var groupChatActions: QNGroupChatActions? { get } -
Last message received
Declaration
Swift
public fileprivate(set) var lastMessage: QNChatMessage? { get set } -
Count of unread messages
Declaration
Swift
public fileprivate(set) var unreadMessagesCount: Int { get set } -
Title of chat
Declaration
Swift
public fileprivate(set) var title: String { get } -
Image URL of chat
Declaration
Swift
public fileprivate(set) var imageUrl: URL? { get } -
Chat is associated with a conference
Declaration
Swift
public var isConferenceChat: Bool { get }
-
Fetch history related to this user, messages are received in delegate
Declaration
Swift
public func fetchMessagesFromStore(messageSearch: QNChatMessageSearch, retrieveFromCache: Bool = false) async throws -> [QNChatMessage]Parameters
messageSearchsearch criteria
retrieveFromCacheshould retrieve from cache.
completioncompletion block with
QNChatMessageSearchResult -
Send participant action, like typing or active, to remote participant
Declaration
Swift
public func sendParticipantActionInChat(_ action: QNChatMessage.ParticipantAction)Parameters
actionCurrent participant action
-
send(message:Asynchronous) Sends a new message to other participant
Declaration
Swift
public func send(message: String) async throws -> QNChatMessageParameters
messageBody message to be sent
Return Value
A Message
-
send(files:AsynchronousprogressHandler: ) Sends multiple files to the chat concurrently.
This method manages the entire XMPP file sharing lifecycle (slot request, HTTP upload, and XMPP message delivery) for each file in parallel.
Declaration
Swift
public func send( files: [QNUploadFile], progressHandler: ((String, Float) -> Void)? = nil ) async -> SendFilesReportParameters
filesAn array of
QNUploadFileobjects representing the files to be sent. Each object should contain the raw data, the filename, and optionally the local path.progressHandlerAn optional closure to track the upload progress of each individual file. It provides the filename (
String) and the current progress (Float, ranging from 0.0 to 1.0).Return Value
A
SendFilesReporttuple containing an array of successfully sent messages (successful) and an array of files that failed along with their respective errors (failed). -
Mark a message with a new status
Declaration
Swift
public func mark(message: QNChatMessage, as status: QNChatMessage.Status)Parameters
messageMessage to change status
statusNew status
-
Send a mark with last message read
Declaration
Swift
public func markChatAsRead() -
archive()AsynchronousArchive chat
Declaration
Swift
public func archive() async throws -
delete()AsynchronousDelete chat
Declaration
Swift
public func delete() async throws