rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
155 stars 92 forks source link

[Feature] Enable customisation #65

Closed shaychoo closed 6 years ago

shaychoo commented 6 years ago

this project is grate! i'd miss some customisation options:

rpaschoal commented 6 years ago

Hi @shaychoo ,

I am glad you like it!

Some of the suggested items I already had in mind, like popping the window to a draggable chat window on the viewport. Haven't found the time to implement it yet.

About hiding the friends list, do you mean minimizing it? If so, that is already a feature, all you have to do is click on its title.

krytthew commented 6 years ago

hi, your project is very good but I need to enable the chat from an external button, not from the same friends bar but I send the user parameter to the popup event.

I was reading the code and the event that the pupop goes to openwindows when sending the parameter user gives me an error in the adapter since I would have to do an adapt almost for each button

help me please

rpaschoal commented 6 years ago

Hi @krytthew,

This is not a feature at the moment as you've mentioned, but we can implement it for sure, I am sure it will be helpful for other people in the future too. We could add command events to open, close and minimize a window from outside the module.

Would you be able to implement it and send a PR? Otherwise I can do it, but it might take a while for me to push the changes as I am quite busy with my personal life atm.

Cheers!

rpaschoal commented 6 years ago

Hi @krytthew,

I have been considering adding your suggestion as a trigger or similar to ng-chat, so people can trigger events from outside of the component. Here is a workaround for versions prior to release 1.0.15:

Assuming you have a ng-chat instance on your HTML template, add an angular identifier to it (EG: 'ngChatInstance') like the following:

<ng-chat #ngChatInstance ...>

After adding an identifier to the component on your template, go to your component's typescript and add the following:

@ViewChild('ngChatInstance') protected ngChatInstance: any;

Now you will be able to interact with your ng-chat instance, and you can open a chat window with the following code:

this.ngChatInstance.openChatWindow(user);

Make sure your user instance has all properties assigned, otherwise you might have some weird behaviors of the chat window not displaying the name of the person, etc.

This is a workaround and not a recommended way of doing so. Upcoming release 1.0.15 will introduce IChatController which will enable people to trigger events from outside ng-chat (Here is the related commit https://github.com/rpaschoal/ng-chat/pull/68/commits/a09d4a37baa3f71b9d1cb8ad5fca9d10c5fe511d)

Cheers!

rpaschoal commented 6 years ago

Hi @krytthew,

Haven't heard back from you on this, but just to keep you and everyone else that might end up in this issue updated. 1.0.15 has just been released and this can be done in a better way.

Just check out the instructions in the main README on how to use IChatController for triggering actions outside of ng-chat.

Closing this issue as it is now officially supported and documented.