Skip to main content

Conversation Drafts

Save Draft

You can use saveTextMessageDraft:targetId:content:completion: to save a draft message to a specified conversation. Saving a draft will update the conversation's sentTime and operationTime (a new property added in version 5.6.8), causing the conversation to appear at the top of the list.

Method Signature

- (void)saveTextMessageDraft:(RCConversationType)conversationType
targetId:(NSString *)targetId
content:(NSString *)content
completion:(nullable void(^)(BOOL ret))completion;

Parameters

ParameterTypeDescription
conversationTypeRCConversationTypeConversation type
targetIdNSStringTarget ID of the conversation
contentNSStringDraft content
completionBlockCallback for operation result

Example

[[RCCoreClient sharedCoreClient] saveTextMessageDraft:ConversationType_PRIVATE
targetId:@"targetId"
content:@"This is draft content"
completion:^(BOOL success) {

}];

Retrieve Draft

You can use getTextMessageDraft:targetId:completion: to retrieve draft content.

Method Signature

- (void)getTextMessageDraft:(RCConversationType)conversationType
targetId:(NSString *)targetId
completion:(nullable void(^)(NSString * _Nullable draft))completion;

Parameters

ParameterTypeDescription
conversationTypeRCConversationTypeConversation type
targetIdNSStringTarget ID of the conversation
completionBlockCallback for operation result

Example Code

[[RCCoreClient sharedCoreClient] getTextMessageDraft:ConversationType_PRIVATE
targetId:@"targetId"
completion:^(NSString *draft) {
}];

Delete Draft

You can use clearTextMessageDraft:targetId:completion: to delete a draft.

Method Signature

- (void)clearTextMessageDraft:(RCConversationType)conversationType
targetId:(NSString *)targetId
completion:(nullable void(^)(BOOL ret))completion;

Parameters

ParameterTypeDescription
conversationTypeRCConversationTypeConversation type
targetIdNSStringTarget ID of the conversation
completionBlockCallback for operation result

Example Code

[[RCCoreClient sharedCoreClient] clearTextMessageDraft:ConversationType_PRIVATE
targetId:@"targetId"
completion:^(BOOL success) {

}];