From 07d9c3dd086f3096aa42063f624c628bd6aebf63 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Tue, 13 Dec 2022 07:08:45 +0800 Subject: [PATCH] camelCase SettingsViewRows --- .../Appearance/DisplayAndBehaviorsView.swift | 14 +++---- iOS/Settings/Views/General/SettingsRows.swift | 39 ++++++++----------- iOS/Settings/Views/General/SettingsView.swift | 16 ++++---- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift b/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift index 432dff6cd..467f85216 100644 --- a/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift +++ b/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift @@ -20,16 +20,16 @@ struct DisplayAndBehaviorsView: View { } Section("Timeline") { - SettingsViewRows.SortOldestToNewest($appDefaults.timelineSortDirectionBool) - SettingsViewRows.GroupByFeed($appDefaults.timelineGroupByFeed) - SettingsViewRows.RefreshToClearReadArticles($appDefaults.refreshClearsReadArticles) - SettingsViewRows.TimelineLayout + SettingsViewRows.sortOldestToNewest($appDefaults.timelineSortDirectionBool) + SettingsViewRows.groupByFeed($appDefaults.timelineGroupByFeed) + SettingsViewRows.refreshToClearReadArticles($appDefaults.refreshClearsReadArticles) + SettingsViewRows.timelineLayout } Section("Article") { - SettingsViewRows.ThemeSelection - SettingsViewRows.ConfirmMarkAllAsRead($appDefaults.confirmMarkAllAsRead) - SettingsViewRows.OpenLinksInNetNewsWire(Binding( + SettingsViewRows.themeSelection + SettingsViewRows.confirmMarkAllAsRead($appDefaults.confirmMarkAllAsRead) + SettingsViewRows.openLinksInNetNewsWire(Binding( get: { !appDefaults.useSystemBrowser }, set: { appDefaults.useSystemBrowser = !$0 } )) diff --git a/iOS/Settings/Views/General/SettingsRows.swift b/iOS/Settings/Views/General/SettingsRows.swift index 25aa083f0..6ec790341 100644 --- a/iOS/Settings/Views/General/SettingsRows.swift +++ b/iOS/Settings/Views/General/SettingsRows.swift @@ -16,7 +16,7 @@ import UniformTypeIdentifiers struct SettingsViewRows { /// This row, when tapped, will open iOS System Settings. - static var OpenSystemSettings: some View { + static var openSystemSettings: some View { Label { Text("Open System Settings") } icon: { @@ -33,7 +33,7 @@ struct SettingsViewRows { /// This row, when tapped, will push the New Article Notifications /// screen in to view. - static var ConfigureNewArticleNotifications: some View { + static var configureNewArticleNotifications: some View { NavigationLink(destination: NewArticleNotificationsView()) { Label { Text("New Article Notifications") @@ -48,7 +48,7 @@ struct SettingsViewRows { /// This row, when tapped, will push the the Add Account screen /// in to view. - static var AddAccount: some View { + static var addAccount: some View { NavigationLink(destination: AccountsManagementView()) { Label { Text("Manage Accounts") @@ -63,7 +63,7 @@ struct SettingsViewRows { /// This row, when tapped, will push the the Manage Extension screen /// in to view. - static var ManageExtensions: some View { + static var manageExtensions: some View { NavigationLink(destination: ExtensionsManagementView()) { Label { Text("Manage Extensions") @@ -78,7 +78,7 @@ struct SettingsViewRows { /// This row, when tapped, will present an Import/Export /// menu. - static func ImportExportOPML(showImportView: Binding, showExportView: Binding, importAccount: Binding, exportDocument: Binding) -> some View { + static func importExportOPML(showImportView: Binding, showExportView: Binding, importAccount: Binding, exportDocument: Binding) -> some View { Menu { Menu { ForEach(AccountManager.shared.sortedActiveAccounts, id: \.self) { account in @@ -123,27 +123,27 @@ struct SettingsViewRows { /// Returns a `Toggle` which triggers changes to the user's sort order preference. /// - Parameter preference: `Binding` /// - Returns: `Toggle` - static func SortOldestToNewest(_ preference: Binding) -> some View { + static func sortOldestToNewest(_ preference: Binding) -> some View { Toggle("Sort Oldest to Newest", isOn: preference) } /// Returns a `Toggle` which triggers changes to the user's grouping preference. /// - Parameter preference: `Binding` /// - Returns: `Toggle` - static func GroupByFeed(_ preference: Binding) -> some View { + static func groupByFeed(_ preference: Binding) -> some View { Toggle("Group by Feed", isOn: preference) } /// Returns a `Toggle` which triggers changes to the user's refresh to clear preferences. /// - Parameter preference: `Binding` /// - Returns: `Toggle` - static func RefreshToClearReadArticles(_ preference: Binding) -> some View { + static func refreshToClearReadArticles(_ preference: Binding) -> some View { Toggle("Refresh To Clear Read Articles", isOn: preference) } /// This row, when tapped, will push the the Timeline Layout screen /// in to view. - static var TimelineLayout: some View { + static var timelineLayout: some View { NavigationLink(destination: TimelineCustomizerWrapper().edgesIgnoringSafeArea(.all).navigationTitle(Text("Timeline Layout"))) { Text("Timeline Layout") } @@ -151,7 +151,7 @@ struct SettingsViewRows { /// This row, when tapped, will push the the Theme Selector screen /// in to view. - static var ThemeSelection: some View { + static var themeSelection: some View { NavigationLink(destination: ArticleThemesWrapper().edgesIgnoringSafeArea(.all)) { HStack { Text("Article Theme") @@ -163,16 +163,16 @@ struct SettingsViewRows { } } - static func ConfirmMarkAllAsRead(_ preference: Binding) -> some View { + static func confirmMarkAllAsRead(_ preference: Binding) -> some View { Toggle("Confirm Mark All as Read", isOn: preference) } - static func OpenLinksInNetNewsWire(_ preference: Binding) -> some View { + static func openLinksInNetNewsWire(_ preference: Binding) -> some View { Toggle("Open Links in NetNewsWire", isOn: preference) } // TODO: Add Reader Mode Defaults here. See #3684. - static func EnableFullScreenArticles(_ preference: Binding) -> some View { + static func enableFullScreenArticles(_ preference: Binding) -> some View { Toggle(isOn: preference) { VStack(alignment: .leading, spacing: 4) { Text("Enable Full Screen Articles") @@ -185,7 +185,7 @@ struct SettingsViewRows { /// This row, when tapped, will push the New Article Notifications /// screen in to view. - static func ConfigureAppearance(_ isShown: Binding) -> some View { + static func configureAppearance(_ isShown: Binding) -> some View { NavigationLink(destination: DisplayAndBehaviorsView(), isActive: isShown) { Label { Text("Display & Behaviors") @@ -204,7 +204,7 @@ struct SettingsViewRows { /// - selectedSheet: A `Binding` to the currently selected sheet. This is set, followed by `show`. /// - show: A `Binding` to `Bool` which triggers the sheet to display. /// - Returns: `View` - static func ShowHelpSheet(sheet: HelpSheet, selectedSheet: Binding, _ show: Binding) -> some View { + static func showHelpSheet(sheet: HelpSheet, selectedSheet: Binding, _ show: Binding) -> some View { Label { Text(sheet.description) } icon: { @@ -221,7 +221,7 @@ struct SettingsViewRows { } } - static var AboutNetNewsWire: some View { + static var aboutNetNewsWire: some View { NavigationLink { AboutView() } label: { @@ -238,10 +238,3 @@ struct SettingsViewRows { } } } - - -extension Binding where Value == Bool { - func negate() -> Bool { - return !(self.wrappedValue) - } -} diff --git a/iOS/Settings/Views/General/SettingsView.swift b/iOS/Settings/Views/General/SettingsView.swift index fe722024b..777ca09c8 100644 --- a/iOS/Settings/Views/General/SettingsView.swift +++ b/iOS/Settings/Views/General/SettingsView.swift @@ -24,30 +24,30 @@ struct SettingsView: View { // Device Permissions Section(header: Text("Device Permissions"), footer: Text("Configure NetNewsWire's access to Siri, background app refresh, mobile data, and more.")) { - SettingsViewRows.OpenSystemSettings + SettingsViewRows.openSystemSettings } // Account/Extensions/OPML Management Section(header: Text("Accounts & Extensions"), footer: Text("Add, delete, enable, or disable accounts and extensions.")) { - SettingsViewRows.AddAccount - SettingsViewRows.ManageExtensions - SettingsViewRows.ImportExportOPML(showImportView: $viewModel.showImportView, showExportView: $viewModel.showExportView, importAccount: $viewModel.importAccount, exportDocument: $viewModel.exportDocument) + SettingsViewRows.addAccount + SettingsViewRows.manageExtensions + SettingsViewRows.importExportOPML(showImportView: $viewModel.showImportView, showExportView: $viewModel.showExportView, importAccount: $viewModel.importAccount, exportDocument: $viewModel.exportDocument) } // Appearance Section(header: Text("Appearance"), footer: Text("Manage the look, feel, and behavior of NetNewsWire.")) { - SettingsViewRows.ConfigureAppearance($isConfigureAppearanceShown) + SettingsViewRows.configureAppearance($isConfigureAppearanceShown) if viewModel.notificationPermissions == .authorized { - SettingsViewRows.ConfigureNewArticleNotifications + SettingsViewRows.configureNewArticleNotifications } } // Help Section { ForEach(0..