From 8b14ff2c96e288003ae6a87f5e5c490334c940c7 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Fri, 2 Sep 2022 13:40:59 +0300 Subject: [PATCH] add simple debug prompt to make it easier to debug on mobile devices --- .../src/components/overlays/Settings.svelte | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/overlays/Settings.svelte b/frontend/src/components/overlays/Settings.svelte index 9dc3434..f1bc9cb 100644 --- a/frontend/src/components/overlays/Settings.svelte +++ b/frontend/src/components/overlays/Settings.svelte @@ -4,10 +4,37 @@ import { logOut } from "../../auth"; import { maybeModalFade, maybeModalFly } from "../../animations"; import request from "../../request"; - import { apiRoute } from "../../storage"; + import { apiRoute, getItem } from "../../storage"; const close = () => overlayStore.close("settings"); + const doDeveloper = () => { + overlayStore.open("prompt", { + heading: "", + valueName: "", + async onSubmit(value) { + const parts = value.split("##"); + if (parts.length < 1) { + return; + } + + const respond = (value) => { + overlayStore.close("prompt"); + overlayStore.open("toast", { message: value }); + }; + + switch (parts[0]) { + case "storage.getItem": { + return respond(getItem(parts[1])); + } + default: { + return respond("Error: unknown operator"); + } + } + }, + }); + }; + const doLogout = () => { close(); logOut(); @@ -70,7 +97,7 @@