sestek-webchat-ios
GIF 动画
CocoaPods 安装
仅限新安装
pod repo update
pod 'sestek-webchat-ios'
使用方法
如果支持语音消息功能,应将以下行添加到 Info.Plist 文件中,否则应用可能会崩溃。
<key>NSMicrophoneUsageDescription</key>
<string>Microphone permission text</string>
当点击位置信息时,应在 Info.Plist 文件中添加以下行,以便用户可以选择手机上安装的地图之一。
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
<string>yandexnavi</string>
</array>
在 AppDelegate.swift 中,只需导入 sestek_webchat_ios 框架,并初始化 SestekWebChat。
import sestek_webchat_ios
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let url = "https://nd-test-webchat.sestek.com/chathub"
let defaultConfiguration = DefaultConfiguration(clientId: "mobile-testing", tenant: "ArabBank", channel: "NdaInfoBip", project: "ArabBank", fullName: "Ömer Sezer", isVoiceRecordingEnabled: true)
let customConfiguration = CustomConfiguration(headerColor: .purple,
headerText: "Knovvu",
bottomColor: .black,
bottomInputText: "Bottom Input Text",
incomingIcon: .url(url: "https://upload.wikimedia.org/wikipedia/commons/7/70/User_icon_BLACK-01.png"),
incomingText: "User",
incomingTextColor: .black,
outgoingIcon: .image(image: UIImage()),
outgoingText: "Knovvu",
outgoingTextColor: .black,
messageColor: .black,
messageBoxColor: .white,
bodyColorOrImage: .color(color: .purple),
firstIcon: .image(image: UIImage()),
firstColor: .white,
firstSize: 70)
SestekWebChat.shared.initLibrary(url: url, defaultConfiguration: defaultConfiguration, customConfiguration: customConfiguration)
return true
}
}
可以通过 startConversation 方法启动对话。
SestekWebChat.shared.startConversation()
有关其他附加信息,我们已创建您可以在下表中使用的文档。
props | 类型 | 描述 |
---|---|---|
startConversation | void | 该函数启动用户聊天并自动触发模态屏幕。 |
endConversation | void | 该函数结束用户聊天并自动关闭模态屏幕。 |
isRoundedButtonVisible | bool | 属性将改变圆形按钮的可见性。 |
triggerVisible | void | 该函数在聊天开始后打开和关闭模态屏幕,并从上次 leave off 的位置继续对话。 |
messageList | [] | 返回活动聊天历史。 |
conversationStatus | bool | 指示是否存在活动对话。 |