65b9125d22
将 Expo host.getRuntime 成功响应包装收口到 runtime 模块 让移动 dispatch 只委托运行时请求 同步移动壳配置门禁和共享记忆
30 lines
911 B
TypeScript
30 lines
911 B
TypeScript
import { Platform } from 'react-native';
|
|
|
|
import {
|
|
HOST_BRIDGE_VERSION,
|
|
type HostBridgeRequest,
|
|
type HostBridgeRuntimeResult,
|
|
} from '../../../../packages/shared/src/contracts/hostBridge';
|
|
import { MOBILE_SHELL_HOST_VERSION } from '../shell/runtime';
|
|
import { resolveMobileHostCapabilities } from './capabilities';
|
|
import { ok } from './protocol';
|
|
|
|
export function getMobileRuntimePlatform() {
|
|
return Platform.OS === 'ios' ? 'ios' : 'android';
|
|
}
|
|
|
|
export function getMobileHostBridgeRuntime(): HostBridgeRuntimeResult {
|
|
const platform = getMobileRuntimePlatform();
|
|
return {
|
|
shell: 'expo_mobile',
|
|
platform,
|
|
hostVersion: MOBILE_SHELL_HOST_VERSION,
|
|
bridgeVersion: HOST_BRIDGE_VERSION,
|
|
capabilities: resolveMobileHostCapabilities(platform),
|
|
};
|
|
}
|
|
|
|
export function getMobileHostBridgeRuntimeResponse(request: HostBridgeRequest) {
|
|
return ok(request, getMobileHostBridgeRuntime());
|
|
}
|