improve main content ui
This commit is contained in:
1 parent
dcd368817d
commit
23966fcf80
1 file changed
+49
-49
@@ -30,13 +30,11 @@ struct ContentView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
ScrollView {
|
List {
|
||||||
HStack {
|
Section {} header: {
|
||||||
Label("Version \(Bundle.main.releaseVersionNumber ?? "UNKNOWN") (\(Int(buildNumber) != 0 ? "Beta \(buildNumber)" : NSLocalizedString("Release", comment:"")))", systemImage: "info.circle.fill")
|
Label("Version \(Bundle.main.releaseVersionNumber ?? "UNKNOWN") (\(Int(buildNumber) != 0 ? "Beta \(buildNumber)" : NSLocalizedString("Release", comment:"")))", systemImage: "info.circle.fill")
|
||||||
Spacer()
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.font(.caption)
|
|
||||||
.padding(.bottom, 10)
|
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
@@ -46,21 +44,18 @@ struct ContentView: View {
|
|||||||
Text("Select Tendies")
|
Text("Select Tendies")
|
||||||
}
|
}
|
||||||
.buttonStyle(TintedButton(color: .green, fullwidth: true))
|
.buttonStyle(TintedButton(color: .green, fullwidth: true))
|
||||||
.padding(.vertical, 10)
|
}
|
||||||
|
.listRowInsets(EdgeInsets())
|
||||||
if !selectedTendies.wrappedValue.isEmpty {
|
.padding(7)
|
||||||
HStack {
|
|
||||||
Text("Selected Tendies")
|
if !selectedTendies.wrappedValue.isEmpty {
|
||||||
.font(.headline)
|
Section {
|
||||||
Spacer()
|
ForEach(selectedTendies.wrappedValue, id: \.self) { tendie in
|
||||||
|
Text(tendie.deletingPathExtension().lastPathComponent)
|
||||||
}
|
}
|
||||||
List {
|
.onDelete(perform: delete)
|
||||||
ForEach(selectedTendies.wrappedValue, id: \.self) { tendie in
|
} header: {
|
||||||
Text(tendie.deletingPathExtension().lastPathComponent)
|
Label("Selected Tendies", systemImage: "document")
|
||||||
}
|
|
||||||
.onDelete(perform: delete)
|
|
||||||
}
|
|
||||||
.frame(height: CGFloat((selectedTendies.wrappedValue.count * 65) + (selectedTendies.wrappedValue.count < 3 ? 100 : 0)), alignment: .top)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,42 +63,47 @@ struct ContentView: View {
|
|||||||
if pbHash == "" {
|
if pbHash == "" {
|
||||||
Text("Enter your PosterBoard app hash in Settings.")
|
Text("Enter your PosterBoard app hash in Settings.")
|
||||||
} else {
|
} else {
|
||||||
if !selectedTendies.wrappedValue.isEmpty {
|
VStack {
|
||||||
Button(action: {
|
if !selectedTendies.wrappedValue.isEmpty {
|
||||||
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
|
Button(action: {
|
||||||
// UIApplication.shared.alert(title: NSLocalizedString("Applying Tendies...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
|
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
|
||||||
|
// 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 {
|
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||||
try PosterBoardManager.applyTendies(selectedTendies.wrappedValue, appHash: pbHash)
|
do {
|
||||||
selectedTendies.wrappedValue.removeAll()
|
try PosterBoardManager.applyTendies(selectedTendies.wrappedValue, appHash: pbHash)
|
||||||
try? FileManager.default.removeItem(at: PosterBoardManager.getTendiesStoreURL())
|
selectedTendies.wrappedValue.removeAll()
|
||||||
Haptic.shared.notify(.success)
|
try? FileManager.default.removeItem(at: PosterBoardManager.getTendiesStoreURL())
|
||||||
// UIApplication.shared.dismissAlert(animated: true)
|
Haptic.shared.notify(.success)
|
||||||
lastError = "The PosterBoard app will now open. Please close it from the app switcher."
|
// UIApplication.shared.dismissAlert(animated: true)
|
||||||
showSuccessAlert.toggle()
|
lastError = "The PosterBoard app will now open. Please close it from the app switcher."
|
||||||
} catch {
|
showSuccessAlert.toggle()
|
||||||
Haptic.shared.notify(.error)
|
} catch {
|
||||||
// UIApplication.shared.dismissAlert(animated: true)
|
Haptic.shared.notify(.error)
|
||||||
lastError = error.localizedDescription
|
// UIApplication.shared.dismissAlert(animated: true)
|
||||||
showErrorAlert.toggle()
|
lastError = error.localizedDescription
|
||||||
|
showErrorAlert.toggle()
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}) {
|
||||||
|
Text("Apply")
|
||||||
}
|
}
|
||||||
// }
|
.buttonStyle(TintedButton(color: .blue, fullwidth: true))
|
||||||
}) {
|
|
||||||
Text("Apply")
|
|
||||||
}
|
}
|
||||||
.buttonStyle(TintedButton(color: .blue, fullwidth: true))
|
Button(action: {
|
||||||
|
hideResetHelp = false
|
||||||
|
}) {
|
||||||
|
Text("Reset Collections")
|
||||||
|
}
|
||||||
|
.buttonStyle(TintedButton(color: .red, fullwidth: true))
|
||||||
}
|
}
|
||||||
Button(action: {
|
.listRowInsets(EdgeInsets())
|
||||||
hideResetHelp = false
|
.padding(7)
|
||||||
}) {
|
|
||||||
Text("Reset Collections")
|
|
||||||
}
|
|
||||||
.buttonStyle(TintedButton(color: .red, fullwidth: true))
|
|
||||||
}
|
}
|
||||||
|
} header: {
|
||||||
|
Label("Actions", systemImage: "hammer")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding()
|
|
||||||
.navigationTitle("Pocket Poster")
|
.navigationTitle("Pocket Poster")
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .topBarLeading) {
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
|
|||||||
Reference in new issue
Block a user