Skip to content
Open
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
17 changes: 16 additions & 1 deletion Shared/Views/UserSignInView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ struct UserSignInView: View {
return evaluatedPolicy
}

private func disclaimerText(_ disclaimer: String) -> Text {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some cleanup that can happen, or inline this if let to the section.

@ViewBuilder
private func disclaimerText(_ disclaimer: String) -> some View {
    if let attributedString = try? AttributedString(
        markdown: disclaimer,
        options: .init(interpretedSyntax: .inlineOnlyPreservingWhitespace)
    ) {
        Text(attributedString)
    } else {
        Text(disclaimer)
    }
}

let options = AttributedString.MarkdownParsingOptions(
interpretedSyntax: .inlineOnlyPreservingWhitespace
)

if let attributedString = try? AttributedString(
markdown: disclaimer,
options: options
) {
return Text(attributedString)
} else {
return Text(disclaimer)
}
}

// MARK: - Sign In Section

@ViewBuilder
Expand Down Expand Up @@ -184,7 +199,7 @@ struct UserSignInView: View {

if let disclaimer = viewModel.serverDisclaimer {
Section(L10n.disclaimer) {
Text(disclaimer)
disclaimerText(disclaimer)
.font(.callout)
}
}
Expand Down
Loading