in messaging/messaging_utils.go [98:124]
func validateAndroidNotification(notification *AndroidNotification) error {
if notification == nil {
return nil
}
if notification.Color != "" && !colorPattern.MatchString(notification.Color) {
return fmt.Errorf("color must be in the #RRGGBB form")
}
if len(notification.TitleLocArgs) > 0 && notification.TitleLocKey == "" {
return fmt.Errorf("titleLocKey is required when specifying titleLocArgs")
}
if len(notification.BodyLocArgs) > 0 && notification.BodyLocKey == "" {
return fmt.Errorf("bodyLocKey is required when specifying bodyLocArgs")
}
image := notification.ImageURL
if image != "" {
if _, err := url.ParseRequestURI(image); err != nil {
return fmt.Errorf("invalid image URL: %q", image)
}
}
for _, timing := range notification.VibrateTimingMillis {
if timing < 0 {
return fmt.Errorf("vibrateTimingMillis must not be negative")
}
}
return validateLightSettings(notification.LightSettings)
}