Skip to content

Commit

Permalink
OCV: add web config flag client side (#10386)
Browse files Browse the repository at this point in the history
* add webconfig flag clientside

* add flag to test

* change flag to be optional, remove from test files
  • Loading branch information
srietkerk authored Feb 14, 2025
1 parent 4319736 commit 1747bd9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pxtlib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ namespace pxt {
teachertoolUrl?: string; // "/beta---eval"
isStatic?: boolean;
verprefix?: string; // "v1"
ocvEnabled?: boolean;
}

export function localWebConfig() {
Expand All @@ -418,7 +419,8 @@ namespace pxt {
simUrl: "/sim/simulator.html",
simserviceworkerUrl: "/simulatorserviceworker.js",
simworkerconfigUrl: "/sim/workerConfig.js",
partsUrl: "/sim/siminstructions.html"
partsUrl: "/sim/siminstructions.html",
ocvEnabled: true,
}
return r
}
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5293,7 +5293,7 @@ export class ProjectView
const hideMenuBar = targetTheme.hideMenuBar || hideTutorialIteration || (isTabTutorial && pxt.appTarget.appTheme.embeddedTutorial) || pxt.shell.isTimeMachineEmbed();
const isHeadless = simOpts && simOpts.headless;
const selectLanguage = targetTheme.selectLanguage;
const feedbackEnabled = targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
const feedbackEnabled = pxt.webConfig.ocvEnabled && targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
const showEditorToolbar = inEditor && !hideEditorToolbar && this.editor.hasEditorToolbar();
const useSerialEditor = pxt.appTarget.serial && !!pxt.appTarget.serial.useEditor;
const showSideDoc = sideDocs && this.state.sideDocsLoadUrl && !this.state.sideDocsCollapsed;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class SettingsMenu extends data.Component<SettingsMenuProps, SettingsMenu
const showPairDevice = pxt.usb.isEnabled;

const showCenterDivider = targetTheme.selectLanguage || targetTheme.highContrast || showGreenScreen || githubUser;
const showFeedbackOption = targetTheme.feedbackEnabled && targetTheme.ocvAppId && targetTheme.ocvFrameUrl;
const showFeedbackOption = pxt.webConfig.ocvEnabled && targetTheme.feedbackEnabled && targetTheme.ocvAppId && targetTheme.ocvFrameUrl;

const simCollapseText = headless ? lf("Toggle the File Explorer") : lf("Toggle the simulator");

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class ProjectSettingsMenu extends data.Component<ProjectSettingsMenuProps
const githubUser = !hasIdentity && this.getData("github:user") as UserInfo;
const reportAbuse = pxt.appTarget.cloud && pxt.appTarget.cloud.sharing && pxt.appTarget.cloud.importing;
const showDivider = targetTheme.selectLanguage || targetTheme.highContrast || githubUser;
const showFeedbackOption = targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
const showFeedbackOption = pxt.webConfig.ocvEnabled && targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
sendUpdateFeedbackTheme(highContrast);

return <sui.DropdownMenu role="menuitem" icon={'setting large'} title={lf("Settings")} className="item icon more-dropdown-menuitem" ref={ref => this.dropdown = ref}>
Expand Down

0 comments on commit 1747bd9

Please sign in to comment.