Skip to content
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

onSystemMessageListener Event not getting fired in Angular #433

Open
jigneshzala opened this issue Oct 13, 2022 · 0 comments
Open

onSystemMessageListener Event not getting fired in Angular #433

jigneshzala opened this issue Oct 13, 2022 · 0 comments

Comments

@jigneshzala
Copy link

In my angular application j have used this quickblox API and currently facing issues with QB.chat.onSystemMessageListener when creating dialogue.
When I Manually on the button and click Try to call this event its listener gets called:

try {
  QB.chat.sendSystemMessage(userIds, systemMessage);
  // or message.id = QB.chat.sendSystemMessage(opponentId, message) if message ID is needed
} catch (e) {
  console.log(e);
  if (e.name === "ChatNotConnectedError") {
    // not connected to chat
  }
}

But, when i try to call this event when creating dialogue it does not get called:
public createDialog(selected_occupant_id) {
const self = this;
const params = {
type: 3,
occupants_ids: [selected_occupant_id]
};

this.dialogService.createDialog(params).then(dialog => {
  this.dialog = dialog;
  const systemMessage = {
    extension: {
      notification_type: 1,
      dialog_id: dialog._id
    }
  };

  //This is the Event
  self.messageService.sendSystemMessage(selected_occupant_id, systemMessage);


  if (self.dialogService.dialogs[dialog._id] === undefined) {
    const tmpObj = {};
    tmpObj[dialog._id] = dialog;
    self.dialogService.dialogs = Object.assign(tmpObj, self.dialogService.dialogs);
    self.dialogService.dialogsEvent.emit(self.dialogService.dialogs);
  }

  this.dialogService.currentDialog = dialog;
  this.dialogService.currentDialogEvent.emit(dialog);

});

}

Can you please take a look at it and what is exactly thing I am missing, asap...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant