Skip to content

Commit

Permalink
Merge pull request #2972 from mozilla/revert-2959-feature/qs_quality
Browse files Browse the repository at this point in the history
Revert "Set default quality settings via qs params"
  • Loading branch information
johnshaughnessy committed Sep 3, 2020
2 parents 24cf8cc + feb4bc5 commit 9af73bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
5 changes: 3 additions & 2 deletions src/react-components/preferences-screen.js
Expand Up @@ -9,9 +9,10 @@ import { FormattedMessage } from "react-intl";
import { WrappedIntlProvider } from "./wrapped-intl-provider";
import styles from "../assets/stylesheets/preferences-screen.scss";
import { getMessages } from "../utils/i18n";
import { defaultMaterialQualitySetting } from "../storage/store";
import { AVAILABLE_LOCALES } from "../assets/locales/locale_config";

const isMobile = AFRAME.utils.device.isMobile() || AFRAME.utils.device.isMobileVR();

function round(step, n) {
return Math.round(n / step) * step;
}
Expand Down Expand Up @@ -605,7 +606,7 @@ const DEFINITIONS = new Map([
key: "materialQualitySetting",
prefType: PREFERENCE_LIST_ITEM_TYPE.SELECT,
options: [{ value: "low", text: "Low" }, { value: "medium", text: "Medium" }, { value: "high", text: "High" }],
defaultString: defaultMaterialQualitySetting,
defaultString: isMobile ? "low" : "high",
promptForRefresh: true
},
{
Expand Down
31 changes: 8 additions & 23 deletions src/storage/store.js
Expand Up @@ -2,7 +2,6 @@ import { Validator } from "jsonschema";
import merge from "deepmerge";
import Cookies from "js-cookie";
import jwtDecode from "jwt-decode";
import { qsGet } from "../utils/qs_truthy.js";

const LOCAL_STORE_KEY = "___hubs_store";
const STORE_STATE_CACHE_KEY = Symbol();
Expand All @@ -11,27 +10,6 @@ const validator = new Validator();
import { EventTarget } from "event-target-shim";
import { fetchRandomDefaultAvatarId, generateRandomName } from "../utils/identity.js";

export const defaultMaterialQualitySetting = (function() {
const MATERIAL_QUALITY_OPTIONS = ["low", "medium", "high"];
const isMobile = AFRAME.utils.device.isMobile();
const isMobileVR = AFRAME.utils.device.isMobileVR();

if (isMobile || isMobileVR) {
const qsMobileDefault = qsGet("default_mobile_material_quality");
if (qsMobileDefault && MATERIAL_QUALITY_OPTIONS.indexOf(qsMobileDefault) !== -1) {
return qsMobileDefault;
}
return "low";
}

const qsDefault = qsGet("default_material_quality");
if (qsDefault && MATERIAL_QUALITY_OPTIONS.indexOf(qsDefault) !== -1) {
return qsDefault;
}

return "high";
})();

// Durable (via local-storage) schema-enforced state that is meant to be consumed via forward data flow.
// (Think flux but with way less incidental complexity, at least for now :))
export const SCHEMA = {
Expand Down Expand Up @@ -357,6 +335,13 @@ export default class Store extends EventTarget {
return this.state.preferences.materialQualitySetting;
}

return defaultMaterialQualitySetting;
const isMobile = AFRAME.utils.device.isMobile();
const isMobileVR = AFRAME.utils.device.isMobileVR();

if (isMobile || isMobileVR) {
return "low";
}

return "high";
}
}

0 comments on commit 9af73bd

Please sign in to comment.