From 7b8af36bf8131d4be783f4c4c425ca5f5fa0ac52 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 22 Oct 2024 23:16:24 -0600 Subject: add preferences --- README.md | 4 ++-- iTexSnip/Views/PreferencesView.swift | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index be58bf1..8a2b7a3 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ Image -> TeX ### V1 - [ ] Rating API (So I can improve the models!) -- [ ] Preferences +- [x] Preferences - Model load preferences - Detailed view preferences - Rating API server -- [ ] Complete Detailed Snippet View +- [x] Complete Detailed Snippet View ### V2 - [ ] Math Solver diff --git a/iTexSnip/Views/PreferencesView.swift b/iTexSnip/Views/PreferencesView.swift index 9837b88..1f9d514 100644 --- a/iTexSnip/Views/PreferencesView.swift +++ b/iTexSnip/Views/PreferencesView.swift @@ -8,9 +8,23 @@ import SwiftUI struct PreferencesView: View { - var body: some View { - Text("Where are my preferences?!") - .padding() - .frame(width: 300, height: 200) - } + @AppStorage("apiEndpoint") var apiEndpoint: String = "https://snippetfeedback.itexsnip.navan.dev/rate_snippet" + @AppStorage("loadModelOnStart") var loadModelOnStart: Bool = true + @AppStorage("showOriginalImage") var showOriginalImage: Bool = false + + var body: some View { + Form { + Section(header: Text("API Settings")) { + TextField("Rating API Endpoint", text: $apiEndpoint) + .textFieldStyle(RoundedBorderTextFieldStyle()) + } + + Section(header: Text("Application Settings")) { + Toggle("Load model on app start", isOn: $loadModelOnStart) + Toggle("Show original image by default", isOn: $showOriginalImage) + } + } + .padding(20) + .frame(width: 400, height: 200) + } } -- cgit v1.2.3