Rework path storage, add start screen

This commit is contained in:
Christoph Hagen
2024-12-17 23:05:45 +01:00
parent 849585acc7
commit 9a53e020a7
21 changed files with 408 additions and 229 deletions

View File

@ -162,18 +162,15 @@ struct MainView: App {
}.pickerStyle(.segmented)
}
ToolbarItem(placement: .primaryAction) {
if content.storageIsInitialized {
if content.storage.hasContentFolders {
Button(action: save) {
Text("Save")
}
} else {
Button {
selectedSection = .folders
selectedTab = .generation
} label: {
Button(action: showInitialSheet) {
Text("Setup")
}
.foregroundColor(.red)
.background(RoundedRectangle(cornerRadius: 8).fill(Color.red))
}
}
}
@ -206,10 +203,10 @@ struct MainView: App {
}
private func loadContent() {
guard content.storageIsInitialized else {
DispatchQueue.main.async {
self.showInitialSetupSheet = true
}
#warning("Remove")
content.storage.clearContentPath()
guard content.storage.hasContentFolders else {
showInitialSheet()
return
}
do {
@ -218,5 +215,13 @@ struct MainView: App {
print("Failed to load content: \(error.localizedDescription)")
}
}
private func showInitialSheet() {
DispatchQueue.main.async {
selectedSection = .folders
selectedTab = .generation
showInitialSetupSheet = true
}
}
}