use uikit alerts

This commit is contained in:
Evgeny @ SimpleX Chat
2026-06-30 22:18:13 +00:00
parent e69ccc060c
commit ef37d2c9d2
2 changed files with 2 additions and 14 deletions
@@ -1389,8 +1389,6 @@ struct SimplexNameView: View {
@EnvironmentObject var theme: AppTheme
@State private var inFlight = false
@State private var showSpinner = false
@State private var showAlert = false
@State private var alertMessage = ""
var body: some View {
HStack(spacing: 6) {
@@ -1401,9 +1399,6 @@ struct SimplexNameView: View {
}
.padding(.bottom, 2)
.onAppear { if autoVerify && verification == nil { runVerify(manual: false) } }
.alert(isPresented: $showAlert) {
Alert(title: Text("SimpleX name not verified"), message: Text(alertMessage))
}
}
@ViewBuilder private func indicator() -> some View {
@@ -1437,8 +1432,7 @@ struct SimplexNameView: View {
showSpinner = false
// show the reason on a manual run, or on an inconclusive auto run (state stayed nil)
if let (newV, reason) = res, let reason, manual || newV == nil {
alertMessage = reason
showAlert = true
showAlert(NSLocalizedString("SimpleX name not verified", comment: "alert title"), message: reason)
}
}
}
@@ -722,8 +722,6 @@ struct SetSimplexNameView: View {
@Environment(\.dismiss) var dismiss
@EnvironmentObject var theme: AppTheme
@State private var saving = false
@State private var showAlert = false
@State private var alertMessage = ""
var body: some View {
List {
@@ -744,8 +742,7 @@ struct SetSimplexNameView: View {
await MainActor.run {
saving = false
if let err {
alertMessage = err
showAlert = true
showAlert(NSLocalizedString("Error saving name", comment: "alert title"), message: err)
} else {
dismiss()
}
@@ -759,9 +756,6 @@ struct SetSimplexNameView: View {
}
.navigationTitle(titleKey)
.navigationBarTitleDisplayMode(.large)
.alert(isPresented: $showAlert) {
Alert(title: Text("Error saving name"), message: Text(alertMessage))
}
}
// ensure the correct type prefix so a contact name is not parsed as a group (or vice versa)