Skip to content

Commit

Permalink
Fix tapback text in DB
Browse files Browse the repository at this point in the history
  • Loading branch information
tneotia committed Oct 5, 2022
1 parent 27a7dd3 commit 18fd23f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Binary file not shown.
30 changes: 15 additions & 15 deletions MacOS-11+/BlueBubblesHelper/BlueBubblesHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -418,18 +418,18 @@ +(long long) parseReactionType:(NSString *)reactionType {
+(NSString *) reactionToVerb:(NSString *)reactionType {
NSString *lowerCaseType = [reactionType lowercaseString];

if([@"love" isEqualToString:(lowerCaseType)]) return @"Loved an attachment";
if([@"like" isEqualToString:(lowerCaseType)]) return @"Liked an attachment";
if([@"dislike" isEqualToString:(lowerCaseType)]) return @"Disliked an attachment";
if([@"laugh" isEqualToString:(lowerCaseType)]) return @"Laughed at an attachment";
if([@"emphasize" isEqualToString:(lowerCaseType)]) return @"Emphasized an attachment";
if([@"question" isEqualToString:(lowerCaseType)]) return @"Questioned an attachment";
if([@"-love" isEqualToString:(lowerCaseType)]) return @"Removed a heart from an attachment";
if([@"-like" isEqualToString:(lowerCaseType)]) return @"Removed a like from an attachment";
if([@"-dislike" isEqualToString:(lowerCaseType)]) return @"Removed a dislike from an attachment";
if([@"-laugh" isEqualToString:(lowerCaseType)]) return @"Removed a laugh from an attachment";
if([@"-emphasize" isEqualToString:(lowerCaseType)]) return @"Removed an exclamation from an attachment";
if([@"-question" isEqualToString:(lowerCaseType)]) return @"Removed a question mark from an attachment";
if([@"love" isEqualToString:(lowerCaseType)]) return @"Loved ";
if([@"like" isEqualToString:(lowerCaseType)]) return @"Liked ";
if([@"dislike" isEqualToString:(lowerCaseType)]) return @"Disliked ";
if([@"laugh" isEqualToString:(lowerCaseType)]) return @"Laughed at ";
if([@"emphasize" isEqualToString:(lowerCaseType)]) return @"Emphasized ";
if([@"question" isEqualToString:(lowerCaseType)]) return @"Questioned ";
if([@"-love" isEqualToString:(lowerCaseType)]) return @"Removed a heart from ";
if([@"-like" isEqualToString:(lowerCaseType)]) return @"Removed a like from ";
if([@"-dislike" isEqualToString:(lowerCaseType)]) return @"Removed a dislike from ";
if([@"-laugh" isEqualToString:(lowerCaseType)]) return @"Removed a laugh from ";
if([@"-emphasize" isEqualToString:(lowerCaseType)]) return @"Removed an exclamation from ";
if([@"-question" isEqualToString:(lowerCaseType)]) return @"Removed a question mark from ";
return @"";
}

Expand Down Expand Up @@ -535,11 +535,11 @@ +(void) sendMessage: (NSDictionary *) data transaction:(NSString *) transaction
NSString *encodevalue = [[NSString alloc]initWithData:dataenc encoding:NSUTF8StringEncoding];
NSRange range = NSMakeRange(0, [messageItem body].string.length);
if ([encodevalue isEqualToString:@"\\ufffc"]) {
// This is needed for a weird bug where sometimes the message preview is not generated correctly
NSMutableAttributedString *newAttributedString = [[NSMutableAttributedString alloc] initWithString: [BlueBubblesHelper reactionToVerb:(reaction)]];
NSMutableAttributedString *newAttributedString = [[NSMutableAttributedString alloc] initWithString: [[BlueBubblesHelper reactionToVerb:(reaction)] stringByAppendingString:(@"an attachment")]];
createMessage(newAttributedString, subjectAttributedString, effectId, nil, [messageItem guid], &reactionLong, range, @{});
} else {
createMessage(attributedString, subjectAttributedString, effectId, nil, [messageItem guid], &reactionLong, range, messageSummary);
NSMutableAttributedString *newAttributedString = [[NSMutableAttributedString alloc] initWithString: [[BlueBubblesHelper reactionToVerb:(reaction)] stringByAppendingString:([NSString stringWithFormat:(@"%@"), [messageItem body].string])]];
createMessage(newAttributedString, subjectAttributedString, effectId, nil, [messageItem guid], &reactionLong, range, messageSummary);
}
} else {
NSString *identifier = @"";
Expand Down

0 comments on commit 18fd23f

Please sign in to comment.