Skip to content

Commit 8a91ee9

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 94dd89b + 0206a47 commit 8a91ee9

File tree

4 files changed

+44
-41
lines changed

4 files changed

+44
-41
lines changed

MacOS-11+/BlueBubblesHelper.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
A68E87E128C3B18900882823 /* IMSharedUtilities.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IMSharedUtilities.framework; path = ../../../../../System/Library/PrivateFrameworks/IMSharedUtilities.framework; sourceTree = "<group>"; };
8484
A69A83DE27D18092007BB936 /* IMDPersistentAttachmentController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IMDPersistentAttachmentController.h; sourceTree = "<group>"; };
8585
A69A83DF27D18385007BB936 /* IMDPersistence.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IMDPersistence.framework; path = ../../../../../System/Library/PrivateFrameworks/IMDPersistence.framework; sourceTree = "<group>"; };
86+
A6DAE8E729CCD09F00C23C79 /* SKStatusSubscriptionServiceDelegate-Protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SKStatusSubscriptionServiceDelegate-Protocol.h"; sourceTree = "<group>"; };
8687
A6E1F4CF27166012000A0EF6 /* IMPinnedConversationsController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IMPinnedConversationsController.h; sourceTree = "<group>"; };
8788
A6E7318229A3D37000AAED78 /* IMAggregateAttachmentMessagePartChatItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IMAggregateAttachmentMessagePartChatItem.h; sourceTree = "<group>"; };
8889
A6E7318329A3D49600AAED78 /* IMAttachmentMessagePartChatItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IMAttachmentMessagePartChatItem.h; sourceTree = "<group>"; };
@@ -224,6 +225,7 @@
224225
FBCE4EDB201C264F002F8A61 /* IMCore */ = {
225226
isa = PBXGroup;
226227
children = (
228+
A6DAE8E729CCD09F00C23C79 /* SKStatusSubscriptionServiceDelegate-Protocol.h */,
227229
A64B8891271232E200BAD446 /* IMChatItem.h */,
228230
A64B8893271232E300BAD446 /* IMInlineReplyController.h */,
229231
A64B8892271232E200BAD446 /* IMSendProgressDelegate-Protocol.h */,
@@ -660,7 +662,7 @@
660662
CODE_SIGN_IDENTITY = "Apple Development";
661663
CODE_SIGN_STYLE = Automatic;
662664
COMBINE_HIDPI_IMAGES = YES;
663-
CURRENT_PROJECT_VERSION = 16;
665+
CURRENT_PROJECT_VERSION = 18;
664666
DEPLOYMENT_LOCATION = YES;
665667
DEVELOPMENT_TEAM = S6D73TBQQU;
666668
DSTROOT = /;
@@ -675,7 +677,7 @@
675677
INSTALL_PATH = "/Library/Application Support/MacEnhance/Plugins";
676678
MACH_O_TYPE = mh_dylib;
677679
MACOSX_DEPLOYMENT_TARGET = 11.0;
678-
MARKETING_VERSION = 0.0.14;
680+
MARKETING_VERSION = 0.0.16;
679681
ONLY_ACTIVE_ARCH = NO;
680682
PRODUCT_BUNDLE_IDENTIFIER = com.bluebubbles.messaging;
681683
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -696,7 +698,7 @@
696698
CODE_SIGN_IDENTITY = "Apple Development";
697699
CODE_SIGN_STYLE = Automatic;
698700
COMBINE_HIDPI_IMAGES = YES;
699-
CURRENT_PROJECT_VERSION = 16;
701+
CURRENT_PROJECT_VERSION = 18;
700702
DEPLOYMENT_LOCATION = YES;
701703
DEVELOPMENT_TEAM = S6D73TBQQU;
702704
DSTROOT = /;
@@ -711,7 +713,7 @@
711713
INSTALL_PATH = "/Library/Application Support/MacEnhance/Plugins";
712714
MACH_O_TYPE = mh_dylib;
713715
MACOSX_DEPLOYMENT_TARGET = 11.0;
714-
MARKETING_VERSION = 0.0.14;
716+
MARKETING_VERSION = 0.0.16;
715717
ONLY_ACTIVE_ARCH = NO;
716718
PRODUCT_BUNDLE_IDENTIFIER = com.bluebubbles.messaging;
717719
PRODUCT_NAME = "$(TARGET_NAME)";

MacOS-11+/BlueBubblesHelper/BlueBubblesHelper.m

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ -(void) handleMessage: (NetworkController*)controller message:(NSString *)messa
441441
} else if ([event isEqualToString:@"send-multipart"]) {
442442
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString: @""];
443443
NSMutableArray<NSString*> *transfers = [[NSMutableArray alloc] init];
444-
NSUInteger index = 0;
445444
for (NSDictionary *dict in data[@"parts"]) {
445+
NSUInteger index = [dict[@"partIndex"] integerValue];
446446
if (dict[@"filePath"] != [NSNull null] && [dict[@"filePath"] length] != 0) {
447447
NSString *filePath = dict[@"filePath"];
448448
NSURL * fileUrl = [NSURL fileURLWithPath:filePath];
@@ -458,33 +458,13 @@ -(void) handleMessage: (NetworkController*)controller message:(NSString *)messa
458458
[attributedString appendAttributedString:attachmentStr];
459459
} else {
460460
if (dict[@"mention"] != [NSNull null] && [dict[@"mention"] length] != 0) {
461-
NSMutableAttributedString *beforeStr = [[NSMutableAttributedString alloc] initWithString: [(NSString *) dict[@"text"] substringWithRange:NSMakeRange(0, [[dict[@"range"] firstObject] integerValue])]];
462-
[beforeStr addAttributes:@{
463-
@"__kIMBaseWritingDirectionAttributeName": @"-1",
464-
@"__kIMMessagePartAttributeName": [NSNumber numberWithInt:index],
465-
} range:NSMakeRange(0, [[beforeStr string] length])];
466-
NSMutableAttributedString *mentionStr = [[NSMutableAttributedString alloc] initWithString: [(NSString *) dict[@"text"] substringWithRange:NSMakeRange([[dict[@"range"] firstObject] integerValue], [[dict[@"range"] lastObject] integerValue])]];
461+
NSMutableAttributedString *mentionStr = [[NSMutableAttributedString alloc] initWithString: dict[@"text"]];
467462
[mentionStr addAttributes:@{
468463
@"__kIMBaseWritingDirectionAttributeName": @"-1",
469464
@"__kIMMentionConfirmedMention": dict[@"mention"],
470465
@"__kIMMessagePartAttributeName": [NSNumber numberWithInt:index],
471466
} range:NSMakeRange(0, [[mentionStr string] length])];
472-
NSUInteger begin = [[dict[@"range"] firstObject] integerValue] + [[dict[@"range"] lastObject] integerValue];
473-
NSUInteger end = [dict[@"text"] length] - begin;
474-
NSMutableAttributedString *afterStr = [[NSMutableAttributedString alloc] initWithString: [(NSString *) dict[@"text"] substringWithRange:NSMakeRange(begin, end)]];
475-
[afterStr addAttributes:@{
476-
@"__kIMBaseWritingDirectionAttributeName": @"-1",
477-
@"__kIMMessagePartAttributeName": [NSNumber numberWithInt:index],
478-
} range:NSMakeRange(0, [[afterStr string] length])];
479-
if ([[beforeStr string] length] != 0) {
480-
[attributedString appendAttributedString:beforeStr];
481-
}
482-
if ([[mentionStr string] length] != 0) {
483-
[attributedString appendAttributedString:mentionStr];
484-
}
485-
if ([[afterStr string] length] != 0) {
486-
[attributedString appendAttributedString:afterStr];
487-
}
467+
[attributedString appendAttributedString:mentionStr];
488468
} else {
489469
NSMutableAttributedString *messageStr = [[NSMutableAttributedString alloc] initWithString: dict[@"text"]];
490470
[messageStr addAttributes:@{
@@ -494,7 +474,6 @@ -(void) handleMessage: (NetworkController*)controller message:(NSString *)messa
494474
[attributedString appendAttributedString:messageStr];
495475
}
496476
}
497-
index++;
498477
}
499478
[BlueBubblesHelper sendMessage:(data) transfers:[transfers copy] attributedString:attributedString transaction:(transaction)];
500479
// If the server tells us to get the vetted aliases
@@ -603,19 +582,25 @@ -(void) handleMessage: (NetworkController*)controller message:(NSString *)messa
603582
// Use reference to class since it doesn't exist on Big Sur
604583
Class cls = NSClassFromString(@"IMHandleAvailabilityManager");
605584
if ([handles firstObject] != nil && cls != nil) {
606-
[[cls sharedInstance] _fetchUpdatedStatusForHandle:([handles firstObject]) completion:^() {
607-
// delay for 1 second to ensure we have latest status
608-
NSTimeInterval delayInSeconds = 1.0;
609-
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
610-
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
611-
NSInteger *status = [[cls sharedInstance] availabilityForHandle:([handles firstObject])];
612-
DLog("BLUEBUBBLESHELPER: Found status %{public}ld for %{public}@", (long)status, data[@"address"]);
613-
if (transaction != nil) {
614-
BOOL silenced = status == 2;
615-
[[NetworkController sharedInstance] sendMessage: @{@"transactionId": transaction, @"silenced": [NSNumber numberWithBool:silenced]}];
616-
}
617-
});
618-
}];
585+
if ([cls respondsToSelector:NSSelectorFromString(@"_fetchUpdatedStatusForHandle")]) {
586+
[[cls sharedInstance] _fetchUpdatedStatusForHandle:([handles firstObject]) completion:^() {
587+
// delay for 1 second to ensure we have latest status
588+
NSTimeInterval delayInSeconds = 1.0;
589+
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
590+
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
591+
NSInteger *status = [[cls sharedInstance] availabilityForHandle:([handles firstObject])];
592+
DLog("BLUEBUBBLESHELPER: Found status %{public}ld for %{public}@", (long)status, data[@"address"]);
593+
if (transaction != nil) {
594+
BOOL silenced = status == 2;
595+
[[NetworkController sharedInstance] sendMessage: @{@"transactionId": transaction, @"silenced": [NSNumber numberWithBool:silenced]}];
596+
}
597+
});
598+
}];
599+
} else {
600+
if (transaction != nil) {
601+
[[NetworkController sharedInstance] sendMessage: @{@"transactionId": transaction, @"error": @"Selector not found!"}];
602+
}
603+
}
619604
}
620605
} else if ([event isEqualToString:@"notify-anyways"]) {
621606
IMChat *chat = [BlueBubblesHelper getChat:data[@"chatGuid"] :transaction];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Headers generated with ktool v1.4.0
2+
// https://github.com/cxnder/ktool | pip3 install k2l
3+
// Platform: IOS | Minimum OS: 16.0.0 | SDK: 16.0.0
4+
5+
6+
7+
@protocol SKStatusSubscriptionServiceDelegate
8+
9+
10+
11+
@optional
12+
-(void)subscriptionInvitationReceived:(id)arg0 ;
13+
-(void)subscriptionReceivedStatusUpdate:(id)arg0 ;
14+
-(void)subscriptionServiceDaemonDisconnected:(id)arg0 ;
15+
-(void)subscriptionStateChanged:(id)arg0 ;
16+
@end

0 commit comments

Comments
 (0)