-
-
Notifications
You must be signed in to change notification settings - Fork 778
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a toggling button in the centre of the chat-header
- Loading branch information
Showing
7 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
import { CustomElement } from 'shared/components/element.js'; | ||
import { _converse, api } from "@converse/headless/core"; | ||
import { JINGLE_CALL_STATUS } from "./constants.js"; | ||
import tpl_header_button from "./templates/header-button.js"; | ||
import { JINGLE_CALL_STATUS } from "./constants.js"; | ||
|
||
export default class ChatHeaderCallNotification extends CustomElement { | ||
export default class CallNotification extends CustomElement { | ||
|
||
static get properties() { | ||
return { | ||
'jid': { type: String }, | ||
} | ||
} | ||
|
||
initialize() { | ||
this.model = _converse.chatboxes.get(this.jid); | ||
this.listenTo(this.model, 'change:jingle_status', this.requestUpdate); | ||
this.listenTo(this.model, 'change:jingle_status', () => this.requestUpdate()); | ||
} | ||
|
||
render() { | ||
return tpl_header_button(this); | ||
} | ||
|
||
toggleJingleCallStatus() { | ||
endCall() { | ||
const jingle_status = this.model.get('jingle_status'); | ||
if ( jingle_status === JINGLE_CALL_STATUS.PENDING || jingle_status === JINGLE_CALL_STATUS.ACTIVE) { | ||
this.model.save('jingle_status', JINGLE_CALL_STATUS.ENDED); | ||
return; | ||
} | ||
if (!jingle_status || jingle_status === JINGLE_CALL_STATUS.ENDED) { | ||
this.model.save('jingle_status', JINGLE_CALL_STATUS.PENDING); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
api.elements.define('converse-chat-header-call-notification', ChatHeaderCallNotification); | ||
api.elements.define('converse-call-notification', CallNotification); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
import { html } from 'lit'; | ||
import { __ } from 'i18n'; | ||
import { JINGLE_CALL_STATUS } from '../constants'; | ||
|
||
const tpl_active_call = (o) => { | ||
const button = __('Call Inititated'); | ||
return html` | ||
<div> | ||
<span><button @click=${ o.endCall }>${ button }</button></span> | ||
</div> | ||
`; | ||
} | ||
|
||
// ${(jingle_status === JINGLE_CALL_STATUS.ACTIVE) ? html`${tpl_active_call(el)}` : html`` } | ||
export default (el) => { | ||
const jingle_status = el.model.get('jingle_status'); | ||
return html` | ||
<div> | ||
${ (el.model.get('jingle_status')) === JINGLE_CALL_STATUS.PENDING ? html`<span class="badge bg-secondary">Calling...</span>` : html``} | ||
${(jingle_status === JINGLE_CALL_STATUS.PENDING) ? html`Calling...` : '' } | ||
</div> | ||
<div> | ||
${(jingle_status === JINGLE_CALL_STATUS.PENDING) ? tpl_active_call(el) : '' } | ||
${(jingle_status === JINGLE_CALL_STATUS.ENDED) ? html`Call Ended` : '' } | ||
</div> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters