-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Support for iOS 14 In-Line replies #135
Comments
@iandwelker in case you want to implement this:
// get the chat
IMChat *chat = [BlueBubblesHelper getChat: data[@"chatGuid"]];
// get the message text
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString: data[@"message"]];
// get the subject line, if any
NSMutableAttributedString *subjectAttributedString = nil;
if ([data objectForKey:(@"subject")] != [NSNull null]) {
subjectAttributedString = [[NSMutableAttributedString alloc] initWithString: data[@"subject"]];
}
// get the effect ID, if any
NSString *effectId = nil;
if ([data objectForKey:(@"effectId")] != [NSNull null]) {
effectId = data[@"effectId"];
}
// helper function to create a message
void (^createMessage)(NSAttributedString*, NSAttributedString*, NSString*, NSString*) = ^(NSAttributedString *message, NSAttributedString *subject, NSString *effectId, NSString *threadIdentifier) {
// init an IMMessage with the text, subject, and effect ID
IMMessage *messageToSend = [[IMMessage alloc] init];
messageToSend = [messageToSend initWithSender:(nil) time:(nil) text:(message) messageSubject:(subject) fileTransferGUIDs:(nil) flags:(100005) error:(nil) guid:(nil) subject:(nil) balloonBundleID:(nil) payloadData:(nil) expressiveSendStyleID:(effectId)];
// add the thread ID for the reply
messageToSend.threadIdentifier = threadIdentifier;
// send it
[chat sendMessage:(messageToSend)];
};
if ([data objectForKey:(@"selectedMessageGuid")] != [NSNull null]) {
// get the message being replied to
[BlueBubblesHelper getMessageItem:(chat) :(data[@"selectedMessageGuid"]) completionBlock:^(IMMessage *message) {
// get the specific IMMessagePartChatItem out of the message
IMMessageItem *messageItem = (IMMessageItem *)message._imMessageItem;
NSObject *items = messageItem._newChatItems;
IMMessagePartChatItem *item;
// sometimes items is an array so we need to account for that
if ([items isKindOfClass:[NSArray class]]) {
for(IMMessagePartChatItem* imci in (NSArray *)items) {
if([imci._item.guid isEqualToString:(data[@"selectedMessageGuid"])]) {
DLog(@"BLUEBUBBLESHELPER: %@", data[@"selectedMessageGuid"]);
item = imci;
}
}
} else {
item = (IMMessagePartChatItem *)items;
}
NSString *identifier = @"";
// either reply to an existing thread or create a new thread
if (message.threadIdentifier != nil) {
identifier = message.threadIdentifier;
} else {
identifier = IMCreateThreadIdentifierForMessagePartChatItem(item);
}
createMessage(attributedString, subjectAttributedString, effectId, identifier);
}];
} If you got more questions lmk! |
Even if it starts off as view only, this would be a cool feature to have on the web client
The text was updated successfully, but these errors were encountered: