This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add joinCallBtn, endCall message, callRing functionalities. (#618)
* add callnotification,msg,iframe code * fix eslint issues * fix eslint file path issues * fix stylelint issues * done ui changes * add join call button * add icons and improve ui * fix error * remove-icons * add icons * ui changes * add icon and timeout functionality * add I18n.t * add i18n.t, change classname, improve ui * remove font-family * change iframe link * add check for jitsi * add jitsi link * add time message in system message and add catch * display alert, change function name * Improve overall codebase * Convert tabs to spaces for translation file * Accept jitsi url info from the message and remove dependency from Livechat.videoCall endpoint * Update index.js * add message in i18n file * add joincall btn, call time, timeout * fix lint error * Update ShowJoinCallButton.js * fix conflicts * improve codebase * fix bugs * update some files * improve css, codebase and change condition * add correct link for iframe and joinCallBtn, show correct time * update call status at rc-core * update api file * rebase file * change link, use store class * update callIframe file * handle corner cases * remove file * Update room.js file Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com> * update one file * revert roomjs file * add common condition in room.js file Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com>
- Loading branch information
1 parent
0c7133e
commit 3b72258
Showing
18 changed files
with
216 additions
and
54 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 +1,17 @@ | ||
import { h } from 'preact'; | ||
|
||
import { Screen } from '../Screen'; | ||
import { Livechat } from '../../api'; | ||
import store from '../../store'; | ||
import { createClassName } from '../helpers'; | ||
import styles from './styles.scss'; | ||
|
||
|
||
export const CallIFrame = (url) => ( | ||
<Screen.Content nopadding> | ||
export const CallIframe = () => { | ||
const { token, room } = store.state; | ||
const url = `${ Livechat.client.host }/meet/${ room._id }?token=${ token }`; | ||
return ( | ||
<div className={createClassName(styles, 'call-iframe')}> | ||
<iframe className={createClassName(styles, 'call-iframe__content')} src={url} /> | ||
<iframe className={createClassName(styles, 'call-iframe__content')} allow='camera;microphone' src={url} /> | ||
</div> | ||
</Screen.Content> | ||
); | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import format from 'date-fns/format'; | ||
import { parseISO } from 'date-fns/fp'; | ||
import isToday from 'date-fns/isToday'; | ||
import { h } from 'preact'; | ||
|
||
import I18n from '../../i18n'; | ||
import { createClassName } from '../helpers'; | ||
import styles from './styles.scss'; | ||
|
||
|
||
export const CallTime = (props) => { | ||
const hh = parseInt(Math.abs(props.endTime - props.time) / 36e5); | ||
const mm = parseInt(Math.abs(props.endTime - props.time) / 6e4) % 60; | ||
const ss = parseInt(Math.abs(props.endTime - props.time) / 1000) % 60; | ||
let callDuration = ''; | ||
if (hh > 0) { | ||
callDuration += `${ hh } hours ${ mm } minutes ${ ss } seconds.`; | ||
} else if (mm > 0) { | ||
callDuration += `${ mm } minutes ${ ss } seconds.`; | ||
} else { | ||
callDuration += `${ ss } seconds.`; | ||
} | ||
const timestamp = new Date(props.endTime).toISOString(); | ||
const time = format(parseISO(timestamp), isToday(parseISO(timestamp)) ? 'HH:mm' : 'dddd HH:mm'); | ||
return ( | ||
<div className={createClassName(styles, 'callTime')}> | ||
{I18n.t('Call ended at %{time}', { time })} | ||
{I18n.t(' - Lasted %{callDuration}', { callDuration })} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { h } from 'preact'; | ||
|
||
import { Livechat } from '../../api'; | ||
import I18n from '../../i18n'; | ||
import VideoIcon from '../../icons/video.svg'; | ||
import constants from '../../lib/constants'; | ||
import store from '../../store'; | ||
import { Button } from '../Button'; | ||
import { createClassName, createToken } from '../helpers'; | ||
import styles from './styles.scss'; | ||
|
||
|
||
export const JoinCallButton = (props) => { | ||
const { token, room } = store.state; | ||
const clickJoinCall = async () => { | ||
const { alerts } = store.state; | ||
switch (props.callProvider) { | ||
case constants.jitsiCallStartedMessageType: { | ||
window.open(props.url); | ||
break; | ||
} | ||
case constants.webrtcCallStartedMessageType: { | ||
window.open(`${ Livechat.client.host }/meet/${ room._id }?token=${ token }`); | ||
break; | ||
} | ||
default: { | ||
const alert = { id: createToken(), children: I18n.t('Call already ended'), timeout: 5000 }; | ||
await store.setState({ alerts: (alerts.push(alert), alerts) }); | ||
} | ||
} | ||
}; | ||
return (<div> | ||
{ props.callStatus === 'accept' | ||
? <div className={createClassName(styles, 'joinCall')}> | ||
<div className={createClassName(styles, 'joinCall__content')} > | ||
<div className={createClassName(styles, 'joinCall__content-videoIcon')} > | ||
<VideoIcon width={20} height={20} /> | ||
</div> | ||
{I18n.t('Join my room to start the video call')} | ||
</div> | ||
<Button onClick={clickJoinCall} className={createClassName(styles, 'joinCall__content-action')}> <VideoIcon width={20} height={20} /> {I18n.t('Join Call')} </Button> | ||
</div> : null } </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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.