mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Desktop notifications were enabled by default and depended on the Tauri notification plugin for both permission state and delivery. On macOS the plugin reports desktop permission as granted and can hide foreground delivery failures, so authorization prompts could appear in the app without a real system notification. This moves macOS permission and delivery through a native UserNotifications bridge, keeps notifications opt-in by default, and sends a test notification after successful authorization. Constraint: Tauri notification plugin desktop permission state is always granted. Constraint: macOS foreground delivery needs explicit native presentation handling. Rejected: Keep using the plugin with retries | it still cannot report real macOS permission or delivery failures. Confidence: high Scope-risk: moderate Directive: Do not remove the macOS bridge without verifying foreground banners from an installed app bundle. Tested: cd desktop && bun run test --run src/lib/desktopNotifications.test.ts src/stores/settingsStore.test.ts src/__tests__/generalSettings.test.tsx src/stores/chatStore.test.ts Tested: bun run check:desktop Tested: bun run check:native Tested: SKIP_INSTALL=1 ./scripts/build-macos-arm64.sh Tested: codesign --verify --deep --strict --verbose=2 desktop/build-artifacts/macos-arm64/Claude Code Haha.app Tested: hdiutil verify desktop/build-artifacts/macos-arm64/Claude Code Haha_0.2.0_aarch64.dmg Tested: Computer Use macOS Settings and Bash authorization notifications, confirmed usernoted displayed banners. Not-tested: Windows toast delivery on a real installed Windows build.
38 lines
1.2 KiB
Rust
38 lines
1.2 KiB
Rust
fn main() {
|
|
#[cfg(target_os = "macos")]
|
|
{
|
|
use std::{env, path::PathBuf, process::Command};
|
|
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR is set by Cargo"));
|
|
let object_path = out_dir.join("macos_notifications.o");
|
|
let source_path = PathBuf::from("src/macos_notifications.m");
|
|
|
|
println!("cargo:rerun-if-changed={}", source_path.display());
|
|
|
|
let status = Command::new("clang")
|
|
.args([
|
|
"-fobjc-arc",
|
|
"-c",
|
|
source_path
|
|
.to_str()
|
|
.expect("notification bridge path is UTF-8"),
|
|
"-o",
|
|
object_path
|
|
.to_str()
|
|
.expect("compiled notification bridge path is UTF-8"),
|
|
])
|
|
.status()
|
|
.expect("failed to invoke clang for macOS notification bridge");
|
|
|
|
if !status.success() {
|
|
panic!("failed to compile macOS notification bridge");
|
|
}
|
|
|
|
println!("cargo:rustc-link-arg={}", object_path.display());
|
|
println!("cargo:rustc-link-lib=framework=Foundation");
|
|
println!("cargo:rustc-link-lib=framework=UserNotifications");
|
|
}
|
|
|
|
tauri_build::build()
|
|
}
|