diff --git a/MacOS-11+/BlueBubblesHelper.xcodeproj/project.pbxproj b/MacOS-11+/BlueBubblesHelper.xcodeproj/project.pbxproj index a41700e..098a663 100644 --- a/MacOS-11+/BlueBubblesHelper.xcodeproj/project.pbxproj +++ b/MacOS-11+/BlueBubblesHelper.xcodeproj/project.pbxproj @@ -662,7 +662,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 17; DEPLOYMENT_LOCATION = YES; DEVELOPMENT_TEAM = S6D73TBQQU; DSTROOT = /; @@ -677,7 +677,7 @@ INSTALL_PATH = "/Library/Application Support/MacEnhance/Plugins"; MACH_O_TYPE = mh_dylib; MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.0.14; + MARKETING_VERSION = 0.0.15; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.bluebubbles.messaging; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -698,7 +698,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 17; DEPLOYMENT_LOCATION = YES; DEVELOPMENT_TEAM = S6D73TBQQU; DSTROOT = /; @@ -713,7 +713,7 @@ INSTALL_PATH = "/Library/Application Support/MacEnhance/Plugins"; MACH_O_TYPE = mh_dylib; MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 0.0.14; + MARKETING_VERSION = 0.0.15; ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = com.bluebubbles.messaging; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/MacOS-11+/BlueBubblesHelper.xcworkspace/xcuserdata/tanay.xcuserdatad/UserInterfaceState.xcuserstate b/MacOS-11+/BlueBubblesHelper.xcworkspace/xcuserdata/tanay.xcuserdatad/UserInterfaceState.xcuserstate index 3acb20e..6430523 100644 Binary files a/MacOS-11+/BlueBubblesHelper.xcworkspace/xcuserdata/tanay.xcuserdatad/UserInterfaceState.xcuserstate and b/MacOS-11+/BlueBubblesHelper.xcworkspace/xcuserdata/tanay.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/MacOS-11+/BlueBubblesHelper/BlueBubblesHelper.m b/MacOS-11+/BlueBubblesHelper/BlueBubblesHelper.m index 4f7d888..cb8bb68 100644 --- a/MacOS-11+/BlueBubblesHelper/BlueBubblesHelper.m +++ b/MacOS-11+/BlueBubblesHelper/BlueBubblesHelper.m @@ -441,8 +441,8 @@ -(void) handleMessage: (NetworkController*)controller message:(NSString *)messa } else if ([event isEqualToString:@"send-multipart"]) { NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString: @""]; NSMutableArray *transfers = [[NSMutableArray alloc] init]; - NSUInteger index = 0; for (NSDictionary *dict in data[@"parts"]) { + NSUInteger index = [dict[@"partIndex"] integerValue]; if (dict[@"filePath"] != [NSNull null] && [dict[@"filePath"] length] != 0) { NSString *filePath = dict[@"filePath"]; NSURL * fileUrl = [NSURL fileURLWithPath:filePath]; @@ -458,33 +458,13 @@ -(void) handleMessage: (NetworkController*)controller message:(NSString *)messa [attributedString appendAttributedString:attachmentStr]; } else { if (dict[@"mention"] != [NSNull null] && [dict[@"mention"] length] != 0) { - NSMutableAttributedString *beforeStr = [[NSMutableAttributedString alloc] initWithString: [(NSString *) dict[@"text"] substringWithRange:NSMakeRange(0, [[dict[@"range"] firstObject] integerValue])]]; - [beforeStr addAttributes:@{ - @"__kIMBaseWritingDirectionAttributeName": @"-1", - @"__kIMMessagePartAttributeName": [NSNumber numberWithInt:index], - } range:NSMakeRange(0, [[beforeStr string] length])]; - NSMutableAttributedString *mentionStr = [[NSMutableAttributedString alloc] initWithString: [(NSString *) dict[@"text"] substringWithRange:NSMakeRange([[dict[@"range"] firstObject] integerValue], [[dict[@"range"] lastObject] integerValue])]]; + NSMutableAttributedString *mentionStr = [[NSMutableAttributedString alloc] initWithString: dict[@"text"]]; [mentionStr addAttributes:@{ @"__kIMBaseWritingDirectionAttributeName": @"-1", @"__kIMMentionConfirmedMention": dict[@"mention"], @"__kIMMessagePartAttributeName": [NSNumber numberWithInt:index], } range:NSMakeRange(0, [[mentionStr string] length])]; - NSUInteger begin = [[dict[@"range"] firstObject] integerValue] + [[dict[@"range"] lastObject] integerValue]; - NSUInteger end = [dict[@"text"] length] - begin; - NSMutableAttributedString *afterStr = [[NSMutableAttributedString alloc] initWithString: [(NSString *) dict[@"text"] substringWithRange:NSMakeRange(begin, end)]]; - [afterStr addAttributes:@{ - @"__kIMBaseWritingDirectionAttributeName": @"-1", - @"__kIMMessagePartAttributeName": [NSNumber numberWithInt:index], - } range:NSMakeRange(0, [[afterStr string] length])]; - if ([[beforeStr string] length] != 0) { - [attributedString appendAttributedString:beforeStr]; - } - if ([[mentionStr string] length] != 0) { - [attributedString appendAttributedString:mentionStr]; - } - if ([[afterStr string] length] != 0) { - [attributedString appendAttributedString:afterStr]; - } + [attributedString appendAttributedString:mentionStr]; } else { NSMutableAttributedString *messageStr = [[NSMutableAttributedString alloc] initWithString: dict[@"text"]]; [messageStr addAttributes:@{ @@ -494,7 +474,6 @@ -(void) handleMessage: (NetworkController*)controller message:(NSString *)messa [attributedString appendAttributedString:messageStr]; } } - index++; } [BlueBubblesHelper sendMessage:(data) transfers:[transfers copy] attributedString:attributedString transaction:(transaction)]; // If the server tells us to get the vetted aliases