|
1 | 1 | import { action } from 'typesafe-actions' |
2 | | -import type { VoiceCommunicator } from 'voice-chat-codec/VoiceCommunicator' |
3 | 2 | import type { CommsContext } from './context' |
4 | | -import type { VoicePolicy } from './types' |
5 | | - |
6 | | -export const VOICE_PLAYING_UPDATE = '[COMMS] voicePlayingUpdate' |
7 | | -export const voicePlayingUpdate = (userId: string, playing: boolean) => |
8 | | - action(VOICE_PLAYING_UPDATE, { userId, playing }) |
9 | | -export type VoicePlayingUpdate = ReturnType<typeof voicePlayingUpdate> |
10 | | - |
11 | | -export const INIT_VOICE_COMMUNICATOR = '[COMMS] setVoiceCommunicator' |
12 | | -export const setVoiceCommunicator = (voiceCommunicator: VoiceCommunicator | null) => |
13 | | - action(INIT_VOICE_COMMUNICATOR, { voiceCommunicator }) |
14 | | - |
15 | | -/** |
16 | | - * Action to join voice chat |
17 | | - */ |
18 | | -export const JOIN_VOICE_CHAT = '[COMMS] joinVoiceChat' |
19 | | -export const joinVoiceChat = () => action(JOIN_VOICE_CHAT) |
20 | | - |
21 | | -/** |
22 | | - * Action to leave voice chat |
23 | | - */ |
24 | | -export const LEAVE_VOICE_CHAT = '[COMMS] leaveVoiceChat' |
25 | | -export const leaveVoiceChat = () => action(LEAVE_VOICE_CHAT) |
26 | | - |
27 | | -/** |
28 | | - * Action to trigger voice chat recording |
29 | | - */ |
30 | | -export const SET_VOICE_CHAT_RECORDING = '[COMMS] setVoiceChatRecording' |
31 | | -export const setVoiceChatRecording = (recording: boolean) => action(SET_VOICE_CHAT_RECORDING, { recording }) |
32 | | -export type SetVoiceChatRecording = ReturnType<typeof setVoiceChatRecording> |
33 | | - |
34 | | -/** |
35 | | - * Action to toggle voice chat recording |
36 | | - */ |
37 | | -export const TOGGLE_VOICE_CHAT_RECORDING = '[COMMS] toggleVoiceChatRecording' |
38 | | -export const toggleVoiceChatRecording = () => action(TOGGLE_VOICE_CHAT_RECORDING) |
39 | | -export type ToggleVoiceChatRecording = ReturnType<typeof toggleVoiceChatRecording> |
40 | | - |
41 | | -/** |
42 | | - * Action triggered when recording starts or stops |
43 | | - */ |
44 | | -export const VOICE_RECORDING_UPDATE = '[COMMS] voiceRecordingUpdate' |
45 | | -export const voiceRecordingUpdate = (recording: boolean) => action(VOICE_RECORDING_UPDATE, { recording }) |
46 | | -export type VoiceRecordingUpdate = ReturnType<typeof voiceRecordingUpdate> |
47 | | - |
48 | | -export const SET_VOICE_VOLUME = '[COMMS] setVoiceVolume' |
49 | | -export const setVoiceVolume = (volume: number) => action(SET_VOICE_VOLUME, { volume }) |
50 | | -export type SetVoiceVolume = ReturnType<typeof setVoiceVolume> |
51 | | - |
52 | | -export const SET_VOICE_MUTE = '[COMMS] setVoiceMute' |
53 | | -export const setVoiceMute = (mute: boolean) => action(SET_VOICE_MUTE, { mute }) |
54 | | -export type SetVoiceMute = ReturnType<typeof setVoiceMute> |
55 | | - |
56 | | -export const SET_VOICE_POLICY = '[COMMS] setVoicePolicy' |
57 | | -export const setVoicePolicy = (voicePolicy: VoicePolicy) => action(SET_VOICE_POLICY, { voicePolicy }) |
58 | | -export type SetVoicePolicy = ReturnType<typeof setVoicePolicy> |
59 | 3 |
|
60 | 4 | export const SET_COMMS_ISLAND = '[COMMS] setCommsIsland' |
61 | 5 | export const setCommsIsland = (island: string | undefined) => action(SET_COMMS_ISLAND, { island }) |
|
0 commit comments