Remove unnecessary fetched message media downloading

This commit is contained in:
Tulir Asokan 2023-07-11 01:20:11 +03:00
parent 43ec0da6e9
commit 4f4b8818e5
2 changed files with 0 additions and 23 deletions

View file

@ -206,23 +206,6 @@ func (c *Client) setApiMethods() {
c.Messages = &Messages{client: c}
}
func (c *Client) decryptMedias(messages *binary.FetchMessagesResponse) error {
for _, msg := range messages.Messages {
for _, details := range msg.GetMessageInfo() {
switch data := details.GetData().(type) {
case *binary.MessageInfo_MediaContent:
decryptedMediaData, err := c.DownloadMedia(data.MediaContent.MediaID, data.MediaContent.DecryptionKey)
if err != nil {
panic(err)
return err
}
data.MediaContent.MediaData = decryptedMediaData
}
}
}
return nil
}
func (c *Client) DownloadMedia(mediaID string, key []byte) ([]byte, error) {
reqId := util.RandomUUIDv4()
download_metadata := &binary.UploadImagePayload{

View file

@ -87,12 +87,6 @@ func (c *Conversations) FetchMessages(conversationId string, count int64, cursor
return nil, fmt.Errorf("failed to assert response into FetchMessagesResponse")
}
decryptErr := c.client.decryptMedias(res)
if decryptErr != nil {
return nil, decryptErr
}
c.client.Logger.Debug().Any("messageData", res).Msg("fetchmessages")
return res, nil
}