Make iOS settings more idiomatic in some small ways: shorter labels, use of footers, etc.

This commit is contained in:
Brent Simmons committed 2026-11-14 21:52:58 -08:00
1 parent 7ed45c370b
commit f027a0f1d5
6 files changed
+58 -77

No files matched your search

+11 -11
View File
@@ -566,15 +566,6 @@
"Email" : {
"comment" : "Email field placeholder"
},
"Enable Full Screen Articles" : {
"comment" : "Enable Full Screen Articles"
},
"Enable Horizontal Swipe to Previous and Next Article" : {
"comment" : "Enable Horizontal Swipe to Previous and Next Article"
},
"Enable JavaScript" : {
"comment" : "Enable JavaScript"
},
"Enable Notifications" : {
"comment" : "Notifications"
},
@@ -709,6 +700,9 @@
"from cache" : {
"comment" : "Activity log — appended when a download was served from cache instead of the network"
},
"Full Screen Articles" : {
"comment" : "Full Screen Articles"
},
"Full Title, No Preview" : {
"comment" : "Timeline Layout: Rows choice that shows the whole title, without the article preview, in the timeline"
},
@@ -835,6 +829,9 @@
"Invalid username/password combination." : {
"comment" : "Credentials Error"
},
"JavaScript" : {
"comment" : "JavaScript"
},
"Keyboard Shortcuts" : {
"comment" : "window title"
},
@@ -1066,8 +1063,8 @@
"Notifications need to be enabled in the Settings app." : {
"comment" : "Notifications need to be enabled in the Settings app."
},
"Notifications, Badge, Data, & More" : {
"comment" : "Notifications, Badge, Data, & More"
"Notifications, Badge, Data, and More" : {
"comment" : "Notifications, Badge, Data, and More"
},
"OK" : {
"comment" : "OK button"
@@ -1438,6 +1435,9 @@
"Swipe a feed to show the action menu and delete button." : {
"comment" : "Dinosaurs swipe hint."
},
"Swipe Between Articles" : {
"comment" : "Swipe Between Articles"
},
"Sync content of unread articles" : {
"localizations" : {
"es" : {
+13 -18
View File
@@ -16,21 +16,18 @@ struct AccountInspectorView: View {
let account: Account
/// Shown as a sheet with a Done button, rather than pushed onto Settings.
let isModal: Bool
/// Pops or dismisses this screen.
let close: () -> Void
@Environment(\.dismiss) private var dismiss
@State private var name: String
@State private var isActive: Bool
@State private var syncContentOfUnreadArticles = AccountManager.shared.syncArticleContentForUnreadArticles
@State private var isShowingCredentials = false
@State private var isShowingRemoveConfirmation = false
@State private var isShowingLimitationsAndSolutions = false
@State private var isRemoved = false
init(account: Account, isModal: Bool, close: @escaping () -> Void) {
init(account: Account, isModal: Bool) {
self.account = account
self.isModal = isModal
self.close = close
self._name = State(initialValue: account.name ?? "")
self._isActive = State(initialValue: account.isActive)
}
@@ -91,12 +88,15 @@ struct AccountInspectorView: View {
}
}
}
.onChange(of: name) {
saveName()
}
.onChange(of: isActive) {
account.isActive = isActive
}
.onChange(of: syncContentOfUnreadArticles) {
AccountManager.shared.syncArticleContentForUnreadArticles = syncContentOfUnreadArticles
}
.onDisappear {
saveNameAndActive()
}
.sheet(isPresented: $isShowingCredentials) {
CredentialsAccountView(accountType: account.type, account: account, didAddAccount: nil)
}
@@ -147,26 +147,21 @@ private extension AccountInspectorView {
@ViewBuilder var doneButton: some View {
if #available(iOS 26, *) {
Button(role: .confirm) {
close()
dismiss()
}
} else {
Button(String(localized: "Done", comment: "Done")) {
close()
dismiss()
}
}
}
func saveNameAndActive() {
guard !isRemoved else {
return
}
account.name = name
account.isActive = isActive
func saveName() {
account.name = name.isEmpty ? nil : name
}
func removeAccount() {
isRemoved = true
AccountManager.shared.deleteAccount(account)
close()
dismiss()
}
}
+1 -4
View File
@@ -1625,10 +1625,7 @@ struct SidebarItemNode: Hashable, Sendable {
}
func showAccountInspector(for account: Account) {
let accountInspectorView = AccountInspectorView(account: account, isModal: true, close: { [weak self] in
self?.rootSplitViewController.dismiss(animated: true)
})
let hostingController = UIHostingController(rootView: NavigationStack { accountInspectorView })
let hostingController = UIHostingController(rootView: NavigationStack { AccountInspectorView(account: account, isModal: true) })
hostingController.modalPresentationStyle = .formSheet
hostingController.preferredContentSize = UIViewController.formSheetSize
rootSplitViewController.present(hostingController, animated: true)
+13 -15
View File
@@ -52,21 +52,19 @@ struct ArticlesSettingsView: View {
}
Section(String(localized: "Behavior", comment: "Behavior")) {
Toggle(String(localized: "Open Links in NetNewsWire", comment: "Open Links in NetNewsWire"), isOn: Binding(get: { !model.useSystemBrowser }, set: { AppDefaults.useSystemBrowser = !$0 }))
Toggle(isOn: Binding(get: { model.isArticleContentJavascriptEnabled }, set: { AppDefaults.isArticleContentJavascriptEnabled = $0 })) {
Text("Enable JavaScript", comment: "Enable JavaScript")
Text("Some content, such as videos and embedded social media posts, may require JavaScript to work correctly.", comment: "Some content, such as videos and embedded social media posts, may require JavaScript to work correctly.")
.font(.footnote)
.foregroundStyle(.secondary)
}
Toggle(String(localized: "Enable Horizontal Swipe to Previous and Next Article", comment: "Enable Horizontal Swipe to Previous and Next Article"), isOn: Binding(get: { model.articleSwipeNavigationEnabled }, set: { AppDefaults.articleSwipeNavigationEnabled = $0 }))
// The Full Screen Articles row is iPhone-only.
if UIDevice.current.userInterfaceIdiom == .phone {
Toggle(isOn: Binding(get: { model.articleFullscreenAvailable }, set: { AppDefaults.articleFullscreenAvailable = $0 })) {
Text("Enable Full Screen Articles", comment: "Enable Full Screen Articles")
Text("Tap the article top bar to enter Full Screen. Tap the top or bottom to exit.", comment: "Tap the article top bar to enter Full Screen. Tap the top or bottom to exit.")
.font(.footnote)
.foregroundStyle(.secondary)
}
Toggle(String(localized: "Swipe Between Articles", comment: "Swipe Between Articles"), isOn: Binding(get: { model.articleSwipeNavigationEnabled }, set: { AppDefaults.articleSwipeNavigationEnabled = $0 }))
}
Section {
Toggle(String(localized: "JavaScript", comment: "JavaScript"), isOn: Binding(get: { model.isArticleContentJavascriptEnabled }, set: { AppDefaults.isArticleContentJavascriptEnabled = $0 }))
} footer: {
Text("Some content, such as videos and embedded social media posts, may require JavaScript to work correctly.", comment: "Some content, such as videos and embedded social media posts, may require JavaScript to work correctly.")
}
// Full Screen Articles is iPhone-only.
if UIDevice.current.userInterfaceIdiom == .phone {
Section {
Toggle(String(localized: "Full Screen Articles", comment: "Full Screen Articles"), isOn: Binding(get: { model.articleFullscreenAvailable }, set: { AppDefaults.articleFullscreenAvailable = $0 }))
} footer: {
Text("Tap the article top bar to enter Full Screen. Tap the top or bottom to exit.", comment: "Tap the article top bar to enter Full Screen. Tap the top or bottom to exit.")
}
}
}
+16 -15
View File
@@ -18,6 +18,8 @@ struct SettingsView: View {
/// Presents Settings, and presents what Settings hands off to after dismissing itself.
let presentingParentController: RootSplitViewController?
@Environment(\.dismiss) private var dismiss
@Environment(\.openURL) private var openURL
@State private var model = SettingsModel()
@State private var path = [SettingsDestination]()
@State private var didShowTimelineSettings = false
@@ -29,8 +31,6 @@ struct SettingsView: View {
@State private var safariURL: URL?
@State private var alert: SettingsAlert?
@MainActor private static let buildLabelFont = UIFont.systemFont(ofSize: 11.0)
var body: some View {
NavigationStack(path: $path) {
List {
@@ -94,22 +94,25 @@ struct SettingsView: View {
}
Section {
actionRow(.help) {
openURL(HelpURL.helpHome.rawValue)
openHelpURL(HelpURL.helpHome.rawValue)
}
actionRow(.forum) {
openURL(HelpURL.discourse.rawValue)
openHelpURL(HelpURL.discourse.rawValue)
}
actionRow(.releaseNotes) {
openURL(HelpURL.releaseNotes.rawValue)
openHelpURL(HelpURL.releaseNotes.rawValue)
}
actionRow(.bugTracker) {
openURL(HelpURL.bugTracker.rawValue)
openHelpURL(HelpURL.bugTracker.rawValue)
}
navigationRow(.about, destination: .about)
} header: {
Text(SettingsSection.help.title)
} footer: {
CopyableText(text: "\(Bundle.main.appName) \(Bundle.main.versionNumber) (build \(Bundle.main.buildNumber))", font: Self.buildLabelFont, textColor: UIColor.gray, textAlignment: .natural)
Text(verbatim: "\(Bundle.main.appName) \(Bundle.main.versionNumber) (build \(Bundle.main.buildNumber))")
.font(.caption2)
.foregroundStyle(.gray)
.textSelection(.enabled)
}
}
.navigationTitle(NSLocalizedString("Settings", comment: "Settings"))
@@ -184,11 +187,11 @@ private extension SettingsView {
@ViewBuilder var doneButton: some View {
if #available(iOS 26, *) {
Button(NSLocalizedString("Done", comment: "Done"), systemImage: "checkmark") {
presentingParentController?.dismiss(animated: true)
dismiss()
}
} else {
Button(NSLocalizedString("Done", comment: "Done")) {
presentingParentController?.dismiss(animated: true)
dismiss()
}
}
}
@@ -197,9 +200,7 @@ private extension SettingsView {
switch destination {
case .account(let accountID):
if let account = AccountManager.shared.existingAccount(accountID: accountID) {
AccountInspectorView(account: account, isModal: false, close: {
popDestination()
})
AccountInspectorView(account: account, isModal: false)
}
case .addAccount:
AddAccountView(presentationAnchor: presentingParentController?.view.window) {
@@ -307,7 +308,7 @@ private extension SettingsView {
func openSystemSettings() {
if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(url)
openURL(url)
}
}
@@ -373,7 +374,7 @@ private extension SettingsView {
opmlExportURL = tempFile
}
func openURL(_ urlString: String) {
func openHelpURL(_ urlString: String) {
guard let url = URL(string: urlString) else {
return
}
@@ -445,7 +446,7 @@ private enum SettingsSection {
var title: String {
switch self {
case .notifications:
NSLocalizedString("Notifications, Badge, Data, & More", comment: "Notifications, Badge, Data, & More")
NSLocalizedString("Notifications, Badge, Data, and More", comment: "Notifications, Badge, Data, and More")
case .accounts:
NSLocalizedString("Accounts", comment: "Preferences")
case .feeds:
+4 -14
View File
@@ -59,27 +59,17 @@ private extension CopyableLabel {
// MARK: - SwiftUI
/// SwiftUI wrapper for `CopyableLabel`. Defaults to centered, secondary-colored body text.
/// SwiftUI wrapper for `CopyableLabel`: centered, secondary-colored body text.
struct CopyableText: UIViewRepresentable {
let text: String
let font: UIFont
let textColor: UIColor
let textAlignment: NSTextAlignment
init(text: String, font: UIFont = UIFont.preferredFont(forTextStyle: .body), textColor: UIColor = UIColor.secondaryLabel, textAlignment: NSTextAlignment = .center) {
self.text = text
self.font = font
self.textColor = textColor
self.textAlignment = textAlignment
}
func makeUIView(context: Context) -> CopyableLabel {
let label = CopyableLabel()
label.font = font
label.font = UIFont.preferredFont(forTextStyle: .body)
label.adjustsFontForContentSizeCategory = true
label.textColor = textColor
label.textAlignment = textAlignment
label.textColor = UIColor.secondaryLabel
label.textAlignment = .center
label.numberOfLines = 0
return label
}