sendMessage: return guid after sending. This guid is stable
This commit is contained in:
@@ -19,9 +19,9 @@
|
||||
return @"sendMessage";
|
||||
}
|
||||
|
||||
- (BOOL)_sendMessage:(NSString *)messageBody toChatWithGUID:(NSString *)chatGUID attachmentGUIDs:(NSArray<NSString *> *)guids
|
||||
- (IMMessage *)_sendMessage:(NSString *)messageBody toChatWithGUID:(NSString *)chatGUID attachmentGUIDs:(NSArray<NSString *> *)guids
|
||||
{
|
||||
__block BOOL result = YES;
|
||||
__block IMMessage *result = nil;
|
||||
|
||||
dispatch_sync([[self class] sharedIMAccessQueue], ^{
|
||||
IMChat *chat = [[IMChatRegistry sharedInstance] existingChatWithGUID:chatGUID];
|
||||
@@ -44,8 +44,9 @@
|
||||
|
||||
if (!chat) {
|
||||
MBIMLogInfo(@"Chat does not exist: %@", chatGUID);
|
||||
result = NO;
|
||||
} else {
|
||||
result = reply;
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[chat sendMessage:reply];
|
||||
});
|
||||
@@ -78,9 +79,11 @@
|
||||
transferGUIDs = @[];
|
||||
}
|
||||
|
||||
BOOL result = [self _sendMessage:messageBody toChatWithGUID:guid attachmentGUIDs:transferGUIDs];
|
||||
IMMessage *result = [self _sendMessage:messageBody toChatWithGUID:guid attachmentGUIDs:transferGUIDs];
|
||||
if (result) {
|
||||
response = [[HTTPErrorResponse alloc] initWithErrorCode:200];
|
||||
response = [MBIMJSONDataResponse responseWithJSONObject:@{
|
||||
@"guid" : [result guid]
|
||||
}];
|
||||
}
|
||||
|
||||
self.serverCompletionBlock(response);
|
||||
|
||||
Reference in New Issue
Block a user