Skip to content

Commit b6bd50a

Browse files
committed
refactor(send): keep scanner alert title behavior unchanged
1 parent 1e7aa44 commit b6bd50a

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

BDKSwiftExampleWallet/View/Send/AddressView.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ struct AddressView: View {
1414
@Binding var navigationPath: NavigationPath
1515
@State var address: String = ""
1616
@State private var isShowingAlert = false
17-
@State private var alertTitle = "Error"
1817
@State private var alertMessage = ""
1918
@State private var isSweeping = false
2019
private let bdkClient: BDKClient = .live
@@ -33,7 +32,7 @@ struct AddressView: View {
3332
)
3433
.alert(isPresented: $isShowingAlert) {
3534
Alert(
36-
title: Text(alertTitle),
35+
title: Text("Error"),
3736
message: Text(alertMessage),
3837
dismissButton: .default(Text("OK"))
3938
)
@@ -65,12 +64,10 @@ extension AddressView {
6564
address = bitcoinAddress
6665
navigationPath.append(NavigationDestination.amount(address: bitcoinAddress))
6766
} else {
68-
alertTitle = "Error"
6967
alertMessage = "The scanned QR code did not contain a valid Bitcoin address."
7068
isShowingAlert = true
7169
}
7270
case .failure(let error):
73-
alertTitle = "Error"
7471
alertMessage = "Scanning failed: \(error.localizedDescription)"
7572
isShowingAlert = true
7673
}
@@ -79,14 +76,12 @@ extension AddressView {
7976
private func pasteAddress() {
8077
if let pasteboardContent = UIPasteboard.general.string {
8178
if pasteboardContent.isEmpty {
82-
alertTitle = "Error"
8379
alertMessage = "The pasteboard is empty."
8480
isShowingAlert = true
8581
return
8682
}
8783
let trimmedContent = pasteboardContent.trimmingCharacters(in: .whitespacesAndNewlines)
8884
if trimmedContent.isEmpty {
89-
alertTitle = "Error"
9085
alertMessage = "The pasteboard contains only whitespace."
9186
isShowingAlert = true
9287
return
@@ -101,7 +96,6 @@ extension AddressView {
10196
address = lowercaseAddress
10297
navigationPath.append(NavigationDestination.amount(address: address))
10398
} else {
104-
alertTitle = "Error"
10599
alertMessage = "Unable to access the pasteboard. Please try copying the address again."
106100
isShowingAlert = true
107101
}
@@ -123,7 +117,6 @@ extension AddressView {
123117
let txidText = txids.map { "\($0)" }.joined(separator: ", ")
124118

125119
await MainActor.run {
126-
alertTitle = "Success"
127120
alertMessage = "Sweep broadcasted: \(txidText)"
128121
isShowingAlert = true
129122
NotificationCenter.default.post(
@@ -133,7 +126,6 @@ extension AddressView {
133126
}
134127
} catch {
135128
await MainActor.run {
136-
alertTitle = "Error"
137129
alertMessage = "Sweep failed: \(error.localizedDescription)"
138130
isShowingAlert = true
139131
}

0 commit comments

Comments
 (0)