收口原生角标边界

将 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
+33 -1
View File
@@ -46,6 +46,14 @@ const app = fs.readFileSync(appPath, 'utf8');
const mainPath = new URL('../src-tauri/src/main.rs', import.meta.url);
const main = fs.readFileSync(mainPath, 'utf8');
const rustSourceDir = new URL('../src-tauri/src/', import.meta.url);
const desktopHostBridgeBadgePath = new URL(
'../src-tauri/src/host_bridge/badge.rs',
import.meta.url,
);
const desktopHostBridgeBadgeSource = fs.readFileSync(
desktopHostBridgeBadgePath,
'utf8',
);
const desktopHostBridgeCapabilitiesPath = new URL(
'../src-tauri/src/host_bridge/capabilities.rs',
import.meta.url,
@@ -193,6 +201,7 @@ const expectedDesktopRustRootEntries = [
'file:main.rs',
];
const expectedDesktopHostBridgeRustFiles = [
'badge.rs',
'capabilities.rs',
'clipboard.rs',
'dispatch.rs',
@@ -1283,7 +1292,7 @@ const desktopHostBridgePayloadLimits = {
'DESKTOP_NETWORK_CHECK_TIMEOUT_MS',
),
HOST_BRIDGE_BADGE_COUNT_MAX: extractRustNumberConst(
rustHostSource,
desktopHostBridgeBadgeSource,
'BADGE_COUNT_MAX',
),
HOST_BRIDGE_APP_TITLE_MAX_LENGTH: extractRustNumberConst(
@@ -1803,6 +1812,7 @@ const expectedRustRootEntries = [
'file:main.rs',
];
const expectedRustHostBridgeFiles = [
'badge.rs',
'capabilities.rs',
'clipboard.rs',
'dispatch.rs',
@@ -2048,6 +2058,28 @@ assertSameList(
if (nativeAppHostBridgeSource.includes("'host_bridge_request'")) {
throw new Error('H5 native app HostBridge must use HOST_BRIDGE_TAURI_COMMAND');
}
if (
!desktopHostBridgeDispatchSource.includes(
'set_desktop_app_badge_count(&app, &request)',
) ||
desktopHostBridgeDispatchSource.includes('set_badge_count') ||
desktopHostBridgeDispatchSource.includes('BADGE_COUNT_MAX')
) {
throw new Error('desktop shell badge HostBridge method must delegate to badge module');
}
for (const snippet of [
'BADGE_COUNT_MAX',
'fn badge_count_payload',
'set_desktop_app_badge_count',
'"count must be an integer between 0 and 99999"',
]) {
if (!desktopHostBridgeBadgeSource.includes(snippet)) {
throw new Error(`desktop shell badge module is missing ${snippet}`);
}
}
if (!desktopHostBridgeBadgeSource.match(/window\s*\.\s*set_badge_count\s*\(\s*count\s*\)/)) {
throw new Error('desktop shell badge module must call window.set_badge_count(count)');
}
if (
!desktopHostBridgeDispatchSource.includes(
'show_desktop_local_notification(&app, &request)',