From 8554a68c470d3b7e801ffcdc6ca5213670542d91 Mon Sep 17 00:00:00 2001
From: Anne van Kesteren
+ A 64-bit unsigned integer is an integer in the range 0 to
+ 18446744073709551615 (264 − 1), inclusive.
+
+ A 32-bit unsigned integer is an integer in the range 0 to 4294967295
+ (232 − 1), inclusive.
+
- A JSON object consisting of the following members, many being analogous to
- Notifications API features. [[NOTIFICATIONS]]
+ A JSON object consisting of the following members, all analogous to Notifications
+ API features, though sometimes with a slightly stricter type. Apart from
+
}
}
+
+ Miscellaneous
+
+
Members
@@ -217,8 +230,10 @@
title
all members are derived from the {{NotificationOptions}}
+ dictionary and are expected to be maintained in tandem. [[NOTIFICATIONS]]
url
(required)
+ navigate
(required)
@@ -269,6 +284,14 @@
image
+ + A string that holds a URL. +
+icon
badge
+ + A string that holds a URL. +
+vibrate
+ + An array of [=32-bit unsigned integers=]. +
+timestamp
+ + A [=64-bit unsigned integer=]. +
+renotify
+ + A boolean. +
+silent
require_interaction
+ + A boolean. +
+data
actions
+ + An array of JSON objects consisting of the following members, all derived from + the {{NotificationAction}} dictionary and to be maintained in tandem. +
+action
(required)
+ + A string. +
+title
(required)
+ + A string. +
+navigate
(required)
+ + A string that holds a URL. +
+icon
+ + A string that holds a URL. +
+- An integer in the range 0 to 18446744073709551615 (264 − 1), inclusive. + A [=64-bit unsigned integer=].
Platform conventions are likely to impose a lower limit with regards to what is @@ -350,12 +456,8 @@
- If message["`web_push`"] does not [=map/exist=], then return failure. -
-- If message["`web_push`"] is not 8030, then return failure. + If message["`web_push`"] does not [=map/exist=] or is not 8030, then + return failure.
- If notificationInput["`dir`"] [=map/exists=] and - notificationInput["`dir`"] is "`auto`", "`ltr`", or "`rtl`", then set - notificationOptions["{{NotificationOptions/dir}}"] to - notificationInput["`dir`"]. + If notificationInput["`dir`"] [=map/exists=] and is "`auto`", "`ltr`", + or "`rtl`", then set notificationOptions["{{NotificationOptions/dir}}"] + to notificationInput["`dir`"].
- If notificationInput["`lang`"] [=map/exists=] and - notificationInput["`lang`"] is a string, then set + If notificationInput["`lang`"] [=map/exists=] and is a string, then set notificationOptions["{{NotificationOptions/lang}}"] to notificationInput["`lang`"].
- If notificationInput["`body`"] [=map/exists=] and - notificationInput["`body`"] is a string, then set + If notificationInput["`body`"] [=map/exists=] and is a string, then set notificationOptions["{{NotificationOptions/body}}"] to notificationInput["`body`"].
@@ -429,28 +528,70 @@- If notificationInput["`tag`"] [=map/exists=] and - notificationInput["`tag`"] is a string, then set + If notificationInput["`tag`"] [=map/exists=] and is a string, then set notificationOptions["{{NotificationOptions/tag}}"] to notificationInput["`tag`"].
- If notificationInput["`icon`"] [=map/exists=] and - notificationInput["`icon`"] is a string, then set + If notificationInput["`image`"] [=map/exists=] and is a string, then set + notificationOptions["{{NotificationOptions/image}}"] to + notificationInput["`image`"], [=string/converted=]. +
++ If notificationInput["`icon`"] [=map/exists=] and is a string, then set notificationOptions["{{NotificationOptions/icon}}"] to notificationInput["`icon`"], [=string/converted=].
- If notificationInput["`silent`"] [=map/exists=] and - notificationInput["`silent`"] is a boolean, then set - notificationOptions["{{NotificationOptions/silent}}"] to + If notificationInput["`badge`"] [=map/exists=] and is a string, then set + notificationOptions["{{NotificationOptions/badge}}"] to + notificationInput["`badge`"], [=string/converted=]. +
++ If notificationInput["`vibrate`"] [=map/exists=] and is a [=/list=] of + which each [=list/item=] is a [=32-bit unsigned integer=], then set + notificationOptions["{{NotificationOptions/vibrate}}"] to + notificationInput["`vibrate`"]. +
++ If notificationInput["`timestamp`"] [=map/exists=] and is a [=64-bit + unsigned integer=], then set + notificationOptions["{{NotificationOptions/timestamp}}"] to + notificationInput["`timestamp`"]. +
++ If notificationInput["`renotify`"] [=map/exists=] and is a boolean, then + set notificationOptions["{{NotificationOptions/renotify}}"] to + notificationInput["`renotify`"]. +
++ If notificationInput["`silent`"] [=map/exists=] and is a boolean, then + set notificationOptions["{{NotificationOptions/silent}}"] to notificationInput["`silent`"].
+ If notificationInput["`require_interaction`"] [=map/exists=] and is a + boolean, then set + notificationOptions["{{NotificationOptions/requireInteraction}}"] to + notificationInput["`require_interaction`"]. +
+If notificationInput["`data`"] [=map/exists=], then set @@ -459,6 +600,79 @@
+ If notificationInput["`actions`"] [=map/exists=] and is a [=/list=]: +
++ Let notificationActions be « ». +
++ [=list/For each=] actionInput of + notificationInput["`actions`"]: +
++ If actionInput["`action`"] does not [=map/exist=] or is not a + string, then [=iteration/continue=]. +
++ If actionInput["`title`"] does not [=map/exist=] or is not a + string, then [=iteration/continue=]. +
++ If actionInput["`navigate`"] does not [=map/exist=] or is not a + string, then [=iteration/continue=]. +
++ Let actionNavigate be actionInput["`navigate`"], + [=string/converted=]. +
++ Let notificationAction be the {{NotificationAction}} dictionary + «[ "{{NotificationAction/action}}" → actionInput["`action`"], + "{{NotificationAction/title}}" → actionInput["`title`"], + "{{NotificationAction/navigate}}" → actionNavigate ]». +
++ If actionInput["`icon`"] [=map/exists=] and is a string, then + set notificationAction["{{NotificationAction/icon}}"] to + actionInput["`icon`"], [=string/converted=]. +
++ [=list/Append=] notificationAction to + notificationActions. +
++ Set notificationOptions["{{NotificationOptions/actions}}"] to + notificationActions. +
+Let notification be the result of failure.
+ If the [=action/navigation URL=] of any [=/action=] of notification's + [=notification/actions=] is null, then return failure. +
+Let appBadge be null. @@ -482,9 +702,8 @@
If message["`app_badge`"] [=map/exists=] and - message["`app_badge`"] is an integer in the range 0 to - 18446744073709551615 (264 − 1), inclusive, then set appBadge - to message["`app_badge`"]. + message["`app_badge`"] is a [=64-bit unsigned integer=], then set + appBadge to message["`app_badge`"].