记录桌面壳深链注册失败
桌面深链 scheme 注册结果改为显式日志记录 桌面壳配置检查拒绝静默吞掉深链注册失败 共享决策日志补充深链注册失败边界
This commit is contained in:
@@ -163,6 +163,14 @@ const desktopShellNetworkSource = fs.readFileSync(
|
||||
desktopShellNetworkPath,
|
||||
'utf8',
|
||||
);
|
||||
const desktopShellDeepLinkPath = new URL(
|
||||
'../src-tauri/src/shell/deep_link.rs',
|
||||
import.meta.url,
|
||||
);
|
||||
const desktopShellDeepLinkSource = fs.readFileSync(
|
||||
desktopShellDeepLinkPath,
|
||||
'utf8',
|
||||
);
|
||||
const desktopShellNavigationPath = new URL(
|
||||
'../src-tauri/src/shell/navigation.rs',
|
||||
import.meta.url,
|
||||
@@ -2778,6 +2786,7 @@ for (const blockedLifecycleSnippet of [
|
||||
'let _ = emit_current_desktop_lifecycle_event(window)',
|
||||
'let _ = emit_current_desktop_lifecycle_event(&lifecycle_window)',
|
||||
'let _ = emit_desktop_image_drop_event(&drop_window',
|
||||
'let _ = app.deep_link().register_all()',
|
||||
'let _ = window.navigate(target_url)',
|
||||
'let _ = show_main_window(window.app_handle())',
|
||||
'let _ = show_main_window(app)',
|
||||
@@ -2800,3 +2809,14 @@ for (const snippet of requiredRustHostSnippets) {
|
||||
throw new Error(`desktop shell Rust host bridge missing ${snippet}`);
|
||||
}
|
||||
}
|
||||
|
||||
for (const snippet of [
|
||||
'register_desktop_deep_link_schemes(app: &tauri::App) -> bool',
|
||||
'log_desktop_deep_link_register_result(app.deep_link().register_all())',
|
||||
'desktop host event failed for deep_link.register',
|
||||
'desktop_deep_link_register_result_reports_success_and_failure',
|
||||
]) {
|
||||
if (!desktopShellDeepLinkSource.includes(snippet)) {
|
||||
throw new Error(`desktop shell deep-link registration logging missing ${snippet}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,18 @@ fn log_desktop_deep_link_open_result(result: tauri::Result<()>) -> bool {
|
||||
log_desktop_host_event_result("deep_link.open", result)
|
||||
}
|
||||
|
||||
fn log_desktop_deep_link_register_result(
|
||||
result: Result<(), tauri_plugin_deep_link::Error>,
|
||||
) -> bool {
|
||||
match result {
|
||||
Ok(()) => true,
|
||||
Err(error) => {
|
||||
eprintln!("desktop host event failed for deep_link.register: {error}");
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn register_desktop_deep_link_events(app: &tauri::App) -> tauri::Result<()> {
|
||||
let app_handle = app.handle().clone();
|
||||
app.deep_link().on_open_url(move |event| {
|
||||
@@ -100,8 +112,8 @@ pub(crate) fn register_desktop_deep_link_events(app: &tauri::App) -> tauri::Resu
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn register_desktop_deep_link_schemes(app: &tauri::App) {
|
||||
let _ = app.deep_link().register_all();
|
||||
pub(crate) fn register_desktop_deep_link_schemes(app: &tauri::App) -> bool {
|
||||
log_desktop_deep_link_register_result(app.deep_link().register_all())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -238,4 +250,12 @@ mod tests {
|
||||
tauri::Error::AssetNotFound("deep-link".to_string())
|
||||
)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn desktop_deep_link_register_result_reports_success_and_failure() {
|
||||
assert!(log_desktop_deep_link_register_result(Ok(())));
|
||||
assert!(!log_desktop_deep_link_register_result(Err(
|
||||
tauri_plugin_deep_link::Error::UnsupportedPlatform
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2895,6 +2895,13 @@
|
||||
- 影响范围:`apps/desktop-shell/src-tauri/src/app.rs`、`apps/desktop-shell/src-tauri/src/shell/navigation.rs`、`apps/desktop-shell/src-tauri/src/shell/tray.rs`、`apps/desktop-shell/scripts/check-config.mjs`、宿主壳方案文档。
|
||||
- 验证方式:`cargo test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml`、`npm run desktop-shell:typecheck`、`npm run check:native-shells`、`npm run check:encoding`、`git diff --check`。
|
||||
|
||||
## 2026-06-20 桌面壳深链注册失败不可静默
|
||||
|
||||
- 背景:Tauri 桌面壳深链 scheme 注册决定已安装桌面包能否从系统链接唤醒;如果 `register_all()` 失败后静默继续,用户会看到深链无反应且没有可排查日志。
|
||||
- 决策:`register_desktop_deep_link_schemes(...)` 必须把 `app.deep_link().register_all()` 结果交给同日志格式的 `log_desktop_deep_link_register_result(...)`,并返回布尔结果供测试和门禁反查;桌面壳配置检查拒绝重新出现 `let _ = app.deep_link().register_all()`。
|
||||
- 影响范围:`apps/desktop-shell/src-tauri/src/shell/deep_link.rs`、`apps/desktop-shell/scripts/check-config.mjs`。
|
||||
- 验证方式:`cargo test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml shell::deep_link`、`npm run desktop-shell:typecheck`、`npm run check:native-shells`、`npm run check:encoding`、`git diff --check`。
|
||||
|
||||
## 2026-06-20 移动壳 EAS 原生包构建 profile
|
||||
|
||||
- 背景:移动壳已能通过 Expo managed config 和 Metro production bundle smoke,但缺少原生安装包构建 profile;如果只保留 `expo export`,无法证明 Android / iOS 壳有进入原生分发链路的配置。
|
||||
|
||||
Reference in New Issue
Block a user