ChatEngine
@objc(ZDKChatEngine)
public final class ChatEngine : NSObject, Engine, Loggable, NotificationCenterObserver
extension ChatEngine: MessagingAPI.Observable
ChatEngine
is the access point for the UI of the Chat SDK. It is the ChatEngine.
-
Product Identifier
Declaration
Swift
@objc public let id: String
-
Information describing the
Engine
Declaration
Swift
public let transferOptionDescription: TransferOptionDescription
-
Declaration
Swift
public var onUpdate: ([ObservableIdentifier : (Update) -> Void])
-
Allows the Messaging SDK to see if there’s a conversation on-going.
Declaration
Swift
@objc public func isConversationOngoing(_ completion: @escaping (Bool) -> Void)
-
Initialize the ChatEngine
Throws
ChatError.chatIsNotInitialized
error, if Chat was not previously initializedDeclaration
Swift
@objc public static func engine() throws -> ChatEngine
-
This method is called when the end-user omits an event. The Chat engine will then decide how to handle this event.
Warning
This method needs to be exposed for the MessagingSDK, and should not be invoked by integratorsDeclaration
Swift
public func onEvent(_ event: Event)
Parameters
event
An event that is emitted by an end-user action.
-
Notifies the engine to start taking over the support process.
Declaration
Swift
public func start(messagingAPI: MessagingAPIProtocol)
-
MessagingSDK calls this when the current session ends.
Declaration
Swift
public func stop()
-
Allows Messaging SDK to listen to updates emitted bytthe Chat Engine
Warning
This method needs to be exposed for theMessagingSDK
to work as expected, and should not be invoked by integrators. Be careful not to callcancel()
on theObservationToken
associated with this subscription.Declaration
Swift
public func observeUpdates(_ completion: @escaping (Update) -> Void) -> MessagingAPI.ObservationToken
Parameters
completion
Block that is invoked everytime there is an update from the engine.
Return Value
An
ObservationToken
that can cancel the subscription to the EngineUpdateEvents
.