fix_: logging cli join group, small logging issue missing id, init online state to current state (#5407)

This commit is contained in:
Pablo Lopez 2024-06-24 10:16:05 +03:00 committed by GitHub
parent 1d1d6e3276
commit 39dffd8b70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View File

@ -68,6 +68,13 @@ func serve(cCtx *cli.Context) error {
}
}
}
case "local-notifications":
var ev LocalNotification
if err := json.Unmarshal(evt.Event, &ev); err != nil {
logger.Error("unmarshaling local notification event", zap.Error(err), zap.Any("event", evt.Event))
return
}
logger.Infof("local notification: %v, title: %v, id: %v", ev.Category, ev.Title, ev.ID)
default:
logger.Debugf("received event type '%v'\t%v", evt.Type, string(evt.Event))
}
@ -109,6 +116,12 @@ type EventNewMessages struct {
Messages []*common.Message `json:"messages"`
}
type LocalNotification struct {
ID string `json:"id"`
Title string `json:"title"`
Category string `json:"category"`
}
func waitForSigExit() {
sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)

View File

@ -1458,7 +1458,7 @@ func (m *Messenger) handleENSVerificationSubscription(c chan []*ens.Verification
// watchConnectionChange checks the connection status and call handleConnectionChange when this changes
func (m *Messenger) watchConnectionChange() {
state := false
state := m.Online()
processNewState := func(newState bool) {
if state == newState {
@ -1495,11 +1495,9 @@ func (m *Messenger) watchConnectionChange() {
}
m.logger.Debug("watching connection changes")
m.Online()
m.handleConnectionChange(state)
waku, err := m.node.GetWakuV2(nil)
if err != nil {
// No waku v2, we can't watch connection changes
// Instead we will poll the connection status.
@ -3889,7 +3887,7 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
for _, msg := range statusMessages {
logger := logger.With(zap.String("message-id", msg.ApplicationLayer.ID.String()))
logger.Info("processing message")
publicKey := msg.SigPubKey()
m.handleInstallations(msg.EncryptionLayer.Installations)
@ -3901,7 +3899,7 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
senderID := contactIDFromPublicKey(publicKey)
ownID := contactIDFromPublicKey(m.IdentityPublicKey())
m.logger.Info("processing message", zap.Any("type", msg.ApplicationLayer.Type), zap.String("senderID", senderID))
logger.Info("processing message", zap.Any("type", msg.ApplicationLayer.Type), zap.String("senderID", senderID))
if senderID == ownID {
// Skip own messages of certain types