@tencentcloud/sdk-mcp 1.7.2 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +25 -17
- package/knowledge/bm25.js +20 -11
- package/knowledge/path-meta.js +23 -1
- package/knowledge/search/generic-rerank.js +123 -0
- package/knowledge/search/search-pass.js +8 -1
- package/package.json +1 -1
- package/resource/_schema/query-normalization.yaml +6 -0
- package/resource/index/manifest.json +1 -1
- package/resource/integration/callkit/preset/android/integration.md +4 -0
- package/resource/integration/callkit/preset/flutter/integration.md +4 -0
- package/resource/integration/callkit/preset/ios/integration.md +14 -13
- package/resource/integration/callkit/preset/vue/integration.md +0 -3
- package/resource/integration/chat/preset/android/integration.md +35 -173
- package/resource/integration/chat/preset/flutter/integration.md +113 -220
- package/resource/integration/chat/preset/ios/integration.md +2 -269
- package/resource/integration/chat/preset/react/integration.md +27 -1
- package/resource/integration/chat/preset/uni-app/integration.md +5 -1
- package/resource/integration/chat/preset/vue/integration.md +21 -31
- package/resource/integration/livekit/preset/live/android/live-host-integration.md +4 -0
- package/resource/integration/livekit/preset/live/ios/live-host-integration.md +4 -0
- package/resource/integration/livekit/preset/live/vue/live-list-integration.md +3 -4
- package/resource/integration/livekit/preset/live/vue/live-player-desk-integration.md +0 -1
- package/resource/integration/livekit/preset/live/vue/live-player-h5-integration.md +0 -1
- package/resource/integration/livekit/preset/live/vue/live-pusher-integration.md +4 -9
- package/resource/integration/roomkit/preset/vue/integration.md +0 -213
- package/resource/knowledge/callkit/best-practice/android/video-chat-dating.md +490 -0
- package/resource/knowledge/callkit/best-practice/flutter/android-keep-call-alive-background.md +79 -0
- package/resource/knowledge/callkit/best-practice/flutter/background-incoming-call-no-notification.md +99 -0
- package/resource/knowledge/callkit/best-practice/flutter/ios-keep-call-alive-background.md +93 -0
- package/resource/knowledge/callkit/best-practice/flutter/ios-startup-crash-version-voip.md +68 -0
- package/resource/knowledge/callkit/core-sdk/flutter/offline-push.md +1 -1
- package/resource/knowledge/callkit/core-sdk/ios/answer-call.md +9 -7
- package/resource/knowledge/callkit/core-sdk/ios/make-call.md +10 -7
- package/resource/knowledge/callkit/core-sdk/ios/offline-push.md +1 -1
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-engine.md +19 -19
- package/resource/knowledge/callkit/core-sdk/miniprogram/call-event.md +16 -16
- package/resource/knowledge/callkit/core-sdk/uni-app/answer-call.md +0 -84
- package/resource/knowledge/callkit/core-sdk/uni-app/make-call.md +0 -102
- package/resource/knowledge/callkit/core-sdk/web/call-event.md +2 -2
- package/resource/knowledge/callkit/faq/error-code.md +62 -36
- package/resource/knowledge/callkit/faq/uniapp-miniprogram.md +1 -1
- package/resource/knowledge/callkit/preset/android/api.md +10 -10
- package/resource/knowledge/callkit/preset/harmonyos/api.md +362 -0
- package/resource/knowledge/callkit/preset/harmonyos/integration.md +322 -0
- package/resource/knowledge/callkit/preset/ios/api.md +9 -9
- package/resource/knowledge/callkit/preset/miniprogram/api-uniapp.md +293 -0
- package/resource/knowledge/callkit/preset/miniprogram/api.md +19 -19
- package/resource/knowledge/callkit/preset/miniprogram/integration.md +292 -0
- package/resource/knowledge/callkit/preset/miniprogram/uniapp-integration.md +521 -0
- package/resource/knowledge/callkit/preset/uni-app/api.md +49 -0
- package/resource/knowledge/callkit/preset/uni-app/integration.md +353 -0
- package/resource/knowledge/chat/best-practice/common/web-sdk-log-level.md +76 -0
- package/resource/knowledge/chat/best-practice/miniprogram/desktop-wechat-miniprogram-error.md +79 -0
- package/resource/knowledge/chat/best-practice/miniprogram/login-timeout-2801-diagnosis.md +1 -1
- package/resource/knowledge/chat/preset/android-view/integration.md +84 -124
- package/resource/knowledge/chat/preset/ios/features/language.md +5 -5
- package/resource/knowledge/chat/preset/ios-uikit/integration.md +184 -923
- package/resource/knowledge/chat/preset/react/features/search.md +9 -214
- package/resource/knowledge/chat/preset/react/h5/integration.md +965 -0
- package/resource/knowledge/chat/preset/vue/features/chat-header.md +0 -36
- package/resource/knowledge/chat/preset/vue/features/contact-list.md +0 -34
- package/resource/knowledge/chat/preset/vue/features/conversation-list.md +0 -39
- package/resource/knowledge/chat/preset/vue/features/conversation-preview.md +0 -74
- package/resource/knowledge/chat/preset/vue/features/search.md +9 -790
- package/resource/knowledge/chat/preset/vue/h5/integration.md +724 -0
- package/resource/knowledge/livekit/core-sdk/features/uni-app/live-list.md +0 -167
- package/resource/knowledge/livekit/core-sdk/live/android/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/android/host-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/flutter/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/flutter/host-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/flutter/integration.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/ios/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/ios/host-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/live/ios/integration.md +2 -2
- package/resource/knowledge/livekit/core-sdk/live/uni-app/co-guest-interaction.md +1 -66
- package/resource/knowledge/livekit/core-sdk/live/uni-app/host-interaction.md +1 -66
- package/resource/knowledge/livekit/core-sdk/live/uni-app/integration.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/android/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/android/host-interaction.md +2 -2
- package/resource/knowledge/livekit/core-sdk/voice/flutter/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/ios/co-guest-interaction.md +1 -1
- package/resource/knowledge/livekit/core-sdk/voice/ios/host-interaction.md +2 -2
- package/resource/knowledge/livekit/core-sdk/voice/uni-app/integration.md +2 -2
- package/resource/knowledge/livekit/preset/live/vue/features/barrage.md +1 -24
- package/resource/knowledge/livekit/preset/live/vue/features/live-audience-list.md +0 -3
- package/resource/knowledge/livekit/preset/live/vue/features/live-view.md +0 -5
- package/resource/knowledge/push/api-reference/harmonyos.md +9 -9
- package/resource/knowledge/push/api-reference/unity.md +10 -10
- package/resource/knowledge/push/api-reference/unreal-engine.md +11 -11
- package/resource/knowledge/push/config/android/fcm.md +2 -6
- package/resource/knowledge/push/integration/android.md +824 -428
- package/resource/knowledge/push/integration/donut.md +57 -74
- package/resource/knowledge/push/integration/flutter.md +208 -63
- package/resource/knowledge/push/integration/harmonyos.md +6 -11
- package/resource/knowledge/push/integration/ios.md +44 -99
- package/resource/knowledge/push/integration/react-native.md +3 -2
- package/resource/knowledge/push/integration/uni-app.md +29 -107
- package/resource/knowledge/push/integration/unity.md +3 -2
- package/resource/knowledge/push/integration/unreal-engine.md +4 -3
- package/resource/knowledge/roomkit/best-practice/vue/screen-share-auto-stop-on-leave.md +62 -0
- package/resource/knowledge/roomkit/core-sdk/android/room-state.md +3 -3
- package/resource/knowledge/roomkit/core-sdk/android/schedule-room.md +4 -4
- package/resource/knowledge/roomkit/core-sdk/flutter/room-state.md +2 -2
- package/resource/knowledge/roomkit/core-sdk/flutter/schedule-room.md +4 -4
- package/resource/knowledge/roomkit/core-sdk/ios/room-state.md +3 -3
- package/resource/knowledge/roomkit/core-sdk/ios/schedule-room.md +4 -4
- package/resource/knowledge/roomkit/core-sdk/react/network-proxy.md +84 -0
- package/resource/knowledge/roomkit/core-sdk/vue/device-detection.md +0 -9
- package/resource/knowledge/roomkit/core-sdk/vue/free-beauty-panel.md +0 -9
- package/resource/knowledge/roomkit/core-sdk/vue/network-proxy.md +84 -0
- package/resource/knowledge/roomkit/core-sdk/vue/recording.md +245 -0
- package/resource/knowledge/roomkit/core-sdk/vue/room-chat.md +0 -3
- package/resource/knowledge/roomkit/core-sdk/vue/room-view.md +0 -16
- package/resource/knowledge/roomkit/core-sdk/vue/schedule-room.md +0 -3
- package/resource/knowledge/roomkit/core-sdk/vue/virtual-background.md +0 -3
- package/resource/knowledge/roomkit/core-sdk/vue/whiteboard-annotation.md +181 -0
- package/resource/knowledge/roomkit/faq/error-code.md +103 -0
- package/resource/knowledge/roomkit/preset/android/integration.md +1 -202
- package/resource/knowledge/roomkit/preset/flutter/integration.md +13 -13
- package/resource/knowledge/roomkit/preset/harmonyos/integration.md +465 -0
- package/resource/knowledge/roomkit/preset/ios/integration.md +0 -201
- package/resource/knowledge/roomkit/preset/react/features/network-proxy.md +80 -0
- package/resource/knowledge/roomkit/preset/react/integration.md +0 -202
- package/resource/knowledge/roomkit/preset/uniapp-app/integration.md +279 -0
- package/resource/knowledge/roomkit/preset/vue/features/ai-caption-translation.md +69 -0
- package/resource/knowledge/roomkit/preset/vue/features/ai-denoiser.md +67 -0
- package/resource/knowledge/roomkit/preset/vue/features/network-proxy.md +80 -0
- package/resource/knowledge/roomkit/preset/vue/features/recording.md +85 -0
- package/resource/knowledge/roomkit/preset/vue/features/whiteboard-annotation.md +86 -0
- package/resource/knowledge/rtcengine/web/plugin/42-advanced-realtime-transcriber.md +25 -6
- package/server.js +1 -1
- package/utils/preflight-route.js +18 -6
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
|
@@ -253,6 +253,10 @@ TUICallKit.createInstance(this).calls(userIdList, mediaType, params, new Complet
|
|
|
253
253
|
|
|
254
254
|
接听端完成登录后,拨打端发起通话,接收端就可以收到通话邀请,同时伴随铃声和振动。
|
|
255
255
|
|
|
256
|
+
## AI 助手:知识咨询与代码集成
|
|
257
|
+
|
|
258
|
+
您在接入视频通话 SDK 过程中,可以通过 MCP 使用 AI 助手,快速完成知识咨询、报错排查和集成代码生成。支持 Web/Android/iOS/Flutter/uni-app/HarmonyOS 等平台,答案基于官方文档。适用于查询 CallKit 组件和无 UI SDK 用法以及集成文档等场景,[立即体验,提出您的第一个问题](https://cloud.tencent.com/document/product/647/129285)。
|
|
259
|
+
|
|
256
260
|
## 更多功能
|
|
257
261
|
|
|
258
262
|
### AI 转录与翻译
|
|
@@ -205,6 +205,10 @@ void _call() {
|
|
|
205
205
|
|
|
206
206
|
接听端完成登录后,拨打端发起通话,接听端就可以收到通话邀请,同时伴随铃声和振动。
|
|
207
207
|
|
|
208
|
+
## AI 助手:知识咨询与代码集成
|
|
209
|
+
|
|
210
|
+
您在接入视频通话 SDK 过程中,可以通过 MCP 使用 AI 助手,快速完成知识咨询、报错排查和集成代码生成。支持 Web/Android/iOS/Flutter/uni-app/HarmonyOS 等平台,答案基于官方文档。适用于查询 CallKit 组件和无 UI SDK 用法以及集成文档等场景,[立即体验,提出您的第一个问题](https://cloud.tencent.com/document/product/647/129285)。
|
|
211
|
+
|
|
208
212
|
## 更多功能
|
|
209
213
|
|
|
210
214
|
### AI 转录与翻译
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
本文将介绍如何快速接入 TUICallKit 组件。您可以在 10 分钟内完成以下关键步骤,最终获得一个功能完备的音视频通话界面。
|
|
2
2
|
|
|
3
|
-
## AI接入
|
|
4
|
-
|
|
5
|
-
本接入文档已通过 **CodeBuddy** 的工程化验证,完全适配 **MCP (Model Context Protocol)** 协议。如需通过 AI 辅助接入,
|
|
6
|
-
|
|
7
|
-
“您现在是一名资深的 iOS 开发专家。请基于本文档,协助我在现有的 iOS 项目中接入音视频通话功能。”
|
|
8
|
-
|
|
9
3
|
## 准备工作
|
|
10
4
|
|
|
11
5
|
### 环境要求
|
|
@@ -152,15 +146,16 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau
|
|
|
152
146
|
import TUICallKit_Swift
|
|
153
147
|
import AtomicXCore
|
|
154
148
|
|
|
155
|
-
TUICallKit.createInstance().setSelfInfo(nickname: "jack", avatar: "https
|
|
149
|
+
TUICallKit.createInstance().setSelfInfo(nickname: "jack", avatar: "https://****/user_avatar.png", completion: { result in
|
|
156
150
|
switch result {
|
|
157
151
|
case .success:
|
|
158
|
-
|
|
152
|
+
print("setSelfInfo success")
|
|
159
153
|
case .failure(let error):
|
|
160
|
-
|
|
154
|
+
print("setSelfInfo failed: \(error)")
|
|
155
|
+
@unknown default:
|
|
156
|
+
break
|
|
161
157
|
}
|
|
162
158
|
})
|
|
163
|
-
|
|
164
159
|
```
|
|
165
160
|
|
|
166
161
|
|参数|类型|说明|
|
|
@@ -185,11 +180,13 @@ import AtomicXCore
|
|
|
185
180
|
TUICallKit.createInstance().calls(userIdList: ["mike"], mediaType: .audio, params: nil, completion: { result in
|
|
186
181
|
switch result {
|
|
187
182
|
case .success:
|
|
188
|
-
|
|
183
|
+
print("calls success")
|
|
189
184
|
case .failure(let error):
|
|
190
|
-
|
|
185
|
+
print("calls failed: \(error)")
|
|
186
|
+
@unknown default:
|
|
187
|
+
break
|
|
191
188
|
}
|
|
192
|
-
}
|
|
189
|
+
})
|
|
193
190
|
```
|
|
194
191
|
|
|
195
192
|
|参数|类型|说明|
|
|
@@ -203,6 +200,10 @@ TUICallKit.createInstance().calls(userIdList: ["mike"], mediaType: .audio, param
|
|
|
203
200
|
|
|
204
201
|
接听端完成登录后,拨打端发起通话,接听端就可以收到通话邀请,同时伴随铃声和振动。
|
|
205
202
|
|
|
203
|
+
## AI 助手:知识咨询与代码集成
|
|
204
|
+
|
|
205
|
+
您在接入视频通话 SDK 过程中,可以通过 MCP 使用 AI 助手,快速完成知识咨询、报错排查和集成代码生成。支持 Web/Android/iOS/Flutter/uni-app/HarmonyOS 等平台,答案基于官方文档。适用于查询 CallKit 组件和无 UI SDK 用法以及集成文档等场景,[立即体验,提出您的第一个问题](https://cloud.tencent.com/document/product/647/129285)。
|
|
206
|
+
|
|
206
207
|
## 更多功能
|
|
207
208
|
|
|
208
209
|
### AI 转录与翻译
|
|
@@ -173,9 +173,6 @@ const init = async () => {
|
|
|
173
173
|
}
|
|
174
174
|
</script>
|
|
175
175
|
|
|
176
|
-
<style scoped>
|
|
177
|
-
.demo-wrapper { max-width: 680px; margin: 40px auto; padding: 0 20px; font-family: system-ui, -apple-system, sans-serif; } .demo-card { background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); padding: 32px; margin-bottom: 24px; } .demo-title { margin: 0 0 28px; font-size: 22px; font-weight: 600; color: #1a1a2e; text-align: center; } .form-row { margin-bottom: 18px; } .form-row:last-of-type { margin-bottom: 0; } .form-label { display: block; font-size: 14px; font-weight: 600; color: #6b7280; letter-spacing: 0.5px; margin-bottom: 8px; } .form-controls { display: flex; gap: 10px; } .form-input { flex: 1; height: 42px; padding: 0 14px; border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 15px; color: #1a1a2e; background: #fafafa; outline: none; transition: border-color .2s, box-shadow .2s; } .form-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); background: #fff; } .form-input::placeholder { color: #c0c4cc; } .btn { height: 42px; padding: 0 20px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform .15s, box-shadow .2s, background .2s; } .btn:active { transform: scale(0.97); } .btn-primary { background: linear-gradient(135deg, #6366f1, #818cf8); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,0.3); } .btn-primary:hover { background: linear-gradient(135deg, #4f46e5, #6366f1); box-shadow: 0 4px 14px rgba(99,102,241,0.4); } .btn-success { background: linear-gradient(135deg, #10b981, #34d399); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,0.3); } .btn-success:hover { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 4px 14px rgba(16,185,129,0.4); } .callkit-area { background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); overflow: hidden; }
|
|
178
|
-
</style>
|
|
179
176
|
```
|
|
180
177
|
|
|
181
178
|
【Vue2.7】
|
|
@@ -39,38 +39,42 @@ TUIKit Compose 提供了一套完整的即时通信 UI 组件,向下依赖 Ato
|
|
|
39
39
|
|
|
40
40
|
## 集成并引入组件
|
|
41
41
|
|
|
42
|
+
> **说明:**
|
|
43
|
+
> Demo:IM 提供在 [CNB](https://cnb.cool/tencent/cloud/trtc/TUIKit_Android_Compose) 及 [GitHub](https://github.com/Tencent-RTC/TUIKit_Android_Compose) 上提供即时通信完整 Demo,您可以 5 分钟跑通聊天、音视频通话全功能,开箱即用。
|
|
44
|
+
>
|
|
45
|
+
|
|
42
46
|
### 下载源码
|
|
43
|
-
1. 从 GitHub 下载 [TUIKit Compose](https://github.com/Tencent-RTC/TUIKit_android_compose) 源码:
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
从 CNB 下载 [TUIKit Compose](https://cnb.cool/tencent/cloud/trtc/TUIKit_Android_Compose) 源码或者 GitHub 下载 [TUIKit Compose](https://github.com/Tencent-RTC/TUIKit_Android_Compose) 源码:
|
|
49
|
+
``` java
|
|
50
|
+
git clone https://cnb.cool/tencent/cloud/trtc/TUIKit_Android_Compose
|
|
51
|
+
// 或者 git clone https://github.com/Tencent-RTC/TUIKit_Android_Compose.git
|
|
52
|
+
```
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
├──
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
├──
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```
|
|
54
|
+
项目目录结构说明:
|
|
55
|
+
``` bash
|
|
56
|
+
atomic-x/
|
|
57
|
+
├── src/main/
|
|
58
|
+
│ ├── java/io/trtc/tuikit/atomicx/ # UI 组件源码(必需集成)
|
|
59
|
+
│ ├── messagelist/ # 消息列表组件
|
|
60
|
+
│ ├── messageinput/ # 消息输入组件
|
|
61
|
+
│ ├── conversationlist/ # 会话列表组件
|
|
62
|
+
│ ├── contactlist/ # 联系人列表组件
|
|
63
|
+
│ ├── basecomponent/ # 基础组件
|
|
64
|
+
│ └── ... # 其他 UI 组件
|
|
65
|
+
│ # 资源文件(必需集成)
|
|
66
|
+
│ ├── res/ # 公共资源
|
|
67
|
+
│ ├── res-message-list/ # 消息列表组件资源
|
|
68
|
+
│ ├── res-message-input/ # 消息输入组件资源
|
|
69
|
+
│ ├── res-conversation-list/ # 会话列表组件资源
|
|
70
|
+
│ └── ... # 其他组件资源
|
|
71
|
+
chat/
|
|
72
|
+
├── uikit/src/main/java/io/trtc/tuikit/chat/pages # Page 组件(参考实现)
|
|
73
|
+
│ ├── ChatPage.kt
|
|
74
|
+
│ ├── ContactsPage.kt
|
|
75
|
+
│ └── ConversationsPage.kt
|
|
76
|
+
└── demo/ # 示例应用(可选参考)
|
|
77
|
+
```
|
|
74
78
|
|
|
75
79
|
### 集成组件
|
|
76
80
|
|
|
@@ -261,46 +265,7 @@ LoginStore.shared.login(context, SDKAPPID, userID, userSig,
|
|
|
261
265
|
> 在正式的生产环境中,请在您的服务端生成 UserSig,在需要 UserSig 时由您的 App 向业务服务器发起请求获取动态 UserSig 来进行鉴权。详见 [服务端生成 UserSig](https://cloud.tencent.com/document/product/269/32688)。
|
|
262
266
|
>
|
|
263
267
|
|
|
264
|
-
### 步骤3
|
|
265
|
-
|
|
266
|
-
您可以基于 TUIKit Compose 中的 ConversationList 组件,构建一个会话列表页面。ConversationList 内建的功能是:
|
|
267
|
-
- 展示用户的会话列表,包含单聊和群聊会话
|
|
268
|
-
|
|
269
|
-
- 支持用户操作单个会话:置顶、删除、清空会话消息等
|
|
270
|
-
|
|
271
|
-
将 ConversationList 封装为会话列表页,可参考 `chat/uikit/src/main/java/io/trtc/tuikit/chat/pages/ConversationsPage.kt` 文件里的实现,`ConversationsPage` 主要做了以下工作:
|
|
272
|
-
|
|
273
|
-
1. 在 ConversationList 上方添加了 headerView。
|
|
274
|
-
|
|
275
|
-
2. 传递点击会话列表 cell 事件。
|
|
276
|
-
|
|
277
|
-
核心示例代码如下所示:
|
|
278
|
-
|
|
279
|
-
``` swift
|
|
280
|
-
@Composable
|
|
281
|
-
fun ConversationsPage(
|
|
282
|
-
onConversationClick: (ConversationInfo) -> Unit = {},
|
|
283
|
-
editContent: @Composable () -> Unit = {},
|
|
284
|
-
) {
|
|
285
|
-
val colors = LocalTheme.current.colors
|
|
286
|
-
Column(
|
|
287
|
-
modifier = Modifier
|
|
288
|
-
.fillMaxSize()
|
|
289
|
-
.background(Colors.Transparent)
|
|
290
|
-
) {
|
|
291
|
-
|
|
292
|
-
PageHeader(stringResource(R.string.chat_uikit_chat)) {
|
|
293
|
-
editContent()
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
|
297
|
-
ConversationList(modifier = Modifier.navigationBarsPadding(), onConversationClick = onConversationClick)
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### 步骤4:构建聊天界面
|
|
268
|
+
### 步骤3:构建聊天界面
|
|
304
269
|
|
|
305
270
|
您可以基于 TUIKit Compose 中的 MessageList、MessageInput 组件,构建一个聊天页面。
|
|
306
271
|
|
|
@@ -378,112 +343,10 @@ MessageList 内建的功能是:
|
|
|
378
343
|
}
|
|
379
344
|
```
|
|
380
345
|
|
|
381
|
-
### 步骤
|
|
382
|
-
|
|
383
|
-
您可以基于 TUIKit Compose 中的 ContactList 组件,构建一个联系人页面。ContactList 内建的功能是:
|
|
384
|
-
- 查看好友申请列表。
|
|
385
|
-
|
|
386
|
-
- 查看已加入的群列表。
|
|
387
|
-
|
|
388
|
-
- 处理群组邀请和申请。
|
|
389
|
-
|
|
390
|
-
- 管理黑名单列表。
|
|
391
|
-
|
|
392
|
-
- 查看好友。
|
|
393
|
-
|
|
394
|
-
将 ContactList 封装为联系人列表页,可参考 `chat/uikit/src/main/java/io/trtc/tuikit/chat/pages/ContactsPage.kt` 文件里的实现,`ContactsPage` 主要做了以下工作:
|
|
395
|
-
|
|
396
|
-
1. 在 ContactList 上方添加了 headerView。
|
|
397
|
-
|
|
398
|
-
2. 传递点击联系人列表 cell 事件。
|
|
399
|
-
|
|
400
|
-
核心示例代码如下所示:
|
|
401
|
-
|
|
402
|
-
``` swift
|
|
403
|
-
@Composable
|
|
404
|
-
fun ContactsPage(
|
|
405
|
-
onContactClick: (ContactInfo) -> Unit = {},
|
|
406
|
-
onGroupClick: (ContactInfo) -> Unit = {},
|
|
407
|
-
editContent: @Composable () -> Unit = {},
|
|
408
|
-
) {
|
|
409
|
-
|
|
410
|
-
val colors = LocalTheme.current.colors
|
|
411
|
-
Column(
|
|
412
|
-
modifier = Modifier
|
|
413
|
-
.fillMaxSize()
|
|
414
|
-
.background(Colors.Transparent)
|
|
415
|
-
) {
|
|
416
|
-
PageHeader(stringResource(R.string.chat_uikit_contacts)) {
|
|
417
|
-
editContent()
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
Box(
|
|
421
|
-
modifier = Modifier
|
|
422
|
-
.fillMaxSize()
|
|
423
|
-
.navigationBarsPadding(), contentAlignment = Alignment.Center
|
|
424
|
-
) {
|
|
425
|
-
ContactList(onGroupClick = onGroupClick, onContactClick = onContactClick)
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
### 步骤6:完善界面间的跳转逻辑
|
|
432
|
-
|
|
433
|
-
ConversationsPage、ChatPage、ContactsPage 中暴露了一些用户点击事件,您可以自定义事件来实现页面间的交互:
|
|
434
|
-
| Page | 回调 | 建议跳转逻辑 |
|
|
435
|
-
| --- | --- | --- |
|
|
436
|
-
| <strong>ConversationsPage</strong> | <code>onConversationClick: (ConversationInfo) -> Unit</code> | 点击会话列表中的会话时触发,建议跳转到聊天页面(ChatPage)。 |
|
|
437
|
-
| <strong>ContactsPage</strong> | <code>onContactClick: (ContactInfo) -> Unit</code> | 点击联系人 cell 时触发,建议跳转用户信息页(C2CChatSetting)。 |
|
|
438
|
-
| <code>onGroupClick: (ContactInfo) -> Unit</code> | 点击群组 cell 时触发,建议跳转群聊页面(ChatPage)。 | |
|
|
439
|
-
| <strong>ChatPage</strong> | <code>onUserClick: (String) -> Unit</code> | 点击消息中的用户头像或昵称时触发,建议跳转用户信息页(C2CChatSetting)。 |
|
|
440
|
-
| <code>onChatHeaderClick: (String) -> Unit</code> | 点击导航栏中的头像时触发,建议跳转用户信息页(C2CChatSetting)或群聊信息页(GroupChatSetting) | |
|
|
441
|
-
| <code>onBackClick: () -> Unit</code> | 点击返回按钮时触发,建议返回上一级页面。 | |
|
|
442
|
-
|
|
443
|
-
**chat/demo/app/src/main/java/io/trtc/tuikit/chat/MainActivity.kt** 和 **chat/demo/app/src/main/java/io/trtc/tuikit/chat/chat/ChatActivity.kt** 作为上述 Page 的粘合层,实现了各个 Page 的回调事件,核心示例代码如下:
|
|
444
|
-
``` java
|
|
445
|
-
// chat/demo/app/src/main/java/io/trtc/tuikit/chat/MainActivity.kt
|
|
446
|
-
|
|
447
|
-
// 点击会话列表 cell 跳转
|
|
448
|
-
ConversationsPage(onConversationClick = {
|
|
449
|
-
activity?.startActivity(
|
|
450
|
-
Intent(activity, ChatActivity::class.java).apply {
|
|
451
|
-
putExtra("conversationID", it.conversationID)
|
|
452
|
-
}
|
|
453
|
-
)
|
|
454
|
-
})
|
|
455
|
-
|
|
456
|
-
// 点击联系人页面跳转
|
|
457
|
-
ContactsPage(onGroupClick = {
|
|
458
|
-
ChatSettingActivity.start(context, "", it.contactID, true)
|
|
459
|
-
}, onContactClick = {
|
|
460
|
-
ChatSettingActivity.start(context, it.contactID, "", true)
|
|
461
|
-
})
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
``` java
|
|
465
|
-
// chat/demo/app/src/main/java/io/trtc/tuikit/chat/chat/ChatActivity.kt
|
|
466
|
-
|
|
467
|
-
// 点击聊天页面跳转
|
|
468
|
-
ChatPage(
|
|
469
|
-
conversationID = conversationID,
|
|
470
|
-
locateMessage = message,
|
|
471
|
-
onUserClick = {
|
|
472
|
-
handleChatSettingNavigation(it)
|
|
473
|
-
}, onChatHeaderClick = {
|
|
474
|
-
val userID = getUserID(conversationID)
|
|
475
|
-
val groupID = getGroupID(conversationID)
|
|
476
|
-
handleChatSettingNavigation(userID, groupID)
|
|
477
|
-
}, onBackClick = { finish() })
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
您可以参考上述回调说明及参考代码,实现 Page 之间交互逻辑。
|
|
481
|
-
|
|
482
|
-
### 步骤7:接入智能客服 Desk 用户端(可选)
|
|
346
|
+
### 步骤4:接入智能客服 Desk 用户端
|
|
483
347
|
|
|
484
348
|
若需同时集成智能客服 Desk 用户端,请先 [开通智能客服 Desk 服务](https://cloud.tencent.com/document/product/269/96059),并根据 [Android 接入智能客服用户端](https://cloud.tencent.com/document/product/269/110809) 文档完成 `com.tencentcloud.desk:aideskcustomer` 包引入和配置。即可在您的应用中引入客服会话能力。
|
|
485
349
|
``` java
|
|
486
|
-
|
|
487
350
|
int SDKAppID = 0; // 开通了智能客服 Desk 的应用 ID
|
|
488
351
|
String userID = "";
|
|
489
352
|
String userSig = "";
|
|
@@ -509,7 +372,6 @@ TencentAiDeskCustomer.getInstance().initWithProfile(context, SDKAppID, userID, u
|
|
|
509
372
|
@Override
|
|
510
373
|
public void onError(int code, String desc) {}
|
|
511
374
|
});
|
|
512
|
-
|
|
513
375
|
```
|
|
514
376
|
|
|
515
377
|
## 常见问题
|