File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
ts/Windows/UI/Notifications Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -1153,6 +1153,16 @@ declare namespace Windows.UI.Core {
1153
1153
private clearStack ;
1154
1154
}
1155
1155
}
1156
+ interface Navigator {
1157
+ setAppBadge ( value : number ) : void ;
1158
+ clearAppBadge ( ) : void ;
1159
+ }
1160
+ declare namespace Windows . UI . Notifications {
1161
+ class BadgeUpdater {
1162
+ static setNumber ( value : number ) : void ;
1163
+ static clear ( ) : void ;
1164
+ }
1165
+ }
1156
1166
declare namespace Windows . UI . ViewManagement {
1157
1167
class ApplicationView {
1158
1168
static setFullScreenMode ( turnOn : boolean ) : boolean ;
Original file line number Diff line number Diff line change
1
+ interface Navigator {
2
+ setAppBadge ( value : number ) :void ;
3
+ clearAppBadge ( ) : void ;
4
+ }
5
+
6
+ namespace Windows . UI . Notifications {
7
+
8
+ export class BadgeUpdater {
9
+
10
+ public static setNumber ( value : number ) {
11
+ if ( navigator . setAppBadge ) {
12
+ navigator . setAppBadge ( value ) ;
13
+ }
14
+ }
15
+
16
+ public static clear ( ) {
17
+ if ( navigator . clearAppBadge ) {
18
+ navigator . clearAppBadge ( ) ;
19
+ }
20
+ }
21
+
22
+ }
23
+
24
+ }
Original file line number Diff line number Diff line change 1
1
#nullable enable
2
2
3
+ using Uno . Foundation ;
4
+
3
5
namespace Windows . UI . Notifications
4
6
{
5
7
public partial class BadgeUpdater
6
8
{
9
+ private const string JsType = "Windows.UI.Notifications.BadgeUpdater" ;
10
+
7
11
partial void SetBadge ( string ? value )
8
12
{
13
+ if ( value != null && int . TryParse ( value , out var number ) )
14
+ {
15
+ WebAssemblyRuntime . InvokeJS ( $ "{ JsType } .setNumber({ number } )") ;
16
+ }
17
+ else
18
+ {
19
+ WebAssemblyRuntime . InvokeJS ( $ "{ JsType } .clear()") ;
20
+ }
9
21
}
10
22
}
11
23
}
You can’t perform that action at this time.
0 commit comments