Skip to content

Commit

Permalink
properly convert BB tapback to TapbackType
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuafhiggins committed Apr 10, 2024
1 parent 1140673 commit cf1d86f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion imessage/bluebubbles/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@ func (bb *blueBubbles) convertBBMessageToiMessage(bbMessage Message) (*imessage.
bbMessage.AssociatedMessageType != "" {
message.Tapback = &imessage.Tapback{
TargetGUID: bbMessage.AssociatedMessageGUID,
Type: imessage.TapbackFromName(bbMessage.AssociatedMessageType),
Type: bb.convertBBTapbackToImessageTapback(bbMessage.AssociatedMessageType),
}
message.Tapback.Parse()
} else {
Expand Down Expand Up @@ -1713,6 +1713,27 @@ func (bb *blueBubbles) convertBBMessageToiMessage(bbMessage Message) (*imessage.
return &message, nil
}

func (bb *blueBubbles) convertBBTapbackToImessageTapback(associatedMessageType string) (tbType imessage.TapbackType) {
if strings.Contains(associatedMessageType, "love") {
tbType = imessage.TapbackLove
} else if strings.Contains(associatedMessageType, "like") {
tbType = imessage.TapbackLike
} else if strings.Contains(associatedMessageType, "dislike") {
tbType = imessage.TapbackDislike
} else if strings.Contains(associatedMessageType, "laugh") {
tbType = imessage.TapbackLaugh
} else if strings.Contains(associatedMessageType, "emphasize") {
tbType = imessage.TapbackEmphasis
} else if strings.Contains(associatedMessageType, "question") {
tbType = imessage.TapbackQuestion
}

if strings.Contains(associatedMessageType, "-") {
tbType += imessage.TapbackRemoveOffset
}
return tbType
}

func (bb *blueBubbles) convertBBChatToiMessageChat(bbChat Chat) (*imessage.ChatInfo, error) {
members := make([]string, len(bbChat.Participants))

Expand Down

0 comments on commit cf1d86f

Please sign in to comment.