收口原生网络查询边界

将 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
@@ -94,6 +94,14 @@ const desktopHostBridgeNavigationSource = fs.readFileSync(
desktopHostBridgeNavigationPath,
'utf8',
);
const desktopHostBridgeNetworkPath = new URL(
'../src-tauri/src/host_bridge/network.rs',
import.meta.url,
);
const desktopHostBridgeNetworkSource = fs.readFileSync(
desktopHostBridgeNetworkPath,
'utf8',
);
const desktopHostBridgeNotificationsPath = new URL(
'../src-tauri/src/host_bridge/notifications.rs',
import.meta.url,
@@ -225,6 +233,7 @@ const expectedDesktopHostBridgeRustFiles = [
'files.rs',
'mod.rs',
'navigation.rs',
'network.rs',
'notifications.rs',
'protocol.rs',
'share.rs',
@@ -1692,6 +1701,24 @@ for (const snippet of [
}
}
if (
!desktopHostBridgeDispatchSource.includes(
'resolve_desktop_host_bridge_network_status().await',
) ||
desktopHostBridgeDispatchSource.includes('resolve_desktop_network_status') ||
desktopHostBridgeDispatchSource.includes('spawn_blocking(resolve_desktop_network_status)')
) {
throw new Error('desktop shell network HostBridge method must delegate to network module');
}
for (const snippet of [
'resolve_desktop_host_bridge_network_status',
'spawn_blocking(resolve_desktop_network_status)',
]) {
if (!desktopHostBridgeNetworkSource.includes(snippet)) {
throw new Error(`desktop shell network module is missing ${snippet}`);
}
}
if (config.build?.frontendDist !== '../../../dist') {
throw new Error('desktop shell must package the root H5 dist');
}
@@ -1863,6 +1890,7 @@ const expectedRustHostBridgeFiles = [
'files.rs',
'mod.rs',
'navigation.rs',
'network.rs',
'notifications.rs',
'protocol.rs',
'share.rs',