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

@ -38,6 +38,7 @@ type EventHandler struct {
MessageHandler MessageEventHandler
UsedSpaceHandler UserUsedSpaceEventHandler
UserSettingsHandler UserSettingsHandler
NotificationHandler NotificationEventHandler
}
func (e EventHandler) OnEvent(ctx context.Context, event proton.Event) error {
@ -87,6 +88,12 @@ func (e EventHandler) OnEvent(ctx context.Context, event proton.Event) error {
}
}
if len(event.Notifications) != 0 && e.NotificationHandler != nil {
if err := e.NotificationHandler.HandleNotificationEvents(ctx, event.Notifications); err != nil {
return fmt.Errorf("failed to apply notification events: %w", err)
}
}
return nil
}
@ -116,3 +123,7 @@ type LabelEventHandler interface {
type MessageEventHandler interface {
HandleMessageEvents(ctx context.Context, events []proton.MessageEvent) error
}
type NotificationEventHandler interface {
HandleNotificationEvents(ctx context.Context, events []proton.NotificationEvent) error
}