收口原生网络查询边界

将 Expo 网络状态查询收口到 HostBridge network 模块

将 Tauri 网络状态查询收口到 HostBridge network 模块

同步原生壳结构门禁、架构文档和共享记忆
This commit is contained in:
2026-06-19 22:08:19 +08:00
parent 177c18ddcd
commit c0940bc790
11 changed files with 87 additions and 12 deletions
@@ -30,6 +30,14 @@ const hostBridgeNavigationSource = fs.readFileSync(
hostBridgeNavigationPath,
'utf8',
);
const hostBridgeNetworkPath = new URL(
'../src/host-bridge/network.ts',
import.meta.url,
);
const hostBridgeNetworkSource = fs.readFileSync(
hostBridgeNetworkPath,
'utf8',
);
const notificationsPath = new URL('../src/host-bridge/notifications.ts', import.meta.url);
const notificationsSource = fs.readFileSync(notificationsPath, 'utf8');
const protocolPath = new URL('../src/host-bridge/protocol.ts', import.meta.url);
@@ -96,6 +104,7 @@ const requiredMobileShellSourceModules = [
'host-bridge/files.ts',
'host-bridge/haptics.ts',
'host-bridge/navigation.ts',
'host-bridge/network.ts',
'host-bridge/notifications.ts',
'host-bridge/protocol.ts',
'host-bridge/scanner.ts',
@@ -1897,6 +1906,22 @@ if (!hostBridgeNavigationSource.includes('openMobileShellExternalNavigation(navi
);
}
if (
!dispatchSource.includes('getMobileHostBridgeNetworkStatus()') ||
dispatchSource.includes('../shell/network') ||
dispatchSource.includes('getMobileNetworkStatus()')
) {
throw new Error('mobile shell network HostBridge method must delegate to network module');
}
for (const snippet of [
'getMobileHostBridgeNetworkStatus',
'getMobileNetworkStatus()',
]) {
if (!hostBridgeNetworkSource.includes(snippet)) {
throw new Error(`mobile shell network module is missing ${snippet}`);
}
}
if (!shellAppSource.includes('openMobileShellExternalNavigation(Linking, request.url)')) {
throw new Error(
'mobile shell WebView external navigation must use the tested external navigation helper',