Skip to content
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
4 changes: 2 additions & 2 deletions gui/src/components/settings/pages/HomeScreenSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export function TrackingChecklistSettings({
// doing it this way prevents calling ignore step for every step.
// that prevent sending a packet for steps that didnt change
if (!value && !ignoredSteps.includes(stepId)) {
ignoreStep(stepId, true);
ignoreStep(stepId, true, false);
}

if (value && ignoredSteps.includes(stepId)) {
ignoreStep(stepId, false);
ignoreStep(stepId, false, false);
}
}
};
Expand Down
40 changes: 26 additions & 14 deletions gui/src/components/tracking-checklist/TrackingChecklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ const stepContentLookup: Record<
context: TrackingChecklistContext
) => JSX.Element
> = {
[TrackingChecklistStepId.TRACKERS_REST_CALIBRATION]: (step, { toggle }) => {
[TrackingChecklistStepId.TRACKERS_REST_CALIBRATION]: (
step,
{ toggleSession }
) => {
return (
<div className="space-y-2.5">
<Typography id="tracking_checklist-TRACKERS_REST_CALIBRATION-desc" />
Expand All @@ -118,7 +121,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
Expand Down Expand Up @@ -166,7 +169,7 @@ const stepContentLookup: Record<
</div>
);
},
[TrackingChecklistStepId.STEAMVR_DISCONNECTED]: (step, { toggle }) => {
[TrackingChecklistStepId.STEAMVR_DISCONNECTED]: (step, { toggleSession }) => {
return (
<>
<div className="space-y-2.5">
Expand All @@ -181,7 +184,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
Expand All @@ -195,7 +198,10 @@ const stepContentLookup: Record<
[TrackingChecklistStepId.UNASSIGNED_HMD]: () => {
return <Typography id="tracking_checklist-UNASSIGNED_HMD-desc" />;
},
[TrackingChecklistStepId.NETWORK_PROFILE_PUBLIC]: (step, { toggle }) => {
[TrackingChecklistStepId.NETWORK_PROFILE_PUBLIC]: (
step,
{ toggleSession }
) => {
const data = step.extraData as TrackingChecklistPublicNetworksT | null;
return (
<>
Expand Down Expand Up @@ -226,15 +232,15 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
</div>
</>
);
},
[TrackingChecklistStepId.VRCHAT_SETTINGS]: (step, { toggle }) => {
[TrackingChecklistStepId.VRCHAT_SETTINGS]: (step, { toggleSession }) => {
return (
<>
<div className="space-y-2.5">
Expand All @@ -249,15 +255,15 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
</div>
</>
);
},
[TrackingChecklistStepId.MOUNTING_CALIBRATION]: (step, { toggle }) => {
[TrackingChecklistStepId.MOUNTING_CALIBRATION]: (step, { toggleSession }) => {
return (
<div className="space-y-2.5">
<Typography id="onboarding-automatic_mounting-mounting_reset-step-0" />
Expand All @@ -275,14 +281,17 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
</div>
);
},
[TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION]: (step, { toggle }) => {
[TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION]: (
step,
{ toggleSession }
) => {
return (
<div className="space-y-2.5">
<Typography id="onboarding-automatic_mounting-mounting_reset-feet-step-0" />
Expand All @@ -309,14 +318,17 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
</div>
);
},
[TrackingChecklistStepId.STAY_ALIGNED_CONFIGURED]: (step, { toggle }) => {
[TrackingChecklistStepId.STAY_ALIGNED_CONFIGURED]: (
step,
{ toggleSession }
) => {
return (
<>
<div className="space-y-2.5">
Expand All @@ -332,7 +344,7 @@ const stepContentLookup: Record<
<Button
id="tracking_checklist-ignore"
variant="secondary"
onClick={() => toggle(step.id)}
onClick={() => toggleSession(step.id)}
/>
)}
</div>
Expand Down
48 changes: 39 additions & 9 deletions gui/src/hooks/tracking-checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,16 @@ export type Steps = {
visibleSteps: TrackingChecklistStep[];
ignoredSteps: TrackingChecklistStepId[];
};

const filterActive =
(ignoredSteps: TrackingChecklistStepId[]) => (step: TrackingChecklistStepT) =>
!ignoredSteps.includes(step.id) && step.enabled;

export function provideTrackingChecklist() {
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const [sessionIgnoredSteps, setSessionIgnoredSteps] = useState<
TrackingChecklistStepId[]
>([]);
const [steps, setSteps] = useState<Steps>({
steps: [],
visibleSteps: [],
Expand All @@ -104,7 +112,7 @@ export function provideTrackingChecklist() {
RpcMessage.TrackingChecklistResponse,
(data: TrackingChecklistResponseT) => {
const activeSteps = data.steps.filter(
(step) => !data.ignoredSteps.includes(step.id) && step.enabled
filterActive([...data.ignoredSteps, ...sessionIgnoredSteps])
);
setSteps({
steps: data.steps,
Expand Down Expand Up @@ -161,26 +169,48 @@ export function provideTrackingChecklist() {
[steps]
);

const ignoreStep = (step: TrackingChecklistStepId, ignore: boolean) => {
const res = new IgnoreTrackingChecklistStepRequestT();
res.stepId = step;
res.ignore = ignore;
sendRPCPacket(RpcMessage.IgnoreTrackingChecklistStepRequest, res);
const ignoreStep = (
step: TrackingChecklistStepId,
ignore: boolean,
session = true
) => {
setSessionIgnoredSteps((curr) => {
if (ignore && !curr.includes(step)) return [...curr, step];
if (!ignore && curr.includes(step)) {
curr.splice(curr.indexOf(step), 1);
return curr;
}
return curr;
});
Sentry.metrics.count(ignore ? 'mute_checklist_step' : 'unmute_checklist_step', 1, {
attributes: { step: TrackingChecklistStepId[step] },
attributes: { step: TrackingChecklistStepId[step], session },
});
if (session) {
// Force refresh of the flightlist when ignoring a step as the filtering
// is done only in one place to simplify the data flow
sendRPCPacket(
RpcMessage.TrackingChecklistRequest,
new TrackingChecklistRequestT()
);
} else {
const res = new IgnoreTrackingChecklistStepRequestT();
res.stepId = step;
res.ignore = ignore;
sendRPCPacket(RpcMessage.IgnoreTrackingChecklistStepRequest, res);
}
};

return {
...steps,
sessionIgnoredSteps,
firstRequired,
highlightedTrackers,
progress,
completion,
warnings,
ignoreStep,
toggle: (step: TrackingChecklistStepId) =>
ignoreStep(step, !steps.ignoredSteps.includes(step)),
toggleSession: (step: TrackingChecklistStepId) =>
ignoreStep(step, !sessionIgnoredSteps.includes(step)),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ public ObjectNode convert(
}
}
}

if (version < 15) {
ObjectNode checklistNode = (ObjectNode) modelData.get("trackingChecklist");
if (checklistNode != null) {
ArrayNode ignoredStepsArray = (ArrayNode) checklistNode.get("ignoredStepsIds");
if (ignoredStepsArray != null)
ignoredStepsArray.removeAll();
}
}
} catch (Exception e) {
LogManager.severe("Error during config migration: " + e);
}
Expand Down
4 changes: 2 additions & 2 deletions server/core/src/main/java/dev/slimevr/config/VRConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import dev.slimevr.tracking.trackers.Tracker
import dev.slimevr.tracking.trackers.TrackerRole

@JsonVersionedModel(
currentVersion = "14",
defaultDeserializeToVersion = "14",
currentVersion = "15",
defaultDeserializeToVersion = "15",
toCurrentConverterClass = CurrentVRConfigConverter::class,
)
class VRConfig {
Expand Down