tutorial for how to reset collections

This commit is contained in:
leminlimez committed 2025-06-03 12:46:46 -04:00
1 parent 0d0d718459
commit fb054a5d19
17 files changed
+250 -28

No files matched your search

+35 -23
View File
@@ -26,6 +26,7 @@ struct ContentView: View {
@State var showErrorAlert = false
@State var showSuccessAlert = false
@State var lastError: String?
@State var hideResetHelp: Bool = true
var body: some View {
NavigationStack {
@@ -45,7 +46,7 @@ struct ContentView: View {
Text("Select Tendies")
}
.buttonStyle(TintedButton(color: .green, fullwidth: true))
.padding(10)
.padding(.vertical, 10)
if !selectedTendies.wrappedValue.isEmpty {
HStack {
@@ -64,36 +65,41 @@ struct ContentView: View {
}
Section {
if !selectedTendies.wrappedValue.isEmpty {
if pbHash == "" {
Text("Enter your PosterBoard app hash in Settings.")
} else {
if pbHash == "" {
Text("Enter your PosterBoard app hash in Settings.")
} else {
if !selectedTendies.wrappedValue.isEmpty {
Button(action: {
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
// UIApplication.shared.alert(title: NSLocalizedString("Applying Tendies...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
// UIApplication.shared.alert(title: NSLocalizedString("Applying Tendies...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
do {
try PosterBoardManager.applyTendies(selectedTendies.wrappedValue, appHash: pbHash)
selectedTendies.wrappedValue.removeAll()
try? FileManager.default.removeItem(at: PosterBoardManager.getTendiesStoreURL())
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."
showSuccessAlert.toggle()
} catch {
Haptic.shared.notify(.error)
// UIApplication.shared.dismissAlert(animated: true)
lastError = error.localizedDescription
showErrorAlert.toggle()
}
// }
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
do {
try PosterBoardManager.applyTendies(selectedTendies.wrappedValue, appHash: pbHash)
selectedTendies.wrappedValue.removeAll()
try? FileManager.default.removeItem(at: PosterBoardManager.getTendiesStoreURL())
Haptic.shared.notify(.success)
// UIApplication.shared.dismissAlert(animated: true)
lastError = "The PosterBoard app will now open. Please close it from the app switcher."
showSuccessAlert.toggle()
} catch {
Haptic.shared.notify(.error)
// UIApplication.shared.dismissAlert(animated: true)
lastError = error.localizedDescription
showErrorAlert.toggle()
}
// }
}) {
Text("Apply")
}
.buttonStyle(TintedButton(color: .blue, fullwidth: true))
}
Button(action: {
hideResetHelp = false
}) {
Text("Reset Collections")
}
.buttonStyle(TintedButton(color: .red, fullwidth: true))
}
}
}
@@ -130,6 +136,12 @@ struct ContentView: View {
} message: {
Text(lastError ?? "???")
}
.overlay {
OnBoardingView(cards: resetCollectionsInfo, isFinished: $hideResetHelp)
.opacity(hideResetHelp ? 0.0 : 1.0)
.transition(.opacity)
.animation(.easeOut(duration: 0.5), value: hideResetHelp)
}
}
func delete(at offsets: IndexSet) {
@@ -8,7 +8,7 @@
import SwiftUI
struct OnBoardingCardButtons: View {
@AppStorage("finishedTutorial") var finishedTutorial: Bool?
@Binding var isFinished: Bool
@Binding var idx: Int
@Binding var isAnimating: Bool
@@ -74,7 +74,7 @@ struct OnBoardingCardButtons: View {
func playFinishAnimation() {
isAnimating = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
finishedTutorial = true
isFinished = true
})
}
}
@@ -83,6 +83,7 @@ struct OnBoardingCardView: View {
var info: OnBoardingPage
var pageCount: Int
@Binding var idx: Int
@Binding var isFinished: Bool
@State private var isAnimating: Bool = false
@State private var imgCornerRadius: CGFloat = 10.0
@@ -130,7 +131,7 @@ struct OnBoardingCardView: View {
.accentColor(Color.white)
}
OnBoardingCardButtons(idx: $idx, isAnimating: $isAnimating, showDismiss: idx == 0, showFinish: idx == pageCount-1)
OnBoardingCardButtons(isFinished: $isFinished, idx: $idx, isAnimating: $isAnimating, showDismiss: idx == 0, showFinish: idx == pageCount-1)
}
.opacity(isAnimating ? 1.0 : 0.0)
.animation(.easeOut(duration: 0.5), value: isAnimating)
@@ -55,3 +55,26 @@ let onBoardingCards: [OnBoardingPage] = [
linkName: "Find Wallpapers"
)
]
let resetCollectionsInfo: [OnBoardingPage] = [
.init(
title: "How to Reset Collections",
description: "Due to the way this exploit works, it cannot delete files.\n\nHere is a guide on how to do it manually.",
image: "CustomCollection"
),
.init(
title: "Open the Language Settings",
description: "Inside the Settings app, navigate to General > Language & Region",
image: "Language"
),
.init(
title: "Set the Primary Language",
description: "It doesn't matter what you set it to.\n\nAfterwards set it back to your native language.",
image: "SetPrimary"
),
.init(
title: "Verify That It Worked",
description: "Everything on PosterBoard should refresh. Check the Collections to see if they reset.",
image: "OriginalCollection"
)
]
@@ -8,11 +8,14 @@
import SwiftUI
struct OnBoardingView: View {
let cards: [OnBoardingPage]
@Binding var isFinished: Bool
@State var currentIndex: Int = 0
var body: some View {
VStack {
OnBoardingCardView(info: onBoardingCards[currentIndex], pageCount: onBoardingCards.count, idx: $currentIndex)
OnBoardingCardView(info: cards[currentIndex], pageCount: cards.count, idx: $currentIndex, isFinished: $isFinished)
}
}
}