收口原生角标边界

将 Expo 应用角标设置收口到 badge 模块

将 Tauri 任务栏角标设置收口到 badge 模块

同步原生壳结构门禁和架构文档清单
This commit is contained in:
2026-06-19 21:45:04 +08:00
parent af6aea3de2
commit b92b9bbc29
11 changed files with 182 additions and 105 deletions
@@ -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 badgePath = new URL('../src/host-bridge/badge.ts', import.meta.url);
const badgeSource = fs.readFileSync(badgePath, '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);
@@ -75,6 +77,7 @@ const productionSourceRoots = [
const productionFileExtensions = new Set(['.json', '.mjs', '.ts', '.tsx']);
const requiredMobileShellSourceModules = [
'env.d.ts',
'host-bridge/badge.ts',
'host-bridge/bridge.ts',
'host-bridge/capabilities.ts',
'host-bridge/clipboard.ts',
@@ -1813,6 +1816,24 @@ if (!iosMobileCapabilitySet.has('app.setBadgeCount')) {
if (mobileCapabilitySet.has('app.setBadgeCount')) {
throw new Error('Android mobile shell base capabilities must not include app.setBadgeCount');
}
if (
!dispatchSource.includes('setMobileAppBadgeCount(request.payload)') ||
dispatchSource.includes('PushNotificationIOS') ||
dispatchSource.includes('normalizeHostBridgeBadgeCount') ||
dispatchSource.includes('HOST_BRIDGE_BADGE_COUNT_MAX')
) {
throw new Error('mobile shell badge HostBridge method must delegate to badge module');
}
for (const snippet of [
'HOST_BRIDGE_BADGE_COUNT_MAX',
'normalizeHostBridgeBadgeCount',
'PushNotificationIOS.setApplicationIconBadgeNumber(count)',
'app badge count is only supported on iOS mobile shell',
]) {
if (!badgeSource.includes(snippet)) {
throw new Error(`mobile shell badge module is missing ${snippet}`);
}
}
if (!dispatchSource.includes('Appearance.getColorScheme()')) {
throw new Error('mobile shell HostBridge must read the native color scheme');