Skip to content

Commit ea81ec0

Browse files
authored
Refactor device management in the office (#9656)
Signed-off-by: Anton Alexeyev <[email protected]>
1 parent b36e64d commit ea81ec0

File tree

12 files changed

+180
-327
lines changed

12 files changed

+180
-327
lines changed

plugins/love-resources/src/components/CamSettingPopup.svelte

Lines changed: 0 additions & 79 deletions
This file was deleted.

plugins/love-resources/src/components/ControlBar.svelte

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,18 @@
2929
SplitButton,
3030
eventToHTMLElement,
3131
showPopup,
32-
type AnySvelteComponent,
3332
TooltipInstance
3433
} from '@hcengineering/ui'
3534
import view, { Action } from '@hcengineering/view'
3635
import { getActions } from '@hcengineering/view-resources'
36+
import { toggleCamState, toggleMicState } from '@hcengineering/media-resources'
3737
3838
import love from '../plugin'
3939
import { currentRoom, myInfo, myOffice } from '../stores'
4040
import {
41-
isCamAllowed,
4241
isCameraEnabled,
4342
isConnected,
4443
isFullScreen,
45-
isMicAllowed,
4644
isMicEnabled,
4745
isRecording,
4846
isRecordingAvailable,
@@ -53,20 +51,16 @@
5351
leaveRoom,
5452
record,
5553
screenSharing,
56-
setCam,
57-
setMic,
5854
setShare,
5955
startTranscription,
6056
stopTranscription
6157
} from '../utils'
62-
import CamSettingPopup from './CamSettingPopup.svelte'
58+
import CamSettingPopup from './meeting/CamSettingPopup.svelte'
6359
import ControlBarContainer from './ControlBarContainer.svelte'
64-
import MicSettingPopup from './MicSettingPopup.svelte'
60+
import MicSettingPopup from './meeting/MicSettingPopup.svelte'
6561
import RoomAccessPopup from './RoomAccessPopup.svelte'
66-
import RoomLanguageSelector from './RoomLanguageSelector.svelte'
6762
import RoomModal from './RoomModal.svelte'
6863
import ShareSettingPopup from './ShareSettingPopup.svelte'
69-
import { Room as LKRoom } from 'livekit-client'
7064
7165
export let room: Room
7266
export let canMaximize: boolean = true
@@ -81,14 +75,6 @@
8175
$: allowCam = $currentRoom?.type === RoomType.Video
8276
$: allowLeave = $myInfo?.room !== ($myOffice?._id ?? love.ids.Reception)
8377
84-
async function changeMute (): Promise<void> {
85-
await setMic(!$isMicEnabled)
86-
}
87-
88-
async function changeCam (): Promise<void> {
89-
await setCam(!$isCameraEnabled)
90-
}
91-
9278
async function changeShare (): Promise<void> {
9379
const newValue = !$isSharingEnabled
9480
const audio = newValue && $isShareWithSound
@@ -183,11 +169,10 @@
183169
size={'large'}
184170
icon={$isMicEnabled ? love.icon.MicEnabled : love.icon.MicDisabled}
185171
showTooltip={{
186-
label: !$isMicAllowed ? love.string.MicPermission : $isMicEnabled ? love.string.Mute : love.string.UnMute,
172+
label: $isMicEnabled ? love.string.Mute : love.string.UnMute,
187173
keys: micKeys
188174
}}
189-
action={changeMute}
190-
disabled={!$isMicAllowed}
175+
action={toggleMicState}
191176
secondIcon={IconUpOutline}
192177
secondAction={micSettings}
193178
separate
@@ -197,15 +182,10 @@
197182
size={'large'}
198183
icon={$isCameraEnabled ? love.icon.CamEnabled : love.icon.CamDisabled}
199184
showTooltip={{
200-
label: !$isCamAllowed
201-
? love.string.CamPermission
202-
: $isCameraEnabled
203-
? love.string.StopVideo
204-
: love.string.StartVideo,
185+
label: $isCameraEnabled ? love.string.StopVideo : love.string.StartVideo,
205186
keys: camKeys
206187
}}
207-
disabled={!$isCamAllowed}
208-
action={changeCam}
188+
action={toggleCamState}
209189
secondIcon={IconUpOutline}
210190
secondAction={camSettings}
211191
separate

plugins/love-resources/src/components/MicSettingPopup.svelte

Lines changed: 0 additions & 120 deletions
This file was deleted.

plugins/love-resources/src/components/RoomPopup.svelte

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,25 @@
4545
import { getClient } from '@hcengineering/presentation'
4646
import view from '@hcengineering/view'
4747
import { getObjectLinkFragment } from '@hcengineering/view-resources'
48+
import { toggleCamState, toggleMicState } from '@hcengineering/media-resources'
4849
import { createEventDispatcher } from 'svelte'
4950
import love from '../plugin'
5051
import { currentMeetingMinutes, currentRoom, infos, invites, myInfo, myOffice, myRequests, rooms } from '../stores'
5152
import {
5253
endMeeting,
5354
getRoomName,
54-
isCamAllowed,
5555
isCameraEnabled,
5656
isConnected,
57-
isMicAllowed,
5857
isMicEnabled,
5958
isShareWithSound,
6059
isSharingEnabled,
6160
leaveRoom,
6261
screenSharing,
63-
setCam,
64-
setMic,
6562
setShare,
6663
tryConnect
6764
} from '../utils'
68-
import CamSettingPopup from './CamSettingPopup.svelte'
69-
import MicSettingPopup from './MicSettingPopup.svelte'
65+
import CamSettingPopup from './meeting/CamSettingPopup.svelte'
66+
import MicSettingPopup from './meeting/MicSettingPopup.svelte'
7067
import RoomAccessPopup from './RoomAccessPopup.svelte'
7168
import ShareSettingPopup from './ShareSettingPopup.svelte'
7269
@@ -98,14 +95,6 @@
9895
9996
const dispatch = createEventDispatcher()
10097
101-
async function changeMute (): Promise<void> {
102-
await setMic(!$isMicEnabled)
103-
}
104-
105-
async function changeCam (): Promise<void> {
106-
await setCam(!$isCameraEnabled)
107-
}
108-
10998
async function changeShare (): Promise<void> {
11099
const newValue = !$isSharingEnabled
111100
const audio = newValue && $isShareWithSound
@@ -206,10 +195,9 @@
206195
icon={$isMicEnabled ? love.icon.MicEnabled : love.icon.MicDisabled}
207196
label={$isMicEnabled ? love.string.Mute : love.string.UnMute}
208197
showTooltip={{
209-
label: !$isMicAllowed ? love.string.MicPermission : $isMicEnabled ? love.string.Mute : love.string.UnMute
198+
label: $isMicEnabled ? love.string.Mute : love.string.UnMute
210199
}}
211-
disabled={!$isMicAllowed}
212-
action={changeMute}
200+
action={toggleMicState}
213201
secondIcon={IconUpOutline}
214202
secondAction={micSettings}
215203
separate
@@ -220,14 +208,9 @@
220208
icon={$isCameraEnabled ? love.icon.CamEnabled : love.icon.CamDisabled}
221209
label={$isCameraEnabled ? love.string.StopVideo : love.string.StartVideo}
222210
showTooltip={{
223-
label: !$isCamAllowed
224-
? love.string.CamPermission
225-
: $isCameraEnabled
226-
? love.string.StopVideo
227-
: love.string.StartVideo
211+
label: $isCameraEnabled ? love.string.StopVideo : love.string.StartVideo
228212
}}
229-
disabled={!$isCamAllowed}
230-
action={changeCam}
213+
action={toggleCamState}
231214
secondIcon={IconUpOutline}
232215
secondAction={camSettings}
233216
separate

0 commit comments

Comments
 (0)