Skip to content

Commit 98cf019

Browse files
committed
Доработал FeedbackSender
1 parent 7a855a6 commit 98cf019

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

SwiftUI-WorkoutApp/Libraries/SWUtils/Sources/SWUtils/FeedbackSender.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ public enum FeedbackSender {
1212
messageBody: String,
1313
recipients: [String]
1414
) {
15+
guard !recipients.isEmpty else {
16+
assertionFailure("Не указан список получателей письма")
17+
return
18+
}
1519
let encodedSubject = subject.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "Feedback"
1620
let encodedBody = messageBody.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
17-
if let firstRecipient = recipients.first {
18-
let url = URL(string: "mailto:\(firstRecipient)?subject=\(encodedSubject)&body=\(encodedBody)")
19-
URLOpener.open(url)
20-
}
21+
let encodedRecipients = recipients
22+
.map { $0.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? $0 }
23+
.joined(separator: ",")
24+
let url = URL(string: "mailto:\(encodedRecipients)?subject=\(encodedSubject)&body=\(encodedBody)")
25+
URLOpener.open(url)
2126
}
2227
}

0 commit comments

Comments
 (0)