settings page + re-view tutorial

This commit is contained in:
leminlimez committed 2025-06-01 06:43:29 -04:00
1 parent 5e8b061d10
commit 3d2cd8d522
2 files changed
+66 -22

No files matched your search

+26 -22
View File
@@ -36,15 +36,6 @@ struct ContentView: View {
} }
.font(.caption) .font(.caption)
.padding(.bottom, 10) .padding(.bottom, 10)
Section {
HStack {
Text("App Hash:")
.bold()
Spacer()
}
TextField("App Hash", text: $pbHash)
}
.padding(.bottom, 5)
Section { Section {
Button(action: { Button(action: {
@@ -70,26 +61,39 @@ struct ContentView: View {
} }
Section { Section {
if selectedTendies != nil && pbHash != "" { if selectedTendies != nil {
Button(action: { if pbHash == "" {
do { Text("Enter your PosterBoard app hash in Settings.")
try PosterBoardManager.applyTendies(selectedTendies!, appHash: pbHash) } else {
selectedTendies = nil Button(action: {
lastError = "The PosterBoard app will now open. Please close it from the app switcher." do {
showSuccessAlert.toggle() try PosterBoardManager.applyTendies(selectedTendies!, appHash: pbHash)
} catch { selectedTendies = nil
lastError = error.localizedDescription lastError = "The PosterBoard app will now open. Please close it from the app switcher."
showErrorAlert.toggle() showSuccessAlert.toggle()
} catch {
lastError = error.localizedDescription
showErrorAlert.toggle()
}
}) {
Text("Apply")
} }
}) { .buttonStyle(TintedButton(color: .blue, fullwidth: true))
Text("Apply")
} }
.buttonStyle(TintedButton(color: .blue, fullwidth: true))
} }
} }
} }
.padding() .padding()
.navigationTitle("Pocket Poster") .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 .fileImporter(isPresented: $showTendiesImporter, allowedContentTypes: [UTType(filenameExtension: "tendies", conformingTo: .data)!], allowsMultipleSelection: true, onCompletion: { result in
switch result { switch result {
+40
View File
@@ -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()
}
}