Parse gift badges on incoming sync messages
This allows outgoing gift messages from other devices to be shown.
This commit is contained in:
parent
4fb4c29c80
commit
ea0986b676
@ -120,7 +120,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
additionalRecipients:nil
|
||||
storyAuthorAddress:transcript.storyAuthorAddress
|
||||
storyTimestamp:transcript.storyTimestamp
|
||||
storyReactionEmoji:nil] buildWithTransaction:transaction];
|
||||
storyReactionEmoji:nil
|
||||
giftBadge:transcript.giftBadge] buildWithTransaction:transaction];
|
||||
|
||||
SignalServiceAddress *_Nullable localAddress = self.tsAccountManager.localAddress;
|
||||
if (localAddress == nil) {
|
||||
|
||||
@ -8,6 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class MessageBodyRanges;
|
||||
@class MessageSticker;
|
||||
@class OWSContact;
|
||||
@class OWSGiftBadge;
|
||||
@class OWSLinkPreview;
|
||||
@class SDSAnyWriteTransaction;
|
||||
@class SSKProtoAttachmentPointer;
|
||||
@ -47,6 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, readonly, nullable) TSQuotedMessage *quotedMessage;
|
||||
@property (nonatomic, readonly, nullable) OWSContact *contact;
|
||||
@property (nonatomic, readonly, nullable) OWSLinkPreview *linkPreview;
|
||||
@property (nonatomic, readonly, nullable) OWSGiftBadge *giftBadge;
|
||||
@property (nonatomic, readonly, nullable) MessageSticker *messageSticker;
|
||||
@property (nonatomic, readonly) BOOL isRecipientUpdate;
|
||||
@property (nonatomic, readonly) BOOL isViewOnceMessage;
|
||||
|
||||
@ -209,6 +209,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
OWSLogError(@"linkPreviewError: %@", linkPreviewError);
|
||||
}
|
||||
|
||||
_giftBadge = [OWSGiftBadge maybeBuildFromDataMessage:_dataMessage];
|
||||
|
||||
NSError *stickerError;
|
||||
_messageSticker = [MessageSticker buildValidatedMessageStickerWithDataMessage:_dataMessage
|
||||
transaction:transaction
|
||||
|
||||
@ -100,7 +100,8 @@ public class TSOutgoingMessageBuilder: TSMessageBuilder {
|
||||
additionalRecipients: [SignalServiceAddress]?,
|
||||
storyAuthorAddress: SignalServiceAddress?,
|
||||
storyTimestamp: NSNumber?,
|
||||
storyReactionEmoji: String?) -> TSOutgoingMessageBuilder {
|
||||
storyReactionEmoji: String?,
|
||||
giftBadge: OWSGiftBadge?) -> TSOutgoingMessageBuilder {
|
||||
return TSOutgoingMessageBuilder(thread: thread,
|
||||
timestamp: timestamp,
|
||||
messageBody: messageBody,
|
||||
@ -119,7 +120,8 @@ public class TSOutgoingMessageBuilder: TSMessageBuilder {
|
||||
additionalRecipients: additionalRecipients,
|
||||
storyAuthorAddress: storyAuthorAddress,
|
||||
storyTimestamp: storyTimestamp?.uint64Value,
|
||||
storyReactionEmoji: storyReactionEmoji)
|
||||
storyReactionEmoji: storyReactionEmoji,
|
||||
giftBadge: giftBadge)
|
||||
}
|
||||
|
||||
private var hasBuilt = false
|
||||
|
||||
@ -142,7 +142,8 @@ public class OutgoingMessageFactory: NSObject, Factory {
|
||||
additionalRecipients: additionalRecipientsBuilder(),
|
||||
storyAuthorAddress: storyAuthorAddressBuilder(),
|
||||
storyTimestamp: storyTimestampBuilder(),
|
||||
storyReactionEmoji: storyReactionEmojiBuilder()).build(transaction: transaction)
|
||||
storyReactionEmoji: storyReactionEmojiBuilder(),
|
||||
giftBadge: giftBadgeBuilder()).build(transaction: transaction)
|
||||
}
|
||||
|
||||
@objc
|
||||
@ -252,6 +253,11 @@ public class OutgoingMessageFactory: NSObject, Factory {
|
||||
return nil
|
||||
}
|
||||
|
||||
@objc
|
||||
public var giftBadgeBuilder: () -> OWSGiftBadge? = {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MARK: Delivery Receipts
|
||||
|
||||
@objc
|
||||
|
||||
Loading…
Reference in New Issue
Block a user