|
4 | 4 | * @license Mozilla Public License (MPLv2)
|
5 | 5 | */
|
6 | 6 |
|
7 |
| -import { converse } from '@converse/headless/core'; |
| 7 | +import { _converse, converse } from '@converse/headless/core'; |
| 8 | +import 'plugins/modal/index.js'; |
| 9 | +import { __ } from 'i18n'; |
| 10 | +import { html } from "lit"; |
8 | 11 |
|
9 |
| -converse.plugins.add('jingle', { |
| 12 | +converse.plugins.add('converse-jingle', { |
| 13 | + /* Plugin dependencies are other plugins which might be |
| 14 | + * overridden or relied upon, and therefore need to be loaded before |
| 15 | + * this plugin. |
| 16 | + * |
| 17 | + * If the setting "strict_plugin_dependencies" is set to true, |
| 18 | + * an error will be raised if the plugin is not found. By default it's |
| 19 | + * false, which means these plugins are only loaded opportunistically. |
| 20 | + * |
| 21 | + * NB: These plugins need to have already been loaded via require.js. |
| 22 | + */ |
| 23 | + dependencies: ['converse-chatview'], |
10 | 24 |
|
11 | 25 | initialize: function () {
|
12 |
| - |
| 26 | + /* The initialize function gets called as soon as the plugin is |
| 27 | + * loaded by converse.js's plugin machinery. |
| 28 | + */ |
| 29 | + _converse.api.listen.on('getToolbarButtons', (toolbar_el, buttons) => { |
| 30 | + if (!this.is_groupchat) { |
| 31 | + const color = '--chat-toolbar-btn-color'; |
| 32 | + const i18n_start_call = __('Start a call'); |
| 33 | + buttons.push(html` |
| 34 | + <button class="toggle-call" @click=${this.toggleCall} title="${i18n_start_call}"> |
| 35 | + <converse-icon color="var(${color})" class="fa fa-phone" size="1em"></converse-icon> |
| 36 | + </button>` |
| 37 | + ); |
| 38 | + } |
| 39 | + |
| 40 | + return buttons; |
| 41 | + }); |
13 | 42 | },
|
14 | 43 | });
|
0 commit comments