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 }
-
Add a new
QNChatsDelegateDeclaration
Swift
public func add(delegate: QNChatsDelegate)Parameters
delegatedelegate instance
-
Remove a
QNChatsDelegateDeclaration
Swift
public func remove(delegate: QNChatsDelegate)Parameters
delegatedelegate to remove
-
Starts a new chat session, new messages are delivered once it’s connected
Declaration
Swift
public func connect(completion: @escaping () -> Void)Parameters
completioncompletion block
-
Remove a chat session, this should be called on logout
Declaration
Swift
public func disconnect(completion: @escaping () -> Void)Parameters
completioncompletion block
-
Stops a chat session, this should be called when enters in background to receive pushes via apn
Declaration
Swift
public func suspend(completion: @escaping () -> Void)Parameters
completioncompletion block
-
Reconnects a chat session, this should be called when enters in foreground to receive pushes via socket tcp
Declaration
Swift
public func reconnectSession(completion: @escaping () -> Void)Parameters
completioncompletion block
-
Enable push module to receive new chat notifications
Declaration
Swift
public func enablePushNotification(apnsToken: String, sessionToken: String, serverJID: String, completion: @escaping (Result<Void, ClientError>) -> Void)Parameters
apnsTokenAPNS token
sessionTokenToken from sippo session
serverJIDServer to register the push
completioncompletion block
-
Disable push module to stop receiving new chat notifications
Declaration
Swift
public func disablePushNotification(sessionToken: String, serverJID: String, completion: @escaping (Result<Void, ClientError>) -> Void)Parameters
sessionTokenToken from sippo session
serverJIDServer to register the push
completioncompletion block
-
Create a new chat
Declaration
Swift
public func createChat(creationType: QNChatsRepository.CreationType, result: @escaping (Result<QNChatRepository, ResourceError>) -> Void)Parameters
creationTypeUsed to create a 1-1 chat or a group chat
resultAsync result with
Chat -
Fetch chats
Declaration
Swift
public func chats(types: [QNChatRepository.ChatType], result: @escaping (Result<[QNChatRepository], ResourceError>) -> Void)Parameters
typesFilter by type (1-1 or group)
resultAsync result with a list of
Chat -
Join a specific group chat
Declaration
Swift
public func joinGroupChat(id: String, result: @escaping (Result<QNChatRepository, ResourceError>) -> Void)Parameters
idIdentifier of the chat to be joined
resultAsync result with the
Chat
QNChatsRepository Class Reference