Methods

This document details the methods for controlling the chat.

Disable sending messages

You can disable the sending of any type of message. For example:

Copy
Copied
SinchChatSDK.shared.chat.advanced.disableSendingMessages()

var localizationConfig = SinchSDKConfig.LocalizationConfig.defaultValue
localizationConfig.disabledChatMessageText = "Sending messages is disabled"

let viewControler = try SinchChatSDK.shared.chat.getChatViewController(uiConfig: .defaultValue,
                                                                       localizationConfig: localizationConfig)

Enable sending messages

You can enable message sending. For example:

Copy
Copied
SinchChatSDK.shared.chat.advanced.enableSendingMessages()

Additional methods

These methods are optional; they are helpers if you want to ask for notifications in other places after starting the chat. Please don’t ask user for notifications at application start. This is a bad practice. Ask when you need it.

You may check push permission using our method:

Copy
Copied
SinchChatSDK.shared.push.checkPushPermission(completion: @escaping (SinchSDKNotificationStatus) -> Void)



// OR iOS 13+ with Combine

func checkPushPermission() -> AnyPublisher<SinchSDKNotificationStatus, Never>

You may ask for notification permission:

Copy
Copied
func askNotificationPermission(completion: @escaping (SinchSDKNotificationStatus) -> Void)



// OR iOS 13+ with Combine

func askNotificationPermission() -> AnyPublisher<SinchSDKNotificationStatus, Never>
We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.