Added use password option to saved settings

This commit is contained in:
Mitchell McCaffrey 2021-01-02 09:28:26 +11:00
parent ae98b54c7b
commit 485b893fc6
2 changed files with 9 additions and 2 deletions

View File

@ -1,10 +1,12 @@
import React, { useState, useContext, useRef } from "react";
import React, { useContext, useRef } from "react";
import { Box, Label, Input, Button, Flex, Checkbox } from "theme-ui";
import { useHistory } from "react-router-dom";
import shortid from "shortid";
import AuthContext from "../contexts/AuthContext";
import useSetting from "../helpers/useSetting";
import Modal from "../components/Modal";
function StartModal({ isOpen, onRequestClose }) {
@ -15,7 +17,7 @@ function StartModal({ isOpen, onRequestClose }) {
setPassword(event.target.value);
}
const [usePassword, setUsePassword] = useState(true);
const [usePassword, setUsePassword] = useSetting("game.usePassword");
function handleUsePasswordChange(event) {
setUsePassword(event.target.checked);
}

View File

@ -32,6 +32,11 @@ function loadVersions(settings) {
...prev,
map: { fullScreen: false, labelSize: 1 },
}));
// v1.7.0 - Added game password
settings.version(3, (prev) => ({
...prev,
game: { usePassword: true },
}));
}
export function getSettings() {