diff options
| author | Christian Cleberg <[email protected]> | 2026-03-18 20:23:58 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-03-18 20:23:58 -0500 |
| commit | c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9 (patch) | |
| tree | 28bf13b89e36774720d015a26a8979b567ad0be9 /Hutch/Views/Settings | |
| parent | 1745311950fd68ad81957b3ba64f8566cd86ce19 (diff) | |
| parent | 4dd920558a1c7174c0e9a5b872325df36e363516 (diff) | |
| download | hutch-c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9.tar.gz hutch-c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9.tar.bz2 hutch-c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9.zip | |
v1.2: Merge branch 'dev'
Diffstat (limited to 'Hutch/Views/Settings')
| -rw-r--r-- | Hutch/Views/Settings/SettingsView.swift | 35 | ||||
| -rw-r--r-- | Hutch/Views/Settings/SettingsViewModel.swift | 4 |
2 files changed, 29 insertions, 10 deletions
diff --git a/Hutch/Views/Settings/SettingsView.swift b/Hutch/Views/Settings/SettingsView.swift index 5bbded8..9b7d41f 100644 --- a/Hutch/Views/Settings/SettingsView.swift +++ b/Hutch/Views/Settings/SettingsView.swift @@ -1,6 +1,10 @@ import PhotosUI import SwiftUI +private let settingsBioMarkdownOptions = AttributedString.MarkdownParsingOptions( + interpretedSyntax: .inlineOnlyPreservingWhitespace +) + struct SettingsView: View { @Environment(AppState.self) private var appState @Environment(\.colorScheme) private var colorScheme @@ -163,13 +167,7 @@ struct SettingsView: View { Text("Bio") .font(.caption) .foregroundStyle(.secondary) - RenderedMarkupContentView( - content: .markdown(bio), - readmePath: nil, - colorScheme: colorScheme, - ownerCanonicalName: "", - repositoryName: "" - ) + SettingsBioView(markdown: bio) } } @@ -424,6 +422,27 @@ struct SettingsView: View { } } +private struct SettingsBioView: View { + let markdown: String + + var body: some View { + Text(settingsBioAttributedString(markdown)) + .frame(maxWidth: .infinity, alignment: .leading) + .tint(.accentColor) + .textSelection(.enabled) + } +} + +func settingsBioAttributedString(_ markdown: String) -> AttributedString { + guard let attributed = try? AttributedString( + markdown: markdown, + options: settingsBioMarkdownOptions + ) else { + return AttributedString(markdown) + } + return attributed +} + // MARK: - Edit Profile Sheet private struct EditProfileSheet: View { @@ -695,7 +714,7 @@ private struct AboutView: View { Link(destination: URL(string: "https://man.sr.ht")!) { SwiftUI.Label("SourceHut Manuals", systemImage: "book") } - Link(destination: URL(string: "https://git.sr.ht/~ccleberg/Hutch")!) { + Link(destination: URL(string: "https://sr.ht/~ccleberg/Hutch")!) { SwiftUI.Label("Project Repository", systemImage: "folder") } } diff --git a/Hutch/Views/Settings/SettingsViewModel.swift b/Hutch/Views/Settings/SettingsViewModel.swift index 204afbf..1cc5426 100644 --- a/Hutch/Views/Settings/SettingsViewModel.swift +++ b/Hutch/Views/Settings/SettingsViewModel.swift @@ -24,7 +24,7 @@ private struct CreateSSHKeyResponse: Decodable, Sendable { } private struct DeleteSSHKeyResponse: Decodable, Sendable { - let deleteSSHKey: DeleteResult + let deleteSSHKey: DeleteResult? } private struct CreatePGPKeyResponse: Decodable, Sendable { @@ -32,7 +32,7 @@ private struct CreatePGPKeyResponse: Decodable, Sendable { } private struct DeletePGPKeyResponse: Decodable, Sendable { - let deletePGPKey: DeleteResult + let deletePGPKey: DeleteResult? } private struct DeleteResult: Decodable, Sendable { |
