Add feature flag for push notifications and bump version

This commit is contained in:
Andrea Maria Piana 2020-07-27 17:20:16 +02:00
parent 4ae2c59e9b
commit 45815e57d7
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
5 changed files with 13 additions and 2 deletions

View File

@ -1 +1 @@
0.56.0
0.56.1

View File

@ -5,4 +5,7 @@ type FeatureFlags struct {
// using datasync, breaking change for non-v1 clients. Public messages
// are not impacted
Datasync bool
// PushNotification indicates whether we should be enabling the push notification feature
PushNotifications bool
}

View File

@ -1459,7 +1459,7 @@ func (m *Messenger) SendChatMessage(ctx context.Context, message *Message) (*Mes
id, err := m.dispatchMessage(ctx, &common.RawMessage{
LocalChatID: chat.ID,
SendPushNotification: !chat.Public(),
SendPushNotification: m.featureFlags.PushNotifications && !chat.Public(),
Payload: encodedMessage,
MessageType: protobuf.ApplicationMetadataMessage_CHAT_MESSAGE,
ResendAutomatically: true,

View File

@ -116,6 +116,13 @@ func WithDatasync() func(c *config) error {
}
}
func WithPushNotifications() func(c *config) error {
return func(c *config) error {
c.featureFlags.PushNotifications = true
return nil
}
}
func WithEnvelopesMonitorConfig(emc *transport.EnvelopesMonitorConfig) Option {
return func(c *config) error {
c.envelopesMonitorConfig = emc

View File

@ -88,6 +88,7 @@ func (s *MessengerPushNotificationSuite) newMessengerWithKey(shh types.Waku, pri
WithMessagesPersistenceEnabled(),
WithDatabaseConfig(tmpFile.Name(), ""),
WithDatasync(),
WithPushNotifications(),
}
return s.newMessengerWithOptions(shh, privateKey, options)
}