mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-22 11:02:06 -08:00
implement draft/webpush (#2205)
This commit is contained in:
parent
efd3764337
commit
36e5451aa5
44 changed files with 2091 additions and 100 deletions
26
vendor/github.com/ergochat/webpush-go/v2/urgency.go
generated
vendored
Normal file
26
vendor/github.com/ergochat/webpush-go/v2/urgency.go
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package webpush
|
||||
|
||||
// Urgency indicates to the push service how important a message is to the user.
|
||||
// This can be used by the push service to help conserve the battery life of a user's device
|
||||
// by only waking up for important messages when battery is low.
|
||||
type Urgency string
|
||||
|
||||
const (
|
||||
// UrgencyVeryLow requires device state: on power and Wi-Fi
|
||||
UrgencyVeryLow Urgency = "very-low"
|
||||
// UrgencyLow requires device state: on either power or Wi-Fi
|
||||
UrgencyLow Urgency = "low"
|
||||
// UrgencyNormal excludes device state: low battery
|
||||
UrgencyNormal Urgency = "normal"
|
||||
// UrgencyHigh admits device state: low battery
|
||||
UrgencyHigh Urgency = "high"
|
||||
)
|
||||
|
||||
// Checking allowable values for the urgency header
|
||||
func isValidUrgency(urgency Urgency) bool {
|
||||
switch urgency {
|
||||
case UrgencyVeryLow, UrgencyLow, UrgencyNormal, UrgencyHigh:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue