forked from Silverfish/proton-bridge
feat(BRIDGE-37): Remote notification support
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -277,6 +277,7 @@ message AppEvent {
|
||||
KnowledgeBaseSuggestionsEvent knowledgeBaseSuggestions = 12;
|
||||
RepairStartedEvent repairStarted = 13;
|
||||
AllUsersLoadedEvent allUsersLoaded = 14;
|
||||
UserNotificationEvent userNotification = 15;
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,6 +546,14 @@ message SyncProgressEvent {
|
||||
int64 remainingMs = 4;
|
||||
}
|
||||
|
||||
message UserNotificationEvent {
|
||||
string title = 1;
|
||||
string subtitle = 2;
|
||||
string body = 3;
|
||||
string userID = 4;
|
||||
}
|
||||
|
||||
|
||||
//**********************************************************
|
||||
// Generic errors
|
||||
//**********************************************************
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/events"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/kb"
|
||||
"github.com/bradenaw/juniper/xslices"
|
||||
)
|
||||
@ -249,6 +250,16 @@ func NewAllUsersLoadedEvent() *StreamEvent {
|
||||
return appEvent(&AppEvent{Event: &AppEvent_AllUsersLoaded{AllUsersLoaded: &AllUsersLoadedEvent{}}})
|
||||
}
|
||||
|
||||
func NewUserNotificationEvent(event events.UserNotification) *StreamEvent {
|
||||
return appEvent(&AppEvent{Event: &AppEvent_UserNotification{
|
||||
UserNotification: &UserNotificationEvent{
|
||||
UserID: event.UserID,
|
||||
Title: event.Title,
|
||||
Subtitle: event.Subtitle,
|
||||
Body: event.Body,
|
||||
}}})
|
||||
}
|
||||
|
||||
// Event category factory functions.
|
||||
|
||||
func appEvent(appEvent *AppEvent) *StreamEvent {
|
||||
|
||||
@ -404,6 +404,9 @@ func (s *Service) watchEvents() {
|
||||
|
||||
case events.AllUsersLoaded:
|
||||
_ = s.SendEvent(NewAllUsersLoadedEvent())
|
||||
|
||||
case events.UserNotification:
|
||||
_ = s.SendEvent(NewUserNotificationEvent(event))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user