22 public string Link {
get;
set; }
27 public string Icon {
get;
set; }
40 base.ExportProperties(Message);
42 Dictionary<string, object> WebPushConfig = Message.ContainsKey(
"webpush") && Message[
"webpush"] is Dictionary<string, object> ExistingWebpush
44 :
new Dictionary<string, object>();
45 Dictionary<string, object> WebPushNotification =
new Dictionary<string, object>();
46 Dictionary<string, object> WebPushFcmOptions =
new Dictionary<string, object>();
50 if (!
string.IsNullOrEmpty(this.
Link))
51 WebPushFcmOptions[
"link"] = this.
Link;
53 if (!
string.IsNullOrEmpty(this.
Title))
54 WebPushNotification[
"title"] = this.
Title;
56 if (!
string.IsNullOrEmpty(this.
Body))
57 WebPushNotification[
"body"] = this.
Body;
59 if (!
string.IsNullOrEmpty(this.
Icon))
60 WebPushNotification[
"icon"] = this.
Icon;
62 if (WebPushNotification.Count > 0)
63 WebPushConfig[
"notification"] = WebPushNotification;
65 if (WebPushFcmOptions.Count > 0)
66 WebPushConfig[
"fcm_options"] = WebPushFcmOptions;
72 foreach (KeyValuePair<string, object> P
in WebPushConfig2)
74 if (WebPushConfig.TryGetValue(P.Key, out
object Obj) &&
75 Obj is Dictionary<string, object> Obj1 &&
76 P.Value is Dictionary<string, object> Obj2)
78 foreach (KeyValuePair<string, object> P2
in Obj2)
79 Obj1[P2.Key] = P2.Value;
82 WebPushConfig[P.Key] = P.Value;
86 if (WebPushConfig.Count > 0)
87 Message[
"webpush"] = WebPushConfig;
101 this.Link = Value?.ToString();
105 this.Icon = Value?.ToString();
109 this.WebPushSpecificDeliveryOptions = Value;
113 return base.TrySetProperty(Name, Value);
Base class for Notification messages
bool SuppressNotification
If the visual notification part should be suppressed (data-only/background).
string Title
The notification's title.
string Body
The notification's body text.
Notification message for Web
override void ExportProperties(Dictionary< string, object > Message)
Prepares the object to send to Firebase.
object WebPushSpecificDeliveryOptions
Web-Push-specific delivery options.
NotificationMessageWeb()
Notification message for Web
override bool TrySetProperty(string Name, object Value)
Tries to set a property value.
string Icon
Icon to display with the notification.