diff --git a/client/public/en.lang b/client/public/en.lang index b2cfb83a4..7a0b72d5b 100644 --- a/client/public/en.lang +++ b/client/public/en.lang @@ -17,7 +17,8 @@ navbar.upgradeRequired=Upgrade required home.confirmLoginHeader=Welcome back! home.confirmLoginBody=Are you trying to login as %player?
If you are not, please close this window. -home.confirmLoginButton=Yes! That's me! +home.confirmLoginButton=Start session +home.confirmLoginWithVoicechat=Start session with VoiceChat home.activate=Activate session home.activateText=This is personal webpage will be used to play your audio and voice throughout your visit. Please click anywhere on this page to get started. diff --git a/client/src/client/OpenAudioAppContainer.js b/client/src/client/OpenAudioAppContainer.js index a9296c64c..8fd486a1f 100644 --- a/client/src/client/OpenAudioAppContainer.js +++ b/client/src/client/OpenAudioAppContainer.js @@ -172,6 +172,14 @@ class OpenAudioAppContainer extends React.Component { return; } + if (serverData.isVoicechatEnabled) { + setGlobalState({ + voiceState: { + serverHasVoiceChat: true, + }, + }) + } + if (serverData.useTranslations) { let localLanguage = navigator.language || navigator.userLanguage; let language = localLanguage.split("-")[0]; diff --git a/client/src/client/services/socket/handlers/voice/HandleVoicechatUnlock.js b/client/src/client/services/socket/handlers/voice/HandleVoicechatUnlock.js index a90d643fa..9ed4e9cec 100644 --- a/client/src/client/services/socket/handlers/voice/HandleVoicechatUnlock.js +++ b/client/src/client/services/socket/handlers/voice/HandleVoicechatUnlock.js @@ -1,5 +1,6 @@ -import {setGlobalState} from "../../../../../state/store"; +import {getGlobalState, setGlobalState} from "../../../../../state/store"; import {toast} from "react-toastify"; +import {VoiceModule} from "../../../voice/VoiceModule"; export function HandleVoiceUnlock(data) { @@ -27,4 +28,9 @@ export function HandleVoiceUnlock(data) { serverHasModeration: data.hasModeration } }) + + // is it set to auto join? + if (getGlobalState().voiceState.autoJoinVoiceChat) { + VoiceModule.startVoiceChat(); + } } diff --git a/client/src/client/services/voice/VoiceModule.js b/client/src/client/services/voice/VoiceModule.js index 1d9595800..257b5a747 100644 --- a/client/src/client/services/voice/VoiceModule.js +++ b/client/src/client/services/voice/VoiceModule.js @@ -10,6 +10,7 @@ import * as PluginChannel from "../../util/PluginChannel"; import {VoicePeer} from "./peers/VoicePeer"; import {feedDebugValue} from "../debugging/DebugService"; import {DebugStatistic} from "../debugging/DebugStatistic"; +import {setTab} from "../../../components/tabwindow/TabWindow"; var gainTrackers = {} @@ -69,6 +70,7 @@ export const VoiceModule = new class IVoiceModule { } startVoiceChat() { + setTab(1); this.showLoadingPopup(); // try to get the device diff --git a/client/src/components/clicktoconnect/ClickPrompt.js b/client/src/components/clicktoconnect/ClickPrompt.js index bdde8dbd9..436613410 100644 --- a/client/src/components/clicktoconnect/ClickPrompt.js +++ b/client/src/components/clicktoconnect/ClickPrompt.js @@ -3,9 +3,10 @@ import "./clickprompt.css"; import {getTranslation, OAC} from "../../client/OpenAudioAppContainer"; import {OaStyleCard} from "../card/OaStyleCard"; import {BlackoutPage} from "../layout/BlackoutPage"; -import {getGlobalState} from "../../state/store"; +import {getGlobalState, setGlobalState} from "../../state/store"; +import {connect} from "react-redux"; -export class ClickPrompt extends React.Component { +class ClickPrompt extends React.Component { static contextType = OAC; render() { @@ -14,52 +15,63 @@ export class ClickPrompt extends React.Component { let welcomeWithName = getTranslation(c, "home.confirmLoginBody"); welcomeWithName = welcomeWithName.replace("%name", currentUser.userName); + + // instant join voice button as well + let voiceButton = ; + return (
- -
-
-
- -
-
-
-
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + {voiceButton} +
+
- -
} fullWidth={true}/> +
- //
- //
- //
- //
- //
- //
- //

- // {getTranslation(c, "home.welcome")} - //

- //

- // {getTranslation(c, "home.activateText")} - //

- //
- //
- //
- //
- //
- //
- //
); } +} + +export default connect(mapStateToProps)(ClickPrompt); + +function mapStateToProps(state) { + return { + voiceState: state.voiceState, + }; } \ No newline at end of file diff --git a/client/src/components/onboarding/VcOnboarding.js b/client/src/components/onboarding/VcOnboarding.js index a9372e61e..20ab64fba 100644 --- a/client/src/components/onboarding/VcOnboarding.js +++ b/client/src/components/onboarding/VcOnboarding.js @@ -2,7 +2,6 @@ import React from "react"; import {getTranslation, OAC} from "../../client/OpenAudioAppContainer"; import {VoiceModule} from "../../client/services/voice/VoiceModule"; import {getGlobalState} from "../../state/store"; -import {setTab} from "../tabwindow/TabWindow"; import "./onboarding.css" @@ -23,7 +22,6 @@ export class VcOnboarding extends React.Component { if (this.state.clicked) return; this.setState({clicked: true}); VoiceModule.startVoiceChat(); - setTab(1); } render() { diff --git a/client/src/state/store.js b/client/src/state/store.js index 1486a8780..03aef4508 100644 --- a/client/src/state/store.js +++ b/client/src/state/store.js @@ -71,6 +71,8 @@ const initialState = { }, voiceState: { + autoJoinVoiceChat: false, + serverHasVoiceChat: false, peersHidden: false, isModerating: false, isTemporarilyDisabled: false, diff --git a/client/src/views/client/pages/audio/AudioPage.js b/client/src/views/client/pages/audio/AudioPage.js index 3424ba3a4..723d5a5c5 100644 --- a/client/src/views/client/pages/audio/AudioPage.js +++ b/client/src/views/client/pages/audio/AudioPage.js @@ -1,6 +1,6 @@ import React from "react"; import {Header} from "../../../../components/header/Header"; -import {ClickPrompt} from "../../../../components/clicktoconnect/ClickPrompt"; +import ClickPrompt from "../../../../components/clicktoconnect/ClickPrompt"; import {getTranslation, OAC} from "../../../../client/OpenAudioAppContainer"; import {VcOnboarding} from "../../../../components/onboarding/VcOnboarding"; import AudioVolume from "../../../../components/audio/AudioVolume";