diff --git a/config/mattermost-push-proxy.sample.json b/config/mattermost-push-proxy.sample.json index b1a1bd3..b4a931f 100644 --- a/config/mattermost-push-proxy.sample.json +++ b/config/mattermost-push-proxy.sample.json @@ -31,11 +31,13 @@ "AndroidPushSettings": [ { "Type":"android", - "ServiceFileLocation":"" + "ServiceFileLocation":"", + "UseBasicNotificationTemplate":false }, { "Type":"android_rn", - "ServiceFileLocation":"" + "ServiceFileLocation":"", + "UseBasicNotificationTemplate":false } ], "EnableConsoleLog": true, diff --git a/server/android_notification_server.go b/server/android_notification_server.go index c27feca..1d18c51 100644 --- a/server/android_notification_server.go +++ b/server/android_notification_server.go @@ -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) @@ -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), diff --git a/server/config_push_proxy.go b/server/config_push_proxy.go index bd84010..2149ec4 100644 --- a/server/config_push_proxy.go +++ b/server/config_push_proxy.go @@ -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