Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions config/mattermost-push-proxy.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"AndroidPushSettings": [
{
"Type":"android",
"ServiceFileLocation":""
"ServiceFileLocation":"",
"UseBasicNotificationTemplate":false
},
{
"Type":"android_rn",
"ServiceFileLocation":""
"ServiceFileLocation":"",
"UseBasicNotificationTemplate":false
}
],
"EnableConsoleLog": true,
Expand Down
11 changes: 11 additions & 0 deletions server/android_notification_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func (me *AndroidNotificationServer) Initialize() error {
return errors.New("Android push notifications not configured. Missing ServiceFileLocation.")
}

if me.AndroidPushSettings.UseBasicNotificationTemplate {
me.logger.Info("AndroidPushSettings.UseBasicNotificationTemplate enabled")
}

jsonKey, err := os.ReadFile(me.AndroidPushSettings.ServiceFileLocation)
if err != nil {
return fmt.Errorf("error reading service file: %v", err)
Expand Down Expand Up @@ -170,6 +174,13 @@ func (me *AndroidNotificationServer) SendNotification(msg *PushNotification) Pus
},
}

if me.AndroidPushSettings.UseBasicNotificationTemplate {
fcmMsg.Notification = &messaging.Notification{
Title: msg.ChannelName,
Body: emoji.Sprint(msg.Message),
}
}

me.logger.Info(
"Sending android push notification",
mlog.String("device", me.AndroidPushSettings.Type),
Expand Down
7 changes: 4 additions & 3 deletions server/config_push_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ type ApplePushSettings struct {
}

type AndroidPushSettings struct {
Type string
AndroidAPIKey string `json:"AndroidApiKey"`
ServiceFileLocation string `json:"ServiceFileLocation"`
Type string
AndroidAPIKey string `json:"AndroidApiKey"`
ServiceFileLocation string `json:"ServiceFileLocation"`
UseBasicNotificationTemplate bool `json:"UseBasicNotificationTemplate"`
}

// FindConfigFile searches for the filepath in a list of directories
Expand Down