diff --git a/.nvmrc b/.nvmrc index 2bd5a0a..db49bb1 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22 +22.22.2 diff --git a/docs/README.md b/docs/README.md index 5f73f44..75e163f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -18,7 +18,7 @@ | API 域名 | `https://dev.xuqinmin.com` | | 登录服务 | `demo-service`(`/api/demo/auth/*`) | | IM WebSocket | `wss://im.dev.xuqinmin.com/ws/im` | -| 演示 AppId | `ak_demo_chat` | +| 演示 AppKey | `ak_demo_chat` | | 演示用户 | `demo_alice`(Alice)、`demo_bob`(Bob) | | 演示模块 | `chat-home` | | 本地 App 版本码 | `1`(写死,便于触发更新) | @@ -95,7 +95,7 @@ npm run ios # iOS 模拟器 ### Section 3 · 群聊演示 1. 点击 **"+ 创建演示群"** → 创建含 Alice + Bob 的群组并订阅群 topic -2. 点击 **"加载群列表"** 列出当前 appId 下所有群组 +2. 点击 **"加载群列表"** 列出当前 appKey 下所有群组 3. 点击群组名称切换当前群,自动拉取群历史 4. 使用消息类型选择器在群内发送任意类型消息 5. 点击 **"全部类型演示"** 依次发送 12 种群消息 @@ -128,7 +128,7 @@ cd XuqmGroup-RNChatDemo 发布内容: -- `appId=ak_demo_chat` Android App 版本 `1.0.1`(versionCode=2) +- `appKey=ak_demo_chat` Android App 版本 `1.0.1`(versionCode=2) - `moduleId=chat-home` Android RN bundle 版本 `1.0.1` --- @@ -147,7 +147,7 @@ cd XuqmGroup-RNChatDemo 所有接口通过 Nginx 反代至 `https://dev.xuqinmin.com`。 -`demo-service` 负责 demo 账号体系的注册、登录、找回密码和资料更新;登录成功后会返回 `demoToken`、`imToken` 和 `profile`。其中 `profile.appId` 用于后续初始化 IM 和更新能力,不走租户服务登录链路。 +`demo-service` 负责 demo 账号体系的注册、登录、找回密码和资料更新;登录成功后会返回 `demoToken`、`imToken` 和 `profile`。其中 `profile.appKey` 用于后续初始化 IM 和更新能力,不走租户服务登录链路。 --- diff --git a/scripts/publish-demo-assets.sh b/scripts/publish-demo-assets.sh index e39d0b9..0feb016 100755 --- a/scripts/publish-demo-assets.sh +++ b/scripts/publish-demo-assets.sh @@ -15,7 +15,7 @@ BUNDLE_FILE="${ASSET_DIR}/chat-home.android.bundle" echo "Uploading demo APK metadata to ${BASE_URL}" APP_UPLOAD_JSON="$(curl -fsS -X POST "${BASE_URL}/api/v1/updates/app/upload" \ - -F "appId=${APP_ID}" \ + -F "appKey=${APP_ID}" \ -F "platform=ANDROID" \ -F "versionName=1.0.1" \ -F "versionCode=2" \ @@ -36,7 +36,7 @@ curl -fsS -X POST "${BASE_URL}/api/v1/updates/app/${APP_VERSION_ID}/publish" >/d echo "Uploading demo RN bundle to ${BASE_URL}" RN_UPLOAD_JSON="$(curl -fsS -X POST "${BASE_URL}/api/v1/rn/upload" \ - -F "appId=${APP_ID}" \ + -F "appKey=${APP_ID}" \ -F "moduleId=${MODULE_ID}" \ -F "platform=ANDROID" \ -F "version=1.0.1" \ diff --git a/src/api/demo.ts b/src/api/demo.ts index f60bf8c..ed3647d 100644 --- a/src/api/demo.ts +++ b/src/api/demo.ts @@ -12,7 +12,7 @@ async function request( options: { method?: string; body?: unknown; params?: Record; skipAuth?: boolean } = {}, ): Promise { let url = BASE + path - const params = { appId: APP_ID, ...(options.params ?? {}) } + const params = { appKey: APP_ID, ...(options.params ?? {}) } url += '?' + new URLSearchParams(params).toString() const headers: Record = { 'Content-Type': 'application/json' } @@ -33,7 +33,7 @@ async function request( } export interface UserProfile { - appId: string + appKey: string userId: string nickname: string avatar: string @@ -52,7 +52,7 @@ export const demoApi = { return request('/auth/register', { method: 'POST', skipAuth: true, - body: { appId: APP_ID, userId, password, nickname }, + body: { appKey: APP_ID, userId, password, nickname }, }) }, @@ -60,7 +60,7 @@ export const demoApi = { return request('/auth/login', { method: 'POST', skipAuth: true, - body: { appId: APP_ID, userId, password }, + body: { appKey: APP_ID, userId, password }, }) }, @@ -73,7 +73,7 @@ export const demoApi = { }, resetPassword(userId: string, newPassword: string): Promise { - return request('/auth/reset-password', { method: 'POST', skipAuth: true, body: { appId: APP_ID, userId, newPassword } }) + return request('/auth/reset-password', { method: 'POST', skipAuth: true, body: { appKey: APP_ID, userId, newPassword } }) }, changePassword(oldPassword: string, newPassword: string): Promise { diff --git a/src/components/GroupChatPanel.tsx b/src/components/GroupChatPanel.tsx index 07a35c1..d304838 100644 --- a/src/components/GroupChatPanel.tsx +++ b/src/components/GroupChatPanel.tsx @@ -13,7 +13,7 @@ interface Props { currentUserId: string peerUserId: string peerNickname: string - appId: string + appKey: string onLog: (msg: string) => void groupMessages: ImMessage[] onMergeMessage: (msg: ImMessage) => void diff --git a/src/context/AuthContext.tsx b/src/context/AuthContext.tsx index 5771673..68c738c 100644 --- a/src/context/AuthContext.tsx +++ b/src/context/AuthContext.tsx @@ -27,7 +27,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { const [state, setState] = useState({ ready: false, userId: null, profile: null }) const initSDK = useCallback(async (profile: UserProfile, imToken: string) => { - const appKey = profile.appId || APP_ID + const appKey = profile.appKey || APP_ID await XuqmSDK.initialize({ appKey }) await XuqmSDK.login({ userId: profile.userId, userSig: imToken }) setState({ ready: true, userId: profile.userId, profile }) diff --git a/src/screens/conversation/ConversationListScreen.tsx b/src/screens/conversation/ConversationListScreen.tsx index 959c1ab..15e7beb 100644 --- a/src/screens/conversation/ConversationListScreen.tsx +++ b/src/screens/conversation/ConversationListScreen.tsx @@ -19,7 +19,7 @@ interface ConvWithMeta extends ConversationData { } export default function ConversationListScreen() { - const appId = 'ak_demo_chat' + const appKey = 'ak_demo_chat' const navigation = useNavigation