mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-29 00:16:20 +00:00
Sync with mattermost 3.4.0
This commit is contained in:
15
vendor/github.com/mattermost/platform/model/push_notification.go
generated
vendored
15
vendor/github.com/mattermost/platform/model/push_notification.go
generated
vendored
@ -6,12 +6,16 @@ package model
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
PUSH_NOTIFY_APPLE = "apple"
|
||||
PUSH_NOTIFY_ANDROID = "android"
|
||||
|
||||
PUSH_TYPE_MESSAGE = "message"
|
||||
PUSH_TYPE_CLEAR = "clear"
|
||||
|
||||
CATEGORY_DM = "DIRECT_MESSAGE"
|
||||
|
||||
MHPNS = "https://push.mattermost.com"
|
||||
@ -28,6 +32,7 @@ type PushNotification struct {
|
||||
ContentAvailable int `json:"cont_ava"`
|
||||
ChannelId string `json:"channel_id"`
|
||||
ChannelName string `json:"channel_name"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
func (me *PushNotification) ToJson() string {
|
||||
@ -39,6 +44,16 @@ func (me *PushNotification) ToJson() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (me *PushNotification) SetDeviceIdAndPlatform(deviceId string) {
|
||||
if strings.HasPrefix(deviceId, PUSH_NOTIFY_APPLE+":") {
|
||||
me.Platform = PUSH_NOTIFY_APPLE
|
||||
me.DeviceId = strings.TrimPrefix(deviceId, PUSH_NOTIFY_APPLE+":")
|
||||
} else if strings.HasPrefix(deviceId, PUSH_NOTIFY_ANDROID+":") {
|
||||
me.Platform = PUSH_NOTIFY_ANDROID
|
||||
me.DeviceId = strings.TrimPrefix(deviceId, PUSH_NOTIFY_ANDROID+":")
|
||||
}
|
||||
}
|
||||
|
||||
func PushNotificationFromJson(data io.Reader) *PushNotification {
|
||||
decoder := json.NewDecoder(data)
|
||||
var me PushNotification
|
||||
|
Reference in New Issue
Block a user