mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 02:42:54 +00:00
Replace several copies of the same alert code with a new errorAlert.
This commit is contained in:
1 parent
c4998f7acf
commit
f54546525f
5 files changed
+34
-68
No files matched your search
@@ -78,13 +78,7 @@ struct AddFolderView: View {
|
||||
}
|
||||
}
|
||||
.interactiveDismissDisabled(isAdding)
|
||||
.alert(NSLocalizedString("Error", comment: "Error"), isPresented: isShowingError) {
|
||||
Button(NSLocalizedString("OK", comment: "OK button")) {
|
||||
errorMessage = nil
|
||||
}
|
||||
} message: {
|
||||
Text(verbatim: errorMessage ?? "")
|
||||
}
|
||||
.errorAlert(message: $errorMessage)
|
||||
.onAppear {
|
||||
isNameFieldFocused = true
|
||||
}
|
||||
@@ -103,16 +97,6 @@ struct AddFolderView: View {
|
||||
!trimmedName.isEmpty && selectedAccount != nil
|
||||
}
|
||||
|
||||
private var isShowingError: Binding<Bool> {
|
||||
Binding {
|
||||
errorMessage != nil
|
||||
} set: { isShowing in
|
||||
if !isShowing {
|
||||
errorMessage = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func addFolder() async {
|
||||
guard let selectedAccount else {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user