From 943b67714ff2a0ac9dc32c92a27f384dc11b3d83 Mon Sep 17 00:00:00 2001 From: Valentin Perignon Date: Wed, 21 Jun 2023 11:29:14 +0200 Subject: [PATCH] fix: Insert signature after mailto body --- .../Views/New Message/ComposeMessageBodyView.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Mail/Views/New Message/ComposeMessageBodyView.swift b/Mail/Views/New Message/ComposeMessageBodyView.swift index 11f95de77..eb356ab60 100644 --- a/Mail/Views/New Message/ComposeMessageBodyView.swift +++ b/Mail/Views/New Message/ComposeMessageBodyView.swift @@ -132,12 +132,16 @@ struct ComposeMessageBodyView: View { } let html = "

\(signature.content)
" - switch signature.position { - case .beforeReplyMessage: - $draft.body.wrappedValue.insert(contentsOf: html, at: draft.body.startIndex) - case .afterReplyMessage: - $draft.body.wrappedValue.append(contentsOf: html) + var signaturePosition = draft.body.endIndex + if messageReply != nil { + switch signature.position { + case .beforeReplyMessage: + signaturePosition = draft.body.startIndex + case .afterReplyMessage: + signaturePosition = draft.body.endIndex + } } + $draft.body.wrappedValue.insert(contentsOf: html, at: signaturePosition) } }