From a59b9b6441e0408fe48731310d17279acb331079 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 10 Apr 2020 11:24:46 +0200 Subject: [PATCH] Ready to implement call system --- assets/js/components/calls/controller.js | 18 ++++++++++++++++++ .../js/components/conversations/chatWindows.js | 6 +++--- system/config/dev.config.php | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 assets/js/components/calls/controller.js diff --git a/assets/js/components/calls/controller.js b/assets/js/components/calls/controller.js new file mode 100644 index 00000000..06b4ec5f --- /dev/null +++ b/assets/js/components/calls/controller.js @@ -0,0 +1,18 @@ +/** + * Calls controller + * + * @author Pierre Hubert + */ + +class CallsController { + + /** + * Open a call for a conversation + * + * @param {Conversation} conv Information about the target conversation + */ + static Open(conv) { + alert("Open call for conversation " + conv.ID); + } + +} \ No newline at end of file diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index c0af34ea..70cd9605 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -585,11 +585,11 @@ const ConvChatWindow = { showCallButton: function(conversation){ //Check if calls are disabled - if(/*TODO : implement */false) + if(!conversation.infos.can_have_call) return; //Add the call button - var button = createElem2({ + const button = createElem2({ insertBefore: conversation.box.boxTools.firstChild, type: "button", class: "btn btn-box-tool", @@ -598,7 +598,7 @@ const ConvChatWindow = { conversation.box.callButton = button; button.addEventListener("click", function(){ - // TODO : implement + CallsController.Open(conversation.infos) }); }, diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 313b98fd..2463d16b 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -456,7 +456,7 @@ class Dev { "js/components/incognito/keyboard.js", //Calls component - + "js/components/calls/controller.js", // Web app component "js/components/webApp/interface.js",