diff --git a/Pocket Poster/Views/ContentView.swift b/Pocket Poster/Views/ContentView.swift index b284109..1c1950d 100644 --- a/Pocket Poster/Views/ContentView.swift +++ b/Pocket Poster/Views/ContentView.swift @@ -36,15 +36,6 @@ struct ContentView: View { } .font(.caption) .padding(.bottom, 10) - Section { - HStack { - Text("App Hash:") - .bold() - Spacer() - } - TextField("App Hash", text: $pbHash) - } - .padding(.bottom, 5) Section { Button(action: { @@ -70,26 +61,39 @@ struct ContentView: View { } Section { - if selectedTendies != nil && pbHash != "" { - Button(action: { - do { - try PosterBoardManager.applyTendies(selectedTendies!, appHash: pbHash) - selectedTendies = nil - lastError = "The PosterBoard app will now open. Please close it from the app switcher." - showSuccessAlert.toggle() - } catch { - lastError = error.localizedDescription - showErrorAlert.toggle() + if selectedTendies != nil { + if pbHash == "" { + Text("Enter your PosterBoard app hash in Settings.") + } else { + Button(action: { + do { + try PosterBoardManager.applyTendies(selectedTendies!, appHash: pbHash) + selectedTendies = nil + lastError = "The PosterBoard app will now open. Please close it from the app switcher." + showSuccessAlert.toggle() + } catch { + lastError = error.localizedDescription + showErrorAlert.toggle() + } + }) { + Text("Apply") } - }) { - Text("Apply") + .buttonStyle(TintedButton(color: .blue, fullwidth: true)) } - .buttonStyle(TintedButton(color: .blue, fullwidth: true)) } } } .padding() .navigationTitle("Pocket Poster") + .toolbar { + ToolbarItem(placement: .topBarTrailing, content: { + NavigationLink(destination: { + SettingsView() + }, label: { + Image(systemName: "gear") + }) + }) + } } .fileImporter(isPresented: $showTendiesImporter, allowedContentTypes: [UTType(filenameExtension: "tendies", conformingTo: .data)!], allowsMultipleSelection: true, onCompletion: { result in switch result { diff --git a/Pocket Poster/Views/SettingsView.swift b/Pocket Poster/Views/SettingsView.swift new file mode 100644 index 0000000..09a8b6c --- /dev/null +++ b/Pocket Poster/Views/SettingsView.swift @@ -0,0 +1,40 @@ +// +// SettingsView.swift +// Pocket Poster +// +// Created by lemin on 6/1/25. +// + +import SwiftUI + +struct SettingsView: View { + // Prefs + @AppStorage("pbHash") var pbHash: String = "" + + var body: some View { + ScrollView { + Section { + HStack { + Text("App Hash:") + .font(.headline) + .foregroundColor(.primary) + Spacer() + } + TextField("App Hash", text: $pbHash) + .textFieldStyle(RoundedBorderTextFieldStyle()) + .font(.system(.body, design: .monospaced)) + } + .padding(.bottom, 5) + + Section { + Button(action: { + UserDefaults.standard.set(false, forKey: "finishedTutorial") + }) { + Text("Replay Tutorial") + } + .buttonStyle(TintedButton(color: .blue, fullwidth: true)) + } + } + .padding() + } +}