Boomtown 产品支持平台 SDK for iOS
最低要求
- Xcode 11
- iOS 11.0
依赖项
- AFNetworking 4.0
- XMPPFramework 4.0
- SVProgressHUD
- TwilioVideo 4.4.0
- MTBBarcodeScanner
如果使用 CocoaPods,那么 Podfile 中包含这些依赖项。Support SDK 的 CocoaPod 可以在 https://cocoapods.org.cn/pods/SupportSDK 找到。
概览
SupportSDK 包含 SupportSDK
,这是一个 iOS 框架,用于 Boomtown 合作伙伴。它允许合作伙伴在单个 SupportButton
按钮中集成问题创建、通知和聊天。
开始使用
- 克隆此仓库
- 将
SupportSDK.framework
从 SDK 文件夹拖到Targets->General
下的Embedded Binaries
部分 - 在“添加文件选项”对话框中,确保“如有需要则复制项”被选中,并在“添加文件夹”旁边选择“创建分组”
获取配置信息
为了使聊天功能生效,SupportSDK 需要您在 Relay 中指定获取由手机配置器提供的配置 JSON 文件。下载的配置文件将如下所示:
{
"apiHost": "https://api.goboomtown.com",
"integrationId": "xxxxxxx",
"apiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"buttonURL":"https://api.goboomtown.com/resources/images/sdk_button.png",
"partnerToken": "xxxxxxxxxxxxx",
"privateKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
如果需要,可以重命名下载的配置文件,并将其拖入您的 Xcode 项目中。通过 loadConfigurationFile()
方法按名称加载此文件。
使用方式
注意:本仓库的 SupportSDK/Examples
文件夹中提供了 Objective-C 和 Swift 的示例代码。
Objective-C
@import SupportSDK;
// Create BTConnectHelp button and add it to view
SupportButton *supportButton = [[SupportButton alloc] initWithFrame:self.view.frame];
supportButton.delegate = self;
if ( ![supportButton loadConfigurationFile:@"support_sdk.json" customerId:nil] ) {
NSLog(@"Unable to load configuration file");
}
[self.view addSubview:supportButton];
Swift
import SupportSDK
let button = SupportButton(frame: self.subview.frame)
button.delegate = self;
if button.loadConfigurationFile("support_sdk.json", customerId:nil) == false {
NSLog("Unable to load configuration file")
}
self.view.addSubview(button)
服务器配置
SupportSDK 需要您指定获取由移动配置器提供的服务器配置 JSON 文件。下载的配置文件将如下所示
{
"apiHost": "https://api.goboomtown.com",
"integrationId": "xxxxxx",
"apiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"buttonURL":"https://api.goboomtown.com/resources/images/sdk_button.png",
"partnerToken": "xxxxxxxx",
"privateKey": "xxxxxxxxxxxxxxxxxxxxx"
}
此文件允许与服务器通信并配置可用功能。
菜单样式
菜单样式在外观 JSON 的菜单外观部分中配置,如下所示
"menuAppearance":
{
"style": "iconlist",
...
}
样式值可以是以下之一
"nomenu"
"menu"
"button"
"iconlist"
"iconlistexit"
如果没有设置值,则默认为 iconlist。
客户配置
如果需要,可以通过提供以下键的值来识别客户
CustomerId : "members_id",
CustomerExternalId: "members_external_id",
CustomerLocationId: "members_locations_id",
CustomerLocationExternalId: "members_locations_external_id",
CustomerLocationMid: "members_locations_mid",
UserId: "members_users_id",
UserExternalId: "members_users_external_id",
UserEmail: "members_users_email",
UserPhone: "members_users_phone",
如下所示
var customerJSON = {
"members_users_email": "[email protected]"
};
外观配置
很多应用程序功能(菜单、图标、颜色等)都可以使用以下 JSON 文件进行配置
这是默认的 JSON。
{
"navigationBarAppearance":
{
"textColor": "#000000",
"backgroundColor": "#ffffff",
"iconColor": "#000000"
},
"menuAppearance":
{
"style": "iconlist",
"heading": "Support",
"textSize": "20",
"textStyle": "bold",
"borderWidth": "1",
"padding": "10",
"spacing": "20",
"textColor": "#000000",
"iconColor": "#EF5E0D",
"borderColor": "#E0E0E0",
"textColorDark": "#ffffff",
"iconColorDark": "#EF5E0D",
"borderColorDark": "#E0E0E0"
},
"menu":
{
"chat": {
"text": "Chat with Us",
"icon": "a_chat"
},
"callme":
{
"text": "Call Me",
"icon": "phone_call"
},
"knowledge":
{
"text": "Search Knowledge",
"icon": "book_bookmark"
},
"web":
{
"text": "Web Support",
"icon": "globe"
},
"email":
{
"text": "Email Support",
"icon": "letter"
},
"phone":
{
"text": "Phone Support",
"icon": "phone"
},
"forms":
{
"text": "Forms",
"icon": "form"
},
"history":
{
"text": "History",
"icon": "customer_alt"
},
"exit":
{
"text": "Exit"
}
},
"icons":
{
"kbFolderIcon": "book-bookmark",
"chatAttachmentButtonImage": "paperclip.png",
"chatSendButtonImage": "send.png"
},
"colors":
{
"navigationBarColor": "#f2f2f2",
"iconColor": "#EF5E0D",
"buttonColor": "#EF5E0D",
"lineColor": "#E0E0E0",
"textColor": "#4F4F4F",
"textColorDark": "#ffffff",
"homeIconColor": "#EF5E0D",
"homeLineColor": "#E0E0E0",
"homeTextColor": "#007AFF",
"homeSelectedColor": "#EBEBEB",
"callMeHeaderTextColor": "#4F4F4F",
"callMeLabelTextColor": "#626363",
"callMeHintTextColor": "#ACACAC",
"callMeButtonTextColor": "#ACACAC",
"callMeButtonBackgroundColor": "#1AA8A8",
"ratingHeaderTextColor": "#4F4F4F",
"ratingLabelTextColor": "#626363",
"ratingHintTextColor": "#ACACAC",
"ratingButtonTextColor": "#ACACAC",
"ratingButtonBackgroundColor": "#1AA8A8",
"chatRefidTextColor": "#4f4f4f",
"chatNavBarColor": "#f2f2f2",
"chatSendButtonEnabledColor": "#626363",
"chatSendButtonDisabledColor": "#ACACAC",
"chatTimeStampColor": "#ACACAC",
"chatActionButtonTextColor": "#838383",
"chatActionButtonSelectedTextColor": "#ffffff",
"chatActionButtonBorderColor": "#E0E0E0",
"chatIconColor": "#838383",
"kbFolderNameTextColor": "#303030",
"kbFolderL0BackgroundColor": "#F3F8F8",
"kbTextColor": "#303030",
"menuBorderColor": "#E0E0E0"
},
"formAppearance":
{
"cancelButtonText": "Cancel",
"saveButtonText": "Save",
"label":
{
"textStyle": "bold",
"textSize": "20",
"textColor": "#000000",
"textColorDark": "#ffffff",
"requiredTextColor": "#000000",
"requiredTextColorDark": "#ffffff",
"requiredIndicatorColor": "#cc0000",
"requiredIndicatorColorDark": "#cc0000"
},
"entry":
{
"textStyle": "bold",
"textSize": "20",
"textColor": "#000000",
"textColorDark": "#ffffff",
"borderColor": "#000000",
"borderColorDark": "#ffffff",
"borderWidth": "1"
}
}
}
如果您只想配置颜色主题,则只需设置以下颜色
iconColor
buttonColor
lineColor
textColor
textColorDark
致谢
SupportSDK 使用了各种开源库,并感谢开源社区的贡献。
为了帮助您承认我们使用过的开源库,我们在存储库的根目录中包含了两个文件
Acknowledgements.md
是一个 Markdown 文件,您可以根据需要使用。Acknowledgements.plist
是一个用于设置包的 Apple PLIST 文件。