Copilot SDK UI Reference Documentation
1. Integration Guide
1.1 Dependency Configuration
Please note the following configurations in your project's Podfile:
Set minimum iOS version to 12.0:
platform :ios, '12.0'
Add required SDK dependencies: ```ruby
Copilot SDK
pod 'SSCopilotSDK', :podspec => 'https://images.tuyacn.com/smart/app/package/developer/sdk/1739346083/SSCopilotSDK.podspec.json'
Copilot UI
pod 'SSCopilotUI', :podspec => 'https://images.tuyacn.com/smart/app/package/developer/sdk/1739346108/SSCopilotUI.podspec.json'
Charts
pod 'DGCharts', :podspec => 'https://images.tuyacn.com/smart/app/package/developer/sdk/1739346133/DGCharts.podspec.json'
WebView Container
pod 'ThingHybridContainer', :podspec => 'https://images.tuyacn.com/smart/app/package/developer/sdk/1739442578/ThingHybridContainer.podspec.json'
Calendar
pod "FSCalendar"
3. Dependencies to remove:
```ruby
# Please ensure to remove the following dependencies to avoid conflicts
# remove 'Charts'
# remove 'ThingSensorTHChartsModule'
Note:
- Make sure to remove Charts dependency and use DGCharts instead
- If your project uses ThingSensorTHChartsModule, it needs to be removed
- After modifying dependencies, run
pod install
to update project dependencies
1.2 Import Header File
#import <SSCopilotUI/CBCopilotManager+UI.h>
2. Page Navigation API
2.1 Copilot Related Pages
2.1.1 Get Copilot List Page
Method Name getCopilotListViewController
Return Value
- Returns a CBCopilotsViewController instance for displaying all available Copilots
Example
UIViewController *vc = [CBCopilotsManager getCopilotListViewController];
[self.navigationController pushViewController:vc animated:YES];
2.1.2 Navigate to Specific Copilot Page
Method Name viewControllerForCopilot
Parameters
- copilotInfo: Copilot configuration information
- historyAgents: List of historically used Copilots
- params: Additional parameters, may include:
- copilotId: Copilot ID
- copilotVersion: Copilot version number
- type: Type, can be "product" or "general"
- deviceId: Device ID (optional)
Return Value Returns different view controllers based on copilotInfo.uiType:
- General Chat: CBChatViewController
- Daily Message: CBDailyMessageViewController
- General Message: CBSubscriptionViewController
- Intrusion Message: CBVideoDetectionViewController
- General Describer: CBVideoToTextListViewController
Example
UIViewController *vc = [CBCopilotsManager viewControllerForCopilot:copilotInfo
historyAgents:historyList
params:@{
@"type": @"general",
@"deviceId": @"device_123"
}];
[self.navigationController pushViewController:vc animated:YES];
2.2 Product Related Pages
2.2.1 Get Products List Page
Method Name getProductsListViewController
Return Value
- Returns a CBServiceViewController instance for displaying all purchasable Products
Example
UIViewController *vc = [CBCopilotsManager getProductsListViewController];
[self.navigationController pushViewController:vc animated:YES];
2.2.2 Get Product Order List Page
Method Name getProductOrderListViewControllerWithServices
Parameters
- services: List of purchased services
Return Value
- Returns a CBPurchasedListViewController instance
Example
UIViewController *vc = [CBCopilotsManager getProductOrderListViewControllerWithServices:services];
[self.navigationController pushViewController:vc animated:YES];
2.2.3 Navigate to Product Web Detail Page
Method Name navigateToProductDetail
Parameters
- productId: Product ID
Example
[CBCopilotsManager navigateToProductDetail:@"product_123"];
2.2.4 Navigate to Purchased Products Page
Method Name navigateToPurchasedProducts
Parameters
- orderNo: Order number
Example
[CBCopilotsManager navigateToPurchasedProducts:@"order_456"];
2.2.5 Get View Controller Based on Product Information
Method Name viewControllerForProduct
Parameters
- serviceType: Service type
- UIType: UI type
- order: Order number
- copilotId: Copilot ID (optional)
- copilotVersion: Copilot version number (optional)
- resType: Resource type (optional)
- copilotSrc: Copilot source
- completion: Completion callback, returns corresponding view controller
Example
[CBCopilotsManager viewControllerForProduct:@(1)
UIType:@"chat"
order:@"order_123"
copilotId:nil
copilotVersion:nil
resType:nil
copilotSrc:@"source"
completion:^(UIViewController * _Nullable viewController) {
if (viewController) {
[self.navigationController pushViewController:viewController animated:YES];
}
}];
2.3 Message Related Pages
2.3.1 Get Message List Page
Method Name getMessageListViewController
Return Value
- Returns a CBMessageListViewController instance for displaying all Copilot-related messages
Example
UIViewController *vc = [CBCopilotsManager getMessageListViewController];
[self.navigationController pushViewController:vc animated:YES];
3. Important Notes
- Page Navigation
- All methods returning UIViewController need to use UINavigationController for page transitions
- navigateToProductDetail and navigateToPurchasedProducts methods will handle page navigation directly, no manual handling needed
- It is recommended to call these UI-related methods on the main thread