add haptics

This commit is contained in:
leminlimez committed 2025-06-01 07:40:36 -04:00
1 parent 744a243080
commit 0bcd42fbed
2 files changed
+13

No files matched your search

+9
View File
@@ -42,6 +42,7 @@ struct ContentView: View {
Section { Section {
Button(action: { Button(action: {
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
showTendiesImporter.toggle() showTendiesImporter.toggle()
}) { }) {
Text("Select Tendies") Text("Select Tendies")
@@ -69,12 +70,20 @@ struct ContentView: View {
Text("Enter your PosterBoard app hash in Settings.") Text("Enter your PosterBoard app hash in Settings.")
} else { } else {
Button(action: { Button(action: {
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
UIApplication.shared.alert(title: NSLocalizedString("Applying Tendies...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
do { do {
try PosterBoardManager.applyTendies(selectedTendies!, appHash: pbHash) try PosterBoardManager.applyTendies(selectedTendies!, appHash: pbHash)
selectedTendies = nil selectedTendies = nil
Haptic.shared.notify(.success)
UIApplication.shared.dismissAlert(animated: true)
// TODO: Clear downloaded tendies
lastError = "The PosterBoard app will now open. Please close it from the app switcher." lastError = "The PosterBoard app will now open. Please close it from the app switcher."
showSuccessAlert.toggle() showSuccessAlert.toggle()
} catch { } catch {
Haptic.shared.notify(.error)
UIApplication.shared.dismissAlert(animated: true)
lastError = error.localizedDescription lastError = error.localizedDescription
showErrorAlert.toggle() showErrorAlert.toggle()
} }
+4
View File
@@ -32,6 +32,7 @@ struct SettingsView: View {
Section { Section {
Button(action: { Button(action: {
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
UserDefaults.standard.set(false, forKey: "finishedTutorial") UserDefaults.standard.set(false, forKey: "finishedTutorial")
}) { }) {
Text("Replay Tutorial") Text("Replay Tutorial")
@@ -39,12 +40,15 @@ struct SettingsView: View {
.buttonStyle(TintedButton(color: .blue, fullwidth: true)) .buttonStyle(TintedButton(color: .blue, fullwidth: true))
Button(action: { Button(action: {
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
do { do {
try PosterBoardManager.clearCache() try PosterBoardManager.clearCache()
Haptic.shared.notify(.success)
errorAlertTitle = "App Cache Successfully Cleared!" errorAlertTitle = "App Cache Successfully Cleared!"
errorAlertDescr = "" errorAlertDescr = ""
showErrorAlert = true showErrorAlert = true
} catch { } catch {
Haptic.shared.notify(.error)
errorAlertTitle = "Error" errorAlertTitle = "Error"
errorAlertDescr = error.localizedDescription errorAlertDescr = error.localizedDescription
showErrorAlert = true showErrorAlert = true