@@ -95,6 +95,8 @@ use wry::{
9595) ) ) ]
9696use wry:: { WebViewBuilderExtUnix , WebViewExtUnix } ;
9797
98+ #[ cfg( target_os = "ios" ) ]
99+ pub use tao:: platform:: ios:: WindowExtIOS ;
98100#[ cfg( target_os = "macos" ) ]
99101pub use tao:: platform:: macos:: {
100102 ActivationPolicy as TaoActivationPolicy , EventLoopExtMacOS , WindowExtMacOS ,
@@ -1263,6 +1265,9 @@ pub enum WindowMessage {
12631265 SetCursorIcon ( CursorIcon ) ,
12641266 SetCursorPosition ( Position ) ,
12651267 SetIgnoreCursorEvents ( bool ) ,
1268+ SetBadgeCount ( Option < i64 > , Option < String > ) ,
1269+ SetBadgeLabel ( Option < String > ) ,
1270+ SetOverlayIcon ( Option < TaoIcon > ) ,
12661271 SetProgressBar ( ProgressBarState ) ,
12671272 SetTitleBarStyle ( tauri_utils:: TitleBarStyle ) ,
12681273 SetTheme ( Option < Theme > ) ,
@@ -2125,6 +2130,32 @@ impl<T: UserEvent> WindowDispatch<T> for WryWindowDispatcher<T> {
21252130 )
21262131 }
21272132
2133+ fn set_badge_count ( & self , count : Option < i64 > , desktop_filename : Option < String > ) -> Result < ( ) > {
2134+ send_user_message (
2135+ & self . context ,
2136+ Message :: Window (
2137+ self . window_id ,
2138+ WindowMessage :: SetBadgeCount ( count, desktop_filename) ,
2139+ ) ,
2140+ )
2141+ }
2142+
2143+ fn set_badge_label ( & self , label : Option < String > ) -> Result < ( ) > {
2144+ send_user_message (
2145+ & self . context ,
2146+ Message :: Window ( self . window_id , WindowMessage :: SetBadgeLabel ( label) ) ,
2147+ )
2148+ }
2149+
2150+ fn set_overlay_icon ( & self , icon : Option < Icon > ) -> Result < ( ) > {
2151+ let icon: Result < Option < TaoIcon > > = icon. map_or ( Ok ( None ) , |x| Ok ( Some ( TaoIcon :: try_from ( x) ?) ) ) ;
2152+
2153+ send_user_message (
2154+ & self . context ,
2155+ Message :: Window ( self . window_id , WindowMessage :: SetOverlayIcon ( icon?) ) ,
2156+ )
2157+ }
2158+
21282159 fn set_progress_bar ( & self , progress_state : ProgressBarState ) -> Result < ( ) > {
21292160 send_user_message (
21302161 & self . context ,
@@ -3096,6 +3127,32 @@ fn handle_user_message<T: UserEvent>(
30963127 WindowMessage :: RequestRedraw => {
30973128 window. request_redraw ( ) ;
30983129 }
3130+ WindowMessage :: SetBadgeCount ( _count, _desktop_filename) => {
3131+ #[ cfg( target_os = "ios" ) ]
3132+ window. set_badge_count (
3133+ _count. map_or ( 0 , |x| x. clamp ( i32:: MIN as i64 , i32:: MAX as i64 ) as i32 ) ,
3134+ ) ;
3135+
3136+ #[ cfg( target_os = "macos" ) ]
3137+ window. set_badge_label ( _count. map ( |x| x. to_string ( ) ) ) ;
3138+
3139+ #[ cfg( any(
3140+ target_os = "linux" ,
3141+ target_os = "dragonfly" ,
3142+ target_os = "freebsd" ,
3143+ target_os = "netbsd" ,
3144+ target_os = "openbsd"
3145+ ) ) ]
3146+ window. set_badge_count ( _count, _desktop_filename) ;
3147+ }
3148+ WindowMessage :: SetBadgeLabel ( _label) => {
3149+ #[ cfg( target_os = "macos" ) ]
3150+ window. set_badge_label ( _label) ;
3151+ }
3152+ WindowMessage :: SetOverlayIcon ( _icon) => {
3153+ #[ cfg( windows) ]
3154+ window. set_overlay_icon ( _icon. map ( |x| x. 0 ) . as_ref ( ) ) ;
3155+ }
30993156 WindowMessage :: SetProgressBar ( progress_state) => {
31003157 window. set_progress_bar ( ProgressBarStateWrapper :: from ( progress_state) . 0 ) ;
31013158 }
@@ -3431,7 +3488,6 @@ fn handle_user_message<T: UserEvent>(
34313488 }
34323489 #[ cfg( target_os = "ios" ) ]
34333490 {
3434- use tao:: platform:: ios:: WindowExtIOS ;
34353491 use wry:: WebViewExtIOS ;
34363492
34373493 f ( Webview {
0 commit comments