Compare commits

...

4 Commits

Author SHA1 Message Date
Adam Shiervani 8c88f72ba4 feat: add acknowledgment checkbox for version changes in advanced settings 2025-11-06 11:54:50 +01:00
Adam Shiervani 931413acd9
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-06 11:18:54 +01:00
Adam Shiervani 550ff2e108
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-06 11:18:31 +01:00
Adam Shiervani cc36d83154
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-06 11:15:54 +01:00
3 changed files with 15 additions and 6 deletions

View File

@ -10,5 +10,5 @@
] ]
}, },
"git.ignoreLimitWarning": true, "git.ignoreLimitWarning": true,
"cmake.sourceDirectory": "/workspaces/kvm-sleep-mode/internal/native/cgo" "cmake.sourceDirectory": "internal/native/cgo"
} }

View File

@ -31,6 +31,7 @@ export default function SettingsAdvancedRoute() {
const [appVersion, setAppVersion] = useState<string>(""); const [appVersion, setAppVersion] = useState<string>("");
const [systemVersion, setSystemVersion] = useState<string>(""); const [systemVersion, setSystemVersion] = useState<string>("");
const [resetConfig, setResetConfig] = useState(false); const [resetConfig, setResetConfig] = useState(false);
const [versionChangeAcknowledged, setVersionChangeAcknowledged] = useState(false);
const settings = useSettingsStore(); const settings = useSettingsStore();
@ -203,7 +204,7 @@ export default function SettingsAdvancedRoute() {
const pageParams = new URLSearchParams(); const pageParams = new URLSearchParams();
pageParams.set("downgrade", "true"); pageParams.set("downgrade", "true");
pageParams.set("resetConfig", resetConfig.toString()); pageParams.set("resetConfig", resetConfig.toString());
pageParams.set("components", updateTarget == "both" ? "app,system" : updateTarget); pageParams.set("components", updateTarget === "both" ? "app,system" : updateTarget);
// Navigate to update page // Navigate to update page
navigateTo(`/settings/general/update?${pageParams.toString()}`); navigateTo(`/settings/general/update?${pageParams.toString()}`);
@ -354,7 +355,15 @@ export default function SettingsAdvancedRoute() {
checked={resetConfig} checked={resetConfig}
onChange={e => setResetConfig(e.target.checked)} onChange={e => setResetConfig(e.target.checked)}
/> />
</div> </div>
<div>
<CheckboxWithLabel
label="I understand version changes may break my device and require factory reset"
checked={versionChangeAcknowledged}
onChange={e => setVersionChangeAcknowledged(e.target.checked)}
/>
</div>
<Button <Button
size="SM" size="SM"
@ -363,7 +372,8 @@ export default function SettingsAdvancedRoute() {
disabled={ disabled={
(updateTarget === "app" && !appVersion) || (updateTarget === "app" && !appVersion) ||
(updateTarget === "system" && !systemVersion) || (updateTarget === "system" && !systemVersion) ||
(updateTarget === "both" && (!appVersion || !systemVersion)) (updateTarget === "both" && (!appVersion || !systemVersion)) ||
!versionChangeAcknowledged
} }
onClick={handleVersionUpdate} onClick={handleVersionUpdate}
/> />

View File

@ -14,8 +14,7 @@ import { m } from "@localizations/messages.js";
export default function SettingsGeneralUpdateRoute() { export default function SettingsGeneralUpdateRoute() {
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
//@ts-ignore const [searchParams] = useSearchParams();
const [searchParams, setSearchParams] = useSearchParams();
const { updateSuccess } = location.state || {}; const { updateSuccess } = location.state || {};
const { setModalView, otaState } = useUpdateStore(); const { setModalView, otaState } = useUpdateStore();