Rework path storage, add start screen
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user