Код: Выделить всё
let preChatValue = "myValue"
let preChatKey = "Somename"
let config = UIConfiguration(serviceAPI: serviceAPIURL,
organizationId: organizationId,
developerName: developerName,
conversationId: conversationId)
let coreClient = CoreFactory.create(withConfig: config)
let myPreChatDelegate = HiddenPrechatDelegateImplementation(preChatValue: preChatValue, preChatKey: preChatKey)
coreClient.preChatDelegate = myPreChatDelegate
// Need to add some code to add preChatField with name(preChatKey) and value (preChatValue)
< /code>
hiddenprechatdelegateimplementation < /h1>
import Foundation
import SMIClientCore // Import the Salesforce SDK; you need to confirm the correct module name.
class HiddenPrechatDelegateImplementation: HiddenPreChatDelegate {
var preChatValue: String
var preChatKey: String
init(preChatValue: String, preChatKey: String) {
self.preChatValue = preChatValue
self.preChatKey = preChatKey
}
func core(_ core: CoreClient,
conversation: Conversation,
didRequestPrechatValues hiddenPreChatFields: [HiddenPreChatField],
completionHandler: HiddenPreChatValueCompletion) {
// Use the conversation object to inspect info about the conversation
// Pass pre-chat fields back to SDK
completionHandler(hiddenPreChatFields)
}
}
Repo: https://github.com/salesforce-async-messaging
Я попытался установить поле PreChat из Swift Code (iOS Swift)
Подробнее здесь: https://stackoverflow.com/questions/783 ... elds-and-h