Exemple #1
0
 /// <summary>
 /// Send notifications to devices registered to userId with payload data and classification.
 /// </summary>
 /// <typeparam name="TData">The type of data sent in the notification payload.</typeparam>
 /// <param name="service">Instance of <see cref="IPushNotificationService"/>.</param>
 /// <param name="title">Message of notification.</param>
 /// <param name="body">Body of notification.</param>
 /// <param name="data">Data passed to mobile client, not visible to notification toast.</param>
 /// <param name="userTag">UserId to be passed as tag.</param>
 /// <param name="classification">The type of the Push Notification.</param>
 /// <param name="tags">Optional tag parameters.</param>
 public static Task SendAsync <TData>(this IPushNotificationService service, string title, string body, TData data, string userTag, string classification = null, params string[] tags) where TData : class =>
 service.SendAsync(title, body, data != null ? JsonSerializer.Serialize(data, JsonSerializerOptionDefaults.GetDefaultSettings()) : null, userTag, classification, tags);
Exemple #2
0
 /// <inheritdoc/>
 static JsonStringValueConverter()
 {
     _serializerOptions = JsonSerializerOptionDefaults.GetDefaultSettings();
 }
Exemple #3
0
 /// <summary>
 /// Sends a notification to all registered devices.
 /// </summary>
 /// <typeparam name="TData">The type of data sent in the notification payload.</typeparam>
 /// <param name="service">Instance of <see cref="IPushNotificationService"/>.</param>
 /// <param name="title">Message of notification.</param>
 /// <param name="body">Body of notification.</param>
 /// <param name="data">Data passed to mobile client, not visible to notification toast.</param>
 /// <param name="classification">The type of the Push Notification.</param>
 public static Task BroadcastAsync <TData>(this IPushNotificationService service, string title, string body, TData data, string classification = null) where TData : class =>
 service.BroadcastAsync(title, body, data != null ? JsonSerializer.Serialize(data, JsonSerializerOptionDefaults.GetDefaultSettings()) : null, classification);