收口移动剪贴板边界
将 Expo 剪贴板读写收口到 clipboard 模块 让 HostBridge dispatch 只负责剪贴板 payload 分发 同步原生壳结构门禁和架构文档清单
This commit is contained in:
@@ -12,6 +12,8 @@ const qrScannerOverlayPath = new URL('../src/shell/QrScannerOverlay.tsx', import
|
||||
const qrScannerOverlaySource = fs.readFileSync(qrScannerOverlayPath, 'utf8');
|
||||
const bridgePath = new URL('../src/host-bridge/bridge.ts', import.meta.url);
|
||||
const bridgeSource = fs.readFileSync(bridgePath, 'utf8');
|
||||
const clipboardPath = new URL('../src/host-bridge/clipboard.ts', import.meta.url);
|
||||
const clipboardSource = fs.readFileSync(clipboardPath, 'utf8');
|
||||
const dispatchPath = new URL('../src/host-bridge/dispatch.ts', import.meta.url);
|
||||
const dispatchSource = fs.readFileSync(dispatchPath, 'utf8');
|
||||
const notificationsPath = new URL('../src/host-bridge/notifications.ts', import.meta.url);
|
||||
@@ -73,6 +75,7 @@ const requiredMobileShellSourceModules = [
|
||||
'env.d.ts',
|
||||
'host-bridge/bridge.ts',
|
||||
'host-bridge/capabilities.ts',
|
||||
'host-bridge/clipboard.ts',
|
||||
'host-bridge/dispatch.ts',
|
||||
'host-bridge/files.ts',
|
||||
'host-bridge/notifications.ts',
|
||||
@@ -1619,13 +1622,26 @@ if (
|
||||
);
|
||||
}
|
||||
if (
|
||||
!hostBridgeSource.includes(
|
||||
!clipboardSource.includes(
|
||||
'const clipboardText = normalizeHostBridgeClipboardText(',
|
||||
) ||
|
||||
!hostBridgeSource.includes('Clipboard.setStringAsync(clipboardText.text)')
|
||||
!clipboardSource.includes('Clipboard.setStringAsync(clipboardText.text)') ||
|
||||
!clipboardSource.includes('await Clipboard.getStringAsync()')
|
||||
) {
|
||||
throw new Error(
|
||||
'mobile shell clipboard.writeText must normalize text with the shared HostBridge clipboard boundary',
|
||||
'mobile shell clipboard bridge must normalize text with the shared HostBridge clipboard boundary',
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
dispatchSource.includes("from 'expo-clipboard'") ||
|
||||
dispatchSource.includes('Clipboard.setStringAsync') ||
|
||||
dispatchSource.includes('Clipboard.getStringAsync') ||
|
||||
!dispatchSource.includes('writeMobileClipboardText(') ||
|
||||
!dispatchSource.includes('readMobileClipboardText()')
|
||||
) {
|
||||
throw new Error(
|
||||
'mobile shell dispatch must delegate clipboard IO to clipboard.ts',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user