- Restructure as yarn workspace with packages/common, im, push, update
- @xuqm/rn-common: built-in URLs (no apiBaseUrl/imWsUrl in init), init({appId, debug})
- @xuqm/rn-im: login(userId) handles token internally, no token in public API
- @xuqm/rn-update: registerPlugin({moduleId,version}) for self-registration,
checkAppUpdate() auto-detects version via XuqmVersionModule native bridge,
checkRnUpdate(moduleId) uses registered version (no app-layer arg)
- Add XuqmVersionModule native stubs for Android/iOS
- Keep @xuqm/rn-sdk as convenience meta-package re-exporting all
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 行
790 B
TypeScript
37 行
790 B
TypeScript
import { API_BASE_URL, IM_WS_URL } from './constants'
|
|
|
|
export interface XuqmInitOptions {
|
|
appId: string
|
|
appKey?: string
|
|
debug?: boolean
|
|
}
|
|
|
|
export interface XuqmConfig {
|
|
appId: string
|
|
appKey: string
|
|
apiBaseUrl: string
|
|
imWsUrl: string
|
|
debug: boolean
|
|
}
|
|
|
|
let _config: XuqmConfig | null = null
|
|
|
|
export function initConfig(options: XuqmInitOptions): void {
|
|
_config = {
|
|
appId: options.appId,
|
|
appKey: options.appKey ?? options.appId,
|
|
apiBaseUrl: API_BASE_URL,
|
|
imWsUrl: IM_WS_URL,
|
|
debug: options.debug ?? false,
|
|
}
|
|
}
|
|
|
|
export function getConfig(): XuqmConfig {
|
|
if (!_config) throw new Error('[XuqmSDK] Not initialized — call XuqmSDK.init() first.')
|
|
return _config
|
|
}
|
|
|
|
export function isInitialized(): boolean {
|
|
return _config !== null
|
|
}
|