QNChatsRepository
public class QNChatsRepository
Service to manage chat actions and subscribe to chat events
-
Data needed to create each type of chat
- oneToOne
- groupChat
Declaration
Swift
public enum CreationType -
Chats associated to active conferences
Declaration
Swift
public var currentConferenceChats: [QNChatRepository] { get } -
Current active chats
Declaration
Swift
public var currentChats: [QNChatRepository] { get }
-
connect()AsynchronousStarts a new chat session, new messages are delivered once it’s connected
Declaration
Swift
public func connect() async throws -
disconnect()AsynchronousRemove a chat session, this should be called on logout
Declaration
Swift
public func disconnect() async -
suspend()AsynchronousStops a chat session, this should be called when enters in background to receive pushes via apn
Declaration
Swift
public func suspend() async -
reconnectSession()AsynchronousReconnects a chat session, this should be called when enters in foreground to receive pushes via socket tcp
Declaration
Swift
public func reconnectSession() async throws -
Enable push module to receive new chat notifications
Declaration
Swift
public func enablePushNotification(apnsToken: String, sessionToken: String, serverJID: String) async throwsParameters
apnsTokenAPNS token
sessionTokenToken from server session
serverJIDServer to register the push
-
disablePushNotification(sessionToken:AsynchronousserverJID: ) Disable push module to stop receiving new chat notifications
Declaration
Swift
public func disablePushNotification(sessionToken: String, serverJID: String) async throwsParameters
sessionTokenToken from server session
serverJIDServer to register the push
-
createChat(creationType:Asynchronous) Create a new chat
Declaration
Swift
public func createChat(creationType: QNChatsRepository.CreationType) async throws -> QNChatRepositoryParameters
creationTypeUsed to create a 1-1 chat or a group chat
resultAsync result with
Chat -
chats(types:AsynchronousfetchingDataChat: ) Fetch chats
Declaration
Swift
public func chats( types: [QNChatRepository.ChatType], fetchingDataChat: Bool = true ) async throws -> [QNChatRepository]Parameters
typesFilter by type (1-1 or group)
resultAsync result with a list of
Chat -
joinGroupChat(id:Asynchronous) Join a specific group chat
Declaration
Swift
public func joinGroupChat(id: String) async throws -> QNChatRepositoryParameters
idIdentifier of the chat to be joined
resultAsync result with the
Chat