Fixed all SwiftUI Alert warnings
This commit is contained in:
@@ -38,6 +38,7 @@ struct ModalAddConsoleToLibrary : View {
|
||||
.disabled(self.modalConsoleName.trimmingCharacters(in: .whitespacesAndNewlines) == "" )
|
||||
}
|
||||
|
||||
@State var showWrongFolderAlert : Bool = false
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
Form {
|
||||
@@ -75,13 +76,20 @@ struct ModalAddConsoleToLibrary : View {
|
||||
|
||||
print("Selected Image in iCloud Path \(self.modalConsoleLogoICloudPath ?? "n/a")")
|
||||
}else{
|
||||
Alert(title: Text("Falscher Ordner"))
|
||||
self.showWrongFolderAlert = true
|
||||
print("Außerhalb \(selectedFile.relativeString)")
|
||||
}
|
||||
}catch{
|
||||
print("ConsoleAllView::ModalAddConsoleToLibrary Error getting result '\(result)'")
|
||||
}
|
||||
}
|
||||
.alert(isPresented: $showWrongFolderAlert) {
|
||||
Alert(
|
||||
title: Text("Falscher Ordner"),
|
||||
message: Text("Bitte nutze nur Dateien aus dem Zockerhöhle iCloud Ordner"),
|
||||
dismissButton: .default(Text("Alles klar!"))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ struct ConsoleEditView: View {
|
||||
set: { self.console.manufacturer = $0 })
|
||||
}
|
||||
|
||||
@State var showWrongFolderAlert : Bool = false
|
||||
|
||||
@State var isImportingLogo : Bool = false
|
||||
let defaultImage = UIImage()
|
||||
|
||||
@@ -56,12 +58,15 @@ struct ConsoleEditView: View {
|
||||
|
||||
print("Selected Image in iCloud Path \(console.logo_icloud_path ?? "n/a")")
|
||||
}else{
|
||||
Alert(title: Text("Falscher Ordner"))
|
||||
self.showWrongFolderAlert = true
|
||||
print("Außerhalb \(selectedFile.relativeString)")
|
||||
}
|
||||
}catch{
|
||||
print("ConsoleAllView::ModalAddConsoleToLibrary Error getting result '\(result)'")
|
||||
}
|
||||
}
|
||||
.alert(isPresented: $showWrongFolderAlert) {
|
||||
Alert(title: Text("Nur Dateien aus dem Zockerhöhle iCloud Drive Ordner sind erlaubt."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ struct GameDetailView : View {
|
||||
set: { self.game.lentTo = $0 })
|
||||
}
|
||||
|
||||
@State var showWrongFolderAlert : Bool = false
|
||||
var GameIsFinished : some View {
|
||||
Group {
|
||||
Toggle(isOn: $game.isFinished , label: {
|
||||
@@ -235,16 +236,19 @@ struct GameDetailView : View {
|
||||
|
||||
print("Selected Image in iCloud Path \(game.cover_icloud_path ?? "n/a")")
|
||||
}else{
|
||||
self.showWrongFolderAlert = true
|
||||
}
|
||||
}catch{
|
||||
print("ConsoleAllView::ModalAddConsoleToLibrary Error getting result '\(result)'")
|
||||
}
|
||||
}
|
||||
.alert(isPresented: $showWrongFolderAlert) {
|
||||
Alert(
|
||||
title: Text("Falscher Ordner"),
|
||||
message: Text("Bitte nutze nur Dateien aus dem Zockerhöhle iCloud Ordner"),
|
||||
dismissButton: .default(Text("Alles klar!"))
|
||||
)
|
||||
}
|
||||
}catch{
|
||||
print("ConsoleAllView::ModalAddConsoleToLibrary Error getting result '\(result)'")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Irgendwie gibt es einen Bug der den Alert im navigationBarItem zwei mal aufruft.
|
||||
|
||||
@@ -18,6 +18,8 @@ struct ModalAddGameSeries : View {
|
||||
|
||||
@State var isImportingCover = false
|
||||
|
||||
@State var showWrongFolderAlert : Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
Form {
|
||||
@@ -52,13 +54,20 @@ struct ModalAddGameSeries : View {
|
||||
|
||||
print("Selected Image in iCloud Path \(self.modalGameSeriesCover ?? "n/a")")
|
||||
}else{
|
||||
Alert(title: Text("Falscher Ordner"))
|
||||
self.showWrongFolderAlert = true
|
||||
print("Außerhalb \(selectedFile.relativeString)")
|
||||
}
|
||||
}catch{
|
||||
print("GameSeriesEditView::body Error getting result '\(result)'")
|
||||
}
|
||||
}
|
||||
.alert(isPresented: $showWrongFolderAlert) {
|
||||
Alert(
|
||||
title: Text("Falscher Ordner"),
|
||||
message: Text("Bitte nutze nur Dateien aus dem Zockerhöhle iCloud Ordner"),
|
||||
dismissButton: .default(Text("Alles klar!"))
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ struct GameSeriesEditView: View {
|
||||
set: { self.gameSeries.name = $0 })
|
||||
}
|
||||
|
||||
@State var showWrongFolderAlert : Bool = false
|
||||
@State var isImportingLogo : Bool = false
|
||||
|
||||
var body: some View {
|
||||
@@ -47,12 +48,15 @@ struct GameSeriesEditView: View {
|
||||
|
||||
print("Selected Image in iCloud Path \(gameSeries.cover_icloud_path ?? "n/a")")
|
||||
}else{
|
||||
Alert(title: Text("Falscher Ordner"))
|
||||
self.showWrongFolderAlert = true
|
||||
print("Außerhalb \(selectedFile.relativeString)")
|
||||
}
|
||||
}catch{
|
||||
print("GameSeriesEditView::body Error getting result '\(result)'")
|
||||
}
|
||||
}
|
||||
.alert(isPresented: $showWrongFolderAlert) {
|
||||
Alert(title: Text("Nur Dateien aus dem Zockerhöhle iCloud Drive Ordner sind erlaubt."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user