feat: mark automatic status updates as ephemeral
This commit is contained in:
parent
f33c1cec38
commit
0f7c9f52d8
|
@ -103,6 +103,7 @@ func (w *gethPublicWakuAPIWrapper) Post(ctx context.Context, req types.NewMessag
|
|||
PowTime: req.PowTime,
|
||||
PowTarget: req.PowTarget,
|
||||
TargetPeer: req.TargetPeer,
|
||||
Ephemeral: req.Ephemeral,
|
||||
}
|
||||
return w.api.Post(ctx, msg)
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ func (w *gethPublicWakuV2APIWrapper) Post(ctx context.Context, req types.NewMess
|
|||
Payload: req.Payload,
|
||||
Padding: req.Padding,
|
||||
TargetPeer: req.TargetPeer,
|
||||
Ephemeral: req.Ephemeral,
|
||||
}
|
||||
return w.api.Post(ctx, msg)
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ type NewMessage struct {
|
|||
PowTime uint32 `json:"powTime"`
|
||||
PowTarget float64 `json:"powTarget"`
|
||||
TargetPeer string `json:"targetPeer"`
|
||||
Ephemeral bool `json:"ephemeral"`
|
||||
}
|
||||
|
||||
// Message is the RPC representation of a whisper message.
|
||||
|
|
|
@ -551,6 +551,8 @@ func (s *MessageSender) SendPublic(
|
|||
}
|
||||
}
|
||||
|
||||
newMessage.Ephemeral = rawMessage.Ephemeral
|
||||
|
||||
messageID := v1protocol.MessageID(&rawMessage.Sender.PublicKey, wrappedMessage)
|
||||
rawMessage.ID = types.EncodeHex(messageID)
|
||||
|
||||
|
|
|
@ -33,4 +33,5 @@ type RawMessage struct {
|
|||
SendOnPersonalTopic bool
|
||||
CommunityID []byte
|
||||
CommunityKeyExMsgType CommKeyExMsgType
|
||||
Ephemeral bool
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ func (m *Messenger) sendUserStatus(ctx context.Context, status UserStatus) error
|
|||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_STATUS_UPDATE,
|
||||
ResendAutomatically: true,
|
||||
Ephemeral: statusUpdate.StatusType == protobuf.StatusUpdate_AUTOMATIC,
|
||||
}
|
||||
|
||||
_, err = m.sender.SendPublic(ctx, contactCodeTopic, rawMessage)
|
||||
|
@ -168,6 +169,7 @@ func (m *Messenger) sendCurrentUserStatusToCommunity(ctx context.Context, commun
|
|||
Payload: encodedMessage,
|
||||
MessageType: protobuf.ApplicationMetadataMessage_STATUS_UPDATE,
|
||||
ResendAutomatically: true,
|
||||
Ephemeral: statusUpdate.StatusType == protobuf.StatusUpdate_AUTOMATIC,
|
||||
}
|
||||
|
||||
_, err = m.sender.SendPublic(ctx, rawMessage.LocalChatID, rawMessage)
|
||||
|
|
|
@ -222,6 +222,7 @@ type NewMessage struct {
|
|||
PowTime uint32 `json:"powTime"`
|
||||
PowTarget float64 `json:"powTarget"`
|
||||
TargetPeer string `json:"targetPeer"`
|
||||
Ephemeral bool `json:"ephemeral"`
|
||||
}
|
||||
|
||||
// Post posts a message on the Waku network.
|
||||
|
|
|
@ -179,6 +179,7 @@ type NewMessage struct {
|
|||
Payload []byte `json:"payload"`
|
||||
Padding []byte `json:"padding"`
|
||||
TargetPeer string `json:"targetPeer"`
|
||||
Ephemeral bool `json:"ephemeral"`
|
||||
}
|
||||
|
||||
// Post posts a message on the Waku network.
|
||||
|
@ -253,6 +254,7 @@ func (api *PublicWakuAPI) Post(ctx context.Context, req NewMessage) (hexutil.Byt
|
|||
Version: version,
|
||||
ContentTopic: req.Topic.ContentTopic(),
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
Ephemeral: req.Ephemeral,
|
||||
}
|
||||
|
||||
hash, err := api.w.Send(wakuMsg)
|
||||
|
|
Loading…
Reference in New Issue