@@ -32,6 +32,34 @@ public enum PresentationOption
32
32
Alert = 1 << 2 ,
33
33
}
34
34
35
+ /// <summary>
36
+ /// The type of sound to use for the notification.
37
+ /// See Apple documentation for details.
38
+ /// </summary>
39
+ /// <see href="https://developer.apple.com/documentation/usernotifications/unnotificationsound?language=objc"/>
40
+ public enum NotificationSoundType
41
+ {
42
+ /// <summary>
43
+ /// Play the default sound.
44
+ /// </summary>
45
+ Default = 0 ,
46
+
47
+ /// <summary>
48
+ /// Critical sound (bypass Do Not Disturb)
49
+ /// </summary>
50
+ Critical = 1 ,
51
+
52
+ /// <summary>
53
+ /// Ringtone sound.
54
+ /// </summary>
55
+ Ringtone = 2 ,
56
+
57
+ /// <summary>
58
+ /// No sound.
59
+ /// </summary>
60
+ None = 4 ,
61
+ }
62
+
35
63
[ StructLayout ( LayoutKind . Sequential ) ]
36
64
internal struct TimeTriggerData
37
65
{
@@ -82,6 +110,9 @@ internal struct iOSNotificationData
82
110
public string subtitle ;
83
111
public string categoryIdentifier ;
84
112
public string threadIdentifier ;
113
+ public Int32 soundType ;
114
+ public float soundVolume ;
115
+ public string soundName ;
85
116
86
117
public IntPtr userInfo ;
87
118
public IntPtr attachments ;
@@ -213,6 +244,36 @@ public int Badge
213
244
set { data . badge = value ; }
214
245
}
215
246
247
+ /// <summary>
248
+ /// The type of sound to be played.
249
+ /// </summary>
250
+ public NotificationSoundType SoundType
251
+ {
252
+ get { return ( NotificationSoundType ) data . soundType ; }
253
+ set { data . soundType = ( int ) value ; }
254
+ }
255
+
256
+ /// <summary>
257
+ /// The name of the sound to be played. Use null for system default sound.
258
+ /// See Apple documentation for named sounds and sound file placement.
259
+ /// </summary>
260
+ public string SoundName
261
+ {
262
+ get { return data . soundName ; }
263
+ set { data . soundName = value ; }
264
+ }
265
+
266
+ /// <summary>
267
+ /// The volume for the sound. Use null to use the default volume.
268
+ /// See Apple documentation for supported values.
269
+ /// </summary>
270
+ /// <see href="https://developer.apple.com/documentation/usernotifications/unnotificationsound/2963118-defaultcriticalsoundwithaudiovol?language=objc"/>
271
+ public float ? SoundVolume
272
+ {
273
+ get { return data . soundVolume < 0 ? null : data . soundVolume ; }
274
+ set { data . soundVolume = value == null ? - 1.0f : value . Value ; }
275
+ }
276
+
216
277
/// <summary>
217
278
/// Arbitrary string data which can be retrieved when the notification is used to open the app or is received while the app is running.
218
279
/// </summary>
0 commit comments