This question is extension to my previous question with new requirements. This is My Previous question.
So My New Requirement is :
Now If I want to delete group chat how I should handle this ? If I use the same method inside it we are passing forAllUsers as "NO" which is hard coded. written inside QMChatServices.m
- (void)deleteDialogWithID:(NSString *)dialogId completion:(void (^)(QBResponse *))completion {
NSParameterAssert(dialogId);
__weak __typeof(self)weakSelf = self;
[QBRequest deleteDialogsWithIDs:[NSSet setWithObject:dialogId] forAllUsers:NO successBlock:^(QBResponse *response, NSArray *deletedObjectsIDs, NSArray *notFoundObjectsIDs, NSArray *wrongPermissionsObjectsIDs) {
//
[weakSelf.dialogsMemoryStorage deleteChatDialogWithID:dialogId];
[weakSelf.messagesMemoryStorage deleteMessagesWithDialogID:dialogId];
if ([weakSelf.multicastDelegate respondsToSelector:@selector(chatService:didDeleteChatDialogWithIDFromMemoryStorage:)]) {
[weakSelf.multicastDelegate chatService:weakSelf didDeleteChatDialogWithIDFromMemoryStorage:dialogId];
}
[weakSelf.loadedAllMessages removeObjectsForKeys:deletedObjectsIDs];
if (completion) {
completion(response);
}
} errorBlock:^(QBResponse *response) {
//
if (response.status == QBResponseStatusCodeNotFound || response.status == 403) {
[weakSelf.dialogsMemoryStorage deleteChatDialogWithID:dialogId];
if ([weakSelf.multicastDelegate respondsToSelector:@selector(chatService:didDeleteChatDialogWithIDFromMemoryStorage:)]) {
[weakSelf.multicastDelegate chatService:weakSelf didDeleteChatDialogWithIDFromMemoryStorage:dialogId];
}
}
else {
[weakSelf.serviceManager handleErrorResponse:response];
}
if (completion) {
completion(response);
}
}];
}
So Now my doubt is..
Question 1 : What if we want to delete dialog for all the users. Question 2 : Lets say there are 3 users. User1 , User2 and User3. Now User1 has created group with User2 and User3.
So how this method is useful for all the different 3 users. I mean What happens if User1 uses
[ServicesManager.instance.chatService deleteDialogWithID:dialog.ID completion:nil];
and what happens if User2 and User3 uses the same method.
Weather it works as exit from the dialog or deleting dialog. I'm little confused how this method works for different users in case of group and public chat.
Question 3 : Is there any other way to exit from the group chat ? I hope it is clear !!