Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,22 @@ extension ComposeViewController {
mutableString.append(styledQuote)
}

if let signature = getSignature(), !mutableString.string.replacingOccurrences(of: "\r", with: "").contains(signature) {
mutableString.append(signature.attributed(.regular(17)))
if let signatureRaw = getSignature() {
func normalize(_ s: String) -> String {
return s
.replacingOccurrences(of: "\r\n", with: "\n")
.replacingOccurrences(of: "\r", with: "\n")
// fix html signature duplicate issue
// https://github.com/FlowCrypt/flowcrypt-ios/pull/2684#discussion_r2318361291
.replacingOccurrences(of: "\u{00A0}", with: " ")
.trimmingCharacters(in: .whitespacesAndNewlines)
}
let body = normalize(mutableString.string)
let signature = normalize(signatureRaw)
let alreadyHasSig = body.contains(signature)
if !alreadyHasSig {
mutableString.append(signatureRaw.attributed(.regular(17)))
}
}

let height = max(decorator.frame(for: mutableString).height, 40)
Expand Down