feat(native): Tier B — WinRT rich toasts (P5-41/35) + Focus Assist sync (P5-56)
- toast.rs: Windows.UI.Notifications rich toast (reply input + Send action);
in-process Activated event → emit lotus-notification-activate {path} (click) /
lotus-notification-reply {roomId,text}. Falls back to tauri-plugin-notification
(WinRT error / non-Windows). The NOTIFICATION_BRIDGE now routes notifications
carrying a roomId (tag) to show_rich_toast. Features: UI_Notifications,
Data_Xml_Dom, Foundation_Collections.
- focus_assist.rs: SHQueryUserNotificationState poll thread → emit
focus-assist-changed {active} on QUNS_QUIET_TIME/PRESENTATION/D3D_FULLSCREEN/BUSY.
No new Cargo features.
CI Windows compile pending (no local Rust toolchain). Runtime caveat: WinRT toasts
need a Start-menu shortcut + matching AppUserModelID (org.lotusguild.lotus-chat);
without it CreateToastNotifier errors and the code falls back to the plugin.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+16
-4
@@ -51,10 +51,21 @@ const NOTIFICATION_BRIDGE: &str = r#"(function(){
|
||||
function TauriNotification(title,options){
|
||||
var opts=options||{};
|
||||
try{
|
||||
window.__TAURI_INTERNALS__.invoke('send_notification',{
|
||||
title:String(title),
|
||||
body:opts.body!=null?String(opts.body):undefined
|
||||
}).catch(function(){});
|
||||
var body=opts.body!=null?String(opts.body):undefined;
|
||||
// cinny tags message notifications with the roomId (options.tag) and the
|
||||
// in-app route (options.data.path). When present, route to the rich WinRT
|
||||
// toast (click-opens-room + quick reply); otherwise a plain toast.
|
||||
var roomId=opts.tag!=null?String(opts.tag):undefined;
|
||||
var path=(opts.data&&opts.data.path!=null)?String(opts.data.path):undefined;
|
||||
if(roomId){
|
||||
window.__TAURI_INTERNALS__.invoke('show_rich_toast',{
|
||||
title:String(title),body:body,roomId:roomId,path:path
|
||||
}).catch(function(){});
|
||||
}else{
|
||||
window.__TAURI_INTERNALS__.invoke('send_notification',{
|
||||
title:String(title),body:body
|
||||
}).catch(function(){});
|
||||
}
|
||||
}catch(_){}
|
||||
}
|
||||
TauriNotification.prototype=Object.create(EventTarget.prototype);
|
||||
@@ -397,6 +408,7 @@ pub fn run() {
|
||||
native::chrome::window_toggle_maximize,
|
||||
native::chrome::window_start_drag,
|
||||
native::chrome::window_close,
|
||||
native::toast::show_rich_toast,
|
||||
])
|
||||
.plugin(tauri_plugin_localhost::Builder::new(port).build())
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
|
||||
Reference in New Issue
Block a user