Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitECS: Rename New Loader #6356

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assets/stylesheets/ui-root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ body.vr-mode {
pointer-events: auto;
}

:local(.new-loader-refresh-prompt) {
:local(.bitecs-based-client-refresh-prompt) {
@extend %default-font;
background: theme.$background1-color;
border: 3px solid theme.$border1-color;
Expand Down
12 changes: 6 additions & 6 deletions src/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,8 @@ export async function updateEnvironmentForHub(hub, entryManager) {
}
}

export async function updateUIForHub(hub, hubChannel, showNewLoaderRefreshPrompt = false) {
remountUI({ hub, entryDisallowed: !hubChannel.canEnterRoom(hub), showNewLoaderRefreshPrompt });
export async function updateUIForHub(hub, hubChannel, showBitECSBasedClientRefreshPrompt = false) {
remountUI({ hub, entryDisallowed: !hubChannel.canEnterRoom(hub), showBitECSBasedClientRefreshPrompt });
}

function onConnectionError(entryManager, connectError) {
Expand Down Expand Up @@ -1375,17 +1375,17 @@ document.addEventListener("DOMContentLoaded", async () => {
const userInfo = hubChannel.presence.state[session_id];
const displayName = (userInfo && userInfo.metas[0].profile.displayName) || "API";

let showNewLoaderRefreshPrompt = false;
let showBitECSBasedClientRefreshPrompt = false;

if (!!hub.user_data?.hubs_use_new_loader !== !!window.APP.hub.user_data?.hubs_use_new_loader) {
showNewLoaderRefreshPrompt = true;
if (!!hub.user_data?.hubs_use_bitecs_based_client !== !!window.APP.hub.user_data?.hubs_use_bitecs_based_client) {
showBitECSBasedClientRefreshPrompt = true;
setTimeout(() => {
document.location.reload();
}, 5000);
}

window.APP.hub = hub;
updateUIForHub(hub, hubChannel, showNewLoaderRefreshPrompt);
updateUIForHub(hub, hubChannel, showBitECSBasedClientRefreshPrompt);

if (
stale_fields.includes("scene") ||
Expand Down
16 changes: 12 additions & 4 deletions src/react-components/room/RoomSettingsSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,23 @@ export function RoomSettingsSidebar({
</div>
</InputField>
<InputField
label={<FormattedMessage id="room-settings-sidebar.new-loader" defaultMessage="New loader activation" />}
label={<FormattedMessage id="room-settings-sidebar.bitecs-client" defaultMessage="bitECS based Client" />}
fullWidth
>
{/* TODO: Refresh the page in all the clients in the room when toggled */}
<ToggleInput
label={
<FormattedMessage id="room-settings-sidebar.new-loader-activation" defaultMessage="Enable new loader" />
<FormattedMessage
id="room-settings-sidebar.bitecs-client-activation"
defaultMessage="Enable bitECS based Client"
/>
}
description={
<FormattedMessage
id="room-settings-sidebar.bitecs-client-activation-description"
defaultMessage="Enable or disable the new Client, which is implemented with bitECS for simplicity and extensibility."
/>
}
{...register("user_data.hubs_use_new_loader")}
{...register("user_data.hubs_use_bitecs_based_client")}
/>
</InputField>
<ApplyButton type="submit" />
Expand Down
10 changes: 5 additions & 5 deletions src/react-components/ui-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class UIRoot extends Component {
subscriptions: PropTypes.object,
initialIsFavorited: PropTypes.bool,
showSignInDialog: PropTypes.bool,
showNewLoaderRefreshPrompt: PropTypes.bool,
showBitECSBasedClientRefreshPrompt: PropTypes.bool,
signInMessage: PropTypes.object,
onContinueAfterSignIn: PropTypes.func,
showSafariMicDialog: PropTypes.bool,
Expand Down Expand Up @@ -1697,11 +1697,11 @@ class UIRoot extends Component {
/>
)}
</div>
{this.props.showNewLoaderRefreshPrompt && (
<div className={styles.newLoaderRefreshPrompt}>
{this.props.showBitECSBasedClientRefreshPrompt && (
<div className={styles.bitecsBasedClientRefreshPrompt}>
<FormattedMessage
id="ui-root.new-loader-refresh-prompt"
defaultMessage="This page will be reloaded in five seconds because the room owner toggled the new loader activation flag."
id="ui-root.bitecs-based-client-refresh-prompt"
defaultMessage="This page will be reloaded in five seconds because the room owner toggled the bitECS based client activation flag."
/>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/bit-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ export function findChildWithComponent(world: HubsWorld, component: Component, e

const forceNewLoader = qsTruthy("newLoader");
export function shouldUseNewLoader() {
return forceNewLoader || APP.hub?.user_data?.hubs_use_new_loader;
return forceNewLoader || APP.hub?.user_data?.hubs_use_bitecs_based_client;
}
Loading