@@ -95,6 +95,8 @@ use wry::{
95
95
) ) ) ]
96
96
use wry:: { WebViewBuilderExtUnix , WebViewExtUnix } ;
97
97
98
+ #[ cfg( target_os = "ios" ) ]
99
+ pub use tao:: platform:: ios:: WindowExtIOS ;
98
100
#[ cfg( target_os = "macos" ) ]
99
101
pub use tao:: platform:: macos:: {
100
102
ActivationPolicy as TaoActivationPolicy , EventLoopExtMacOS , WindowExtMacOS ,
@@ -1263,6 +1265,9 @@ pub enum WindowMessage {
1263
1265
SetCursorIcon ( CursorIcon ) ,
1264
1266
SetCursorPosition ( Position ) ,
1265
1267
SetIgnoreCursorEvents ( bool ) ,
1268
+ SetBadgeCount ( Option < i64 > , Option < String > ) ,
1269
+ SetBadgeLabel ( Option < String > ) ,
1270
+ SetOverlayIcon ( Option < TaoIcon > ) ,
1266
1271
SetProgressBar ( ProgressBarState ) ,
1267
1272
SetTitleBarStyle ( tauri_utils:: TitleBarStyle ) ,
1268
1273
SetTheme ( Option < Theme > ) ,
@@ -2125,6 +2130,32 @@ impl<T: UserEvent> WindowDispatch<T> for WryWindowDispatcher<T> {
2125
2130
)
2126
2131
}
2127
2132
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
+
2128
2159
fn set_progress_bar ( & self , progress_state : ProgressBarState ) -> Result < ( ) > {
2129
2160
send_user_message (
2130
2161
& self . context ,
@@ -3096,6 +3127,32 @@ fn handle_user_message<T: UserEvent>(
3096
3127
WindowMessage :: RequestRedraw => {
3097
3128
window. request_redraw ( ) ;
3098
3129
}
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
+ }
3099
3156
WindowMessage :: SetProgressBar ( progress_state) => {
3100
3157
window. set_progress_bar ( ProgressBarStateWrapper :: from ( progress_state) . 0 ) ;
3101
3158
}
@@ -3431,7 +3488,6 @@ fn handle_user_message<T: UserEvent>(
3431
3488
}
3432
3489
#[ cfg( target_os = "ios" ) ]
3433
3490
{
3434
- use tao:: platform:: ios:: WindowExtIOS ;
3435
3491
use wry:: WebViewExtIOS ;
3436
3492
3437
3493
f ( Webview {
0 commit comments