Closed shaharukhs closed 6 years ago
@shaharukhs, Hello. You should specify dialog type before saving it to the memory storage.
Dialogs can have next types:
type
- Chat dialog type:
//objective-c
typedef NS_ENUM(NSUInteger, QBChatDialogType) {
QBChatDialogTypePublicGroup = 1,
QBChatDialogTypeGroup = 2,
QBChatDialogTypePrivate = 3,
};
//swift4
public enum QBChatDialogType : UInt {
case publicGroup
case group
case `private`
}
But This one happening on message receive
- (void)chatDidReceiveSystemMessage:(QBChatMessage *)message {
[self handleSystemMessage:message];
}
Please check screenshot
Hello @shaharukhs, from your logs:
2018-04-02 19:12:01.600560+0530 VideoInspectionSystem[5824:2493634] [ChatService]: RCV: <message xmlns="jabber:client" type="headline" from="46238050-69096@chat.quickblox.com/1571722472-quickblox-15002733" to="45597452-69096@chat.quickblox.com" id="5ac233283a5d4e2e54000003">
<extraParams xmlns="jabber:client">
<moduleIdentifier>SystemNotifications</moduleIdentifier>
<notification_type>1</notification_type>
<dialog_id>5ac2324ea28f9a3151ecb5dc</dialog_id>
</extraParams>
</message>
<notification_type>1</notification_type>
is equeal QMMessageTypeCreateGroupDialog
Your system message should containts <type>2</type>
type field. Check message.dialog
implementation ("QBChatMessage+QMCustomParameters.m"
file) from method bellow:
- (void)handleSystemMessage:(QBChatMessage *)message {
if (message.messageType == QMMessageTypeCreateGroupDialog) {
if ([self.dialogsMemoryStorage chatDialogWithID:message.dialogID] != nil) {
return;
}
//check message.dialog;
QBChatDialog *dialogToAdd = message.dialog;
[self updateLastMessageParamsForChatDialog:dialogToAdd withMessage:message];
dialogToAdd.updatedAt = message.dateSent;
__weak __typeof(self)weakSelf = self;
[self.dialogsMemoryStorage addChatDialog:dialogToAdd
andJoin:self.isAutoJoinEnabled
completion:^(QBChatDialog *addedDialog, NSError *error)
{
__typeof(weakSelf)strongSelf = weakSelf;
if (message.senderID != strongSelf.serviceManager.currentUser.ID) {
addedDialog.unreadMessagesCount++;
}
if ([strongSelf.multicastDelegate respondsToSelector:@selector(chatService:didAddChatDialogToMemoryStorage:)]) {
[strongSelf.multicastDelegate chatService:strongSelf
didAddChatDialogToMemoryStorage:addedDialog];
}
}];
}
}
You should use this method:
- (void)sendSystemMessageAboutAddingToDialog:(QBChatDialog *)chatDialog
toUsersIDs:(NSArray *)usersIDs
withText:(NSString *)text
completion:(QBChatCompletionBlock)completion {
or add all field in your system message for represent chat dialog.
For example, should be:
<notification_type>1</notification_type>
<dialog_id> 5ac2324ea28f9a3151ecb5dc </dialog_id>
<room_name>@shaharukhs</room_name>
<room_updated_date>1522739811</room_updated_date>
<type>2</type>
<current_occupant_ids>1,2,3,4,5,6,7,8</current_occupant_ids>
<date_sent>1522739810</date_sent>
Thanks!
Thanks for your reply.
But I am receiving chat from web app which was using JS
to achieve this Your system message should contains <type>2</type>
type field.
So my back end team need to change on there side right?
@shaharukhs
So my back end team need to change on there side right?
Yes, if this is notification message about creating dialog. Required fields:
<notification_type>1</notification_type>
<dialog_id> 5ac2324ea28f9a3151ecb5dc </dialog_id>
<room_name>@shaharukhs</room_name>
<room_updated_date>1522739811</room_updated_date>
<type>2</type>
<current_occupant_ids>1,2,3,4,5,6,7,8</current_occupant_ids>
<date_sent>1522739810</date_sent>
Thanks.
@shaharukhs, if you will have any other problems or questions please let us know by creating a separate issue.
Thanks!
New Issue Checklist
Environment details
Did this work before?
Expected behavior
Actual behavior crashing with this error
NSAssert(chatDialog.type != 0, @"Chat type is not defined");
LogsPlease use the following template for logs:
To enable full logs use the following code:
Title for logs
```logos // Your logs here 2018-04-02 19:11:51.921451+0530 VideoInspectionSystem[5824:2493678] [QBCore]: Request[7]: POST URL:https://api.quickblox.com/chat/Dialog.json headers: { "Accept-Language" = "en-IN;q=1"; "Content-Type" = "application/x-www-form-urlencoded"; "QB-OS" = "iOS 11.2.6"; "QB-SDK" = "iOS 2.15"; "QB-Token" = d0e99e13a9f51431a283fa54476f0ed763010de8; "QuickBlox-REST-API-Version" = "0.1.1"; "User-Agent" = "VideoInspectionSystem/0.1 (iPhone; iOS 11.2.6; Scale/2.00)"; } parameters: { "occupants_ids" = 46238050; type = 3; } 2018-04-02 19:11:52:138 VideoInspectionSystem[5824:900f] SEND: 2018-04-02 19:11:52:139 VideoInspectionSystem[5824:900f] SEND:Steps to reproduce the behavior
Any others comments