1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
import SwiftUI
enum AboutLinks {
static let repository = URL(string: "https://knotless.dev/geesawra.industries/old-fella")!
static let appLicense = URL(string: "https://knotless.dev/geesawra.industries/old-fella/blob/main/LICENSE")!
static let atProtoKitLicense = URL(string: "https://github.com/MasterJ93/ATProtoKit/blob/0.34.1/LICENSE.md")!
static let emojiKitLicense = URL(string: "https://github.com/danielsaidi/EmojiKit/blob/3.1.0/LICENSE")!
static let swiftLogLicense = URL(string: "https://github.com/apple/swift-log/blob/1.16.2/LICENSE.txt")!
static let swiftLogNotice = URL(string: "https://github.com/apple/swift-log/blob/1.16.2/NOTICE.txt")!
}
#if DEBUG
#Preview("Open source licenses") {
NavigationStack { OpenSourceLicensesView() }
}
#endif
struct OpenSourceLicensesView: View {
var body: some View {
List {
Section("Old Fella") {
Link("MIT License", destination: AboutLinks.appLicense)
Text("Copyright (c) 2026 Old Fella contributors")
}
Section("ATProtoKit") {
Link("MIT License", destination: AboutLinks.atProtoKitLicense)
Text("Copyright (c) 2026 Christopher Jr Riley")
}
Section("Atkinson Hyperlegible Next") {
Text("Copyright 2020-2024 The Atkinson Hyperlegible Next Project Authors")
Link(
"SIL Open Font License 1.1",
destination: URL(
string: "https://github.com/googlefonts/atkinson-hyperlegible-next/blob/main/OFL.txt")!)
}
Section("EmojiKit") {
Link("MIT License", destination: AboutLinks.emojiKitLicense)
Text("Copyright (c) 2023-2026 Daniel Saidi")
}
Section("Iosevka") {
Text("Copyright (c) 2015-2026 Renzhi Li")
Link(
"SIL Open Font License 1.1",
destination: URL(string: "https://github.com/be5invis/Iosevka/blob/v34.9.1/LICENSE.md")!)
}
Section("Paper Mono") {
Text("Copyright 2025 The Paper-Mono.Git Project Authors")
Link(
"SIL Open Font License 1.1",
destination: URL(string: "https://github.com/paper-design/paper-mono/blob/main/OFL.txt")!)
}
Section("swift-log") {
Link("Apache License 2.0", destination: AboutLinks.swiftLogLicense)
Link("Notice", destination: AboutLinks.swiftLogNotice)
Text("Copyright 2018, 2019 The SwiftLog Project")
}
}
.appNavigationTitle("Open Source Licenses")
}
}
#if DEBUG
#Preview("Settings") {
PreviewHost { _ in SettingsView() }
}
#endif
struct SettingsView: View {
@AppStorage("appFont") private var appFont = AppFont.system.rawValue
@AppStorage("hideAvatars") private var hideAvatars = false
@AppStorage("handlesOnly") private var handlesOnly = false
@Environment(AppModel.self) private var model
@Environment(\.dismiss) private var dismiss
@State private var confirmsSignOut = false
@State private var showsFonts = false
@State private var showsProfileEditor = false
@AppStorage("openLinksInApp") private var openLinksInApp = true
@AppStorage("hideQuotedPosts") private var hideQuotedPosts = false
@AppStorage("hideReplyContexts") private var hideReplyContexts = false
@AppStorage("hidePictures") private var hidePictures = false
@AppStorage("showGIFsInline") private var showGIFsInline = true
@AppStorage("remindMissingAltText") private var remindMissingAltText = true
@AppStorage("padVisibleColumnCount") private var padVisibleColumnCount = 2
var showsDoneButton = false
var body: some View {
@Bindable var model = model
NavigationStack {
List {
if let account = model.account {
Section { accountRow(account) }
}
Section {
Toggle("Show avatars", isOn: $hideAvatars.negated)
.accessibilityIdentifier("showAvatars")
Toggle("Show display names", isOn: $handlesOnly.negated)
.accessibilityIdentifier("showDisplayNames")
Toggle("Show pictures", isOn: $hidePictures.negated)
.accessibilityIdentifier("showPictures")
Toggle("Show GIFs inline", isOn: $showGIFsInline)
.accessibilityIdentifier("showGIFsInline")
Toggle("Show quoted posts", isOn: $hideQuotedPosts.negated)
.accessibilityIdentifier("showQuotedPosts")
Toggle("Show reply context", isOn: $hideReplyContexts.negated)
.accessibilityIdentifier("showReplyContexts")
Toggle("Filter replies by following", isOn: $model.induceADHD.negated)
.accessibilityIdentifier("filterReplies")
} header: {
Text("Distractions")
} footer: {
Text(
"Hidden pictures open in the image viewer. Hidden GIFs have a button to play them. "
+ "Turn off reply filtering to show replies regardless of who you follow."
)
.appFont(.footnote)
.accessibilityIdentifier("distractionsDescription")
}
Section("Appearance") {
Button {
showsFonts = true
} label: {
HStack {
Text("Font").foregroundStyle(.primary)
Spacer()
Text((AppFont(rawValue: appFont) ?? .system).title)
.font((AppFont(rawValue: appFont) ?? .system).font(.body))
Image(systemName: "chevron.up.chevron.down")
.font(.caption.weight(.semibold))
}
.appFont(.body)
}
.accessibilityLabel("Font")
.accessibilityValue((AppFont(rawValue: appFont) ?? .system).title)
.accessibilityIdentifier("appFont")
}
Section("Posts") {
Toggle("Remind me to add alt text", isOn: $remindMissingAltText)
.accessibilityIdentifier("remindMissingAltText")
}
if UIDevice.current.userInterfaceIdiom == .pad {
Section("Layout") {
Picker("Columns", selection: $padVisibleColumnCount) {
Text("2").tag(2)
Text("3").tag(3)
Text("4").tag(4)
}
.pickerStyle(.segmented)
.accessibilityIdentifier("padVisibleColumnCount")
}
}
Section("Links") {
Toggle("Open links in Old Fella", isOn: $openLinksInApp)
.accessibilityIdentifier("openLinksInApp")
}
Section("About") {
NavigationLink("Open Source Licenses") {
OpenSourceLicensesView()
}
.accessibilityIdentifier("openSourceLicenses")
Link("Source Repository", destination: AboutLinks.repository)
.accessibilityIdentifier("sourceRepository")
}
if model.account != nil {
Section {
Button("Sign out", systemImage: "rectangle.portrait.and.arrow.right", role: .destructive) {
confirmsSignOut = true
}
.accessibilityIdentifier("settingsSignOutButton")
}
}
buildDetails
}
.sheet(isPresented: $showsFonts) {
NavigationStack {
List(AppFont.allCases) { font in
Button {
appFont = font.rawValue
showsFonts = false
} label: {
HStack {
Text(font.title).font(font.font(.body))
Spacer()
if font.rawValue == appFont {
Image(systemName: "checkmark")
}
}
.foregroundStyle(.primary)
}
.accessibilityAddTraits(font.rawValue == appFont ? .isSelected : [])
}
.appNavigationTitle("Font")
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Done") { showsFonts = false }
}
}
}
}
.sheet(isPresented: $showsProfileEditor) {
ProfileEditorView()
}
.appNavigationTitle("Settings")
.toolbar {
if showsDoneButton {
ToolbarItem(placement: .confirmationAction) {
Button("Done") { dismiss() }
.accessibilityIdentifier("settingsDoneButton")
}
}
}
.confirmationDialog("Sign out of Bluesky?", isPresented: $confirmsSignOut, titleVisibility: .visible) {
Button("Sign out", role: .destructive) { Task { await model.signOut() } }
.accessibilityIdentifier("settingsConfirmSignOutButton")
Button("Cancel", role: .cancel) {}
} message: {
Text("You can sign in again at any time.")
}
}
}
private var buildDetails: some View {
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
let fullCommit = Bundle.main.object(forInfoDictionaryKey: "OldFellaGitCommit") as? String ?? ""
let commit = fullCommit.isEmpty ? nil : String(fullCommit.prefix(7))
return Section {
buildDetail("Version", value: version, identifier: "settingsVersion")
buildDetail("Git commit", value: commit, identifier: "settingsGitCommit")
}
}
private func buildDetail(_ label: LocalizedStringKey, value: String?, identifier: String) -> some View {
let value = value ?? String(localized: "Unknown")
return LabeledContent(label, value: value)
.accessibilityElement(children: .ignore)
.accessibilityLabel(Text(label))
.accessibilityValue(Text(verbatim: value))
.accessibilityIdentifier(identifier)
}
private func accountRow(_ account: Account) -> some View {
let showsDisplayName = !handlesOnly && account.displayName.caseInsensitiveCompare(account.handle) != .orderedSame
let handle = "@\(account.handle)"
return Button {
showsProfileEditor = true
} label: {
HStack(spacing: 12) {
AccountAvatar(account: account, size: 48)
VStack(alignment: .leading, spacing: 3) {
if showsDisplayName {
Text(account.displayName).appFont(.headline)
}
Text(handle)
.appFont(showsDisplayName ? .subheadline : .headline)
.foregroundStyle(showsDisplayName ? .secondary : .primary)
}
Spacer(minLength: 8)
Image(systemName: "chevron.right")
.font(.footnote.weight(.semibold))
.foregroundStyle(.secondary)
.accessibilityHidden(true)
}
.padding(.vertical, 6)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.accessibilityLabel(showsDisplayName ? "\(account.displayName), \(handle)" : handle)
.accessibilityHint("Opens the profile editor")
.accessibilityIdentifier("settingsEditProfile")
}
}
extension Binding where Value == Bool {
fileprivate var negated: Binding<Bool> {
Binding(get: { !wrappedValue }, set: { wrappedValue = !$0 })
}
}