feat(BRIDGE-37): Remote notification support

This commit is contained in:
Atanas Janeshliev
2024-08-29 13:31:37 +02:00
parent ed1b65731a
commit f04350c046
43 changed files with 2350 additions and 1168 deletions

View File

@ -45,6 +45,7 @@ import (
"github.com/ProtonMail/proton-bridge/v3/internal/safe"
"github.com/ProtonMail/proton-bridge/v3/internal/sentry"
"github.com/ProtonMail/proton-bridge/v3/internal/services/imapsmtpserver"
"github.com/ProtonMail/proton-bridge/v3/internal/services/notifications"
"github.com/ProtonMail/proton-bridge/v3/internal/services/observability"
"github.com/ProtonMail/proton-bridge/v3/internal/services/syncservice"
"github.com/ProtonMail/proton-bridge/v3/internal/telemetry"
@ -144,6 +145,9 @@ type Bridge struct {
// observabilityService is responsible for handling calls to the observability system
observabilityService *observability.Service
// notificationStore is used for notification deduplication
notificationStore *notifications.Store
}
var logPkg = logrus.WithField("pkg", "bridge") //nolint:gochecknoglobals
@ -307,6 +311,8 @@ func newBridge(
unleashService: unleashService,
observabilityService: observability.NewService(ctx, panicHandler),
notificationStore: notifications.NewStore(locator.ProvideNotificationsCachePath),
}
bridge.serverManager = imapsmtpserver.NewService(context.Background(),

View File

@ -34,6 +34,7 @@ type Locator interface {
Clear(...string) error
ProvideIMAPSyncConfigPath() (string, error)
ProvideUnleashCachePath() (string, error)
ProvideNotificationsCachePath() (string, error)
}
type ProxyController interface {

View File

@ -569,6 +569,9 @@ func (bridge *Bridge) addUserWithVault(
bridge.observabilityService,
syncSettingsPath,
isNew,
bridge.notificationStore,
bridge.unleashService.GetFlagValue,
bridge.observabilityService.AddMetric,
)
if err != nil {
return fmt.Errorf("failed to create user: %w", err)