Skip to content

Commit

Permalink
Use runtime reference to class
Browse files Browse the repository at this point in the history
  • Loading branch information
tneotia committed Feb 20, 2023
1 parent c718883 commit 892f91e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
Binary file not shown.
5 changes: 3 additions & 2 deletions MacOS-11+/BlueBubblesHelper/BlueBubblesHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,9 @@ +(void) sendMessage: (NSDictionary *) data transfers: (NSArray *) transfers attr
if ([items isKindOfClass:[NSArray class]]) {
for (IMMessagePartChatItem *i in (NSArray *) items) {
// IMAggregateAttachmentMessagePartChatItem is a photo gallery and has subparts
// Only available Monterey+
if ([[NSProcessInfo processInfo] operatingSystemVersion].majorVersion > 11 && [i isKindOfClass:[IMAggregateAttachmentMessagePartChatItem class]]) {
// Only available Monterey+, use reference to class loaded at runtime to avoid crashes on Big Sur
Class cls = NSClassFromString(@"IMAggregateAttachmentMessagePartChatItem");
if ([[NSProcessInfo processInfo] operatingSystemVersion].majorVersion > 11 && [i isKindOfClass:cls]) {
IMAggregateAttachmentMessagePartChatItem *aggregate = i;
for (IMMessagePartChatItem *i2 in [aggregate aggregateAttachmentParts]) {
if ([i2 index] == [data[@"partIndex"] integerValue]) {
Expand Down
22 changes: 13 additions & 9 deletions MacOS-11+/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 892f91e

Please sign in to comment.