simplifies Settings options

This commit is contained in:
Stuart Breckenridge
2022-11-12 21:35:59 +08:00
parent 3630c6f7b2
commit bb49e744ae
13 changed files with 109 additions and 50 deletions

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "app.account.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "app.appearance.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "app.extension.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "notifications.sounds.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "system.settings.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -15,7 +15,7 @@ struct SettingsViewHeaders {
static func AddAccountHeader(_ showAddAccount: Binding<Bool>) -> some View {
HStack {
Text("Accounts")
//Text("Accounts")
Spacer()
Button {
showAddAccount.wrappedValue.toggle()
@@ -43,12 +43,11 @@ struct SettingsViewRows {
Label {
Text("Open System Settings")
} icon: {
Image(systemName: "gear.circle.fill")
Image("system.settings")
.resizable()
.renderingMode(.template)
.foregroundColor(.gray)
.aspectRatio(contentMode: .fit)
.frame(width: 25.0, height: 25.0)
.clipShape(RoundedRectangle(cornerRadius: 6))
}
.onTapGesture {
UIApplication.shared.open(URL(string: "\(UIApplication.openSettingsURLString)")!)
@@ -60,14 +59,12 @@ struct SettingsViewRows {
static var ConfigureNewArticleNotifications: some View {
NavigationLink(destination: NotificationsViewControllerRepresentable().edgesIgnoringSafeArea(.all)) {
Label {
Text("New Article Notifications")
Text("Notifications and Sounds")
} icon: {
Image(systemName: "bell.square.fill")
Image("notifications.sounds")
.resizable()
.renderingMode(.template)
.foregroundColor(.red)
.aspectRatio(contentMode: .fit)
.frame(width: 25.0, height: 25.0)
.clipShape(RoundedRectangle(cornerRadius: 6))
}
}
}
@@ -77,14 +74,12 @@ struct SettingsViewRows {
static var AddAccount: some View {
NavigationLink(destination: AddAccountViewControllerRepresentable().edgesIgnoringSafeArea(.all)) {
Label {
Text("Add Account")
Text("Manage Accounts")
} icon: {
Image(systemName: "plus.app.fill")
Image("app.account")
.resizable()
.renderingMode(.template)
.foregroundColor(Color(uiColor: AppAssets.primaryAccentColor))
.aspectRatio(contentMode: .fit)
.frame(width: 25.0, height: 25.0)
.clipShape(RoundedRectangle(cornerRadius: 6))
}
}
}
@@ -110,12 +105,12 @@ struct SettingsViewRows {
static var AddExtension: some View {
NavigationLink(destination: NotificationsViewControllerRepresentable()) {
Label {
Text("Add Extension")
Text("Manage Extensions")
} icon: {
Image(systemName: "puzzlepiece.extension")
Image("app.extension")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 25.0, height: 25.0)
.clipShape(RoundedRectangle(cornerRadius: 6))
}
}
}
@@ -219,14 +214,12 @@ struct SettingsViewRows {
static var ConfigureAppearance: some View {
NavigationLink(destination: NotificationsViewControllerRepresentable().edgesIgnoringSafeArea(.all)) {
Label {
Text("Configure Appearance")
Text("Appearance")
} icon: {
Image(systemName: "rectangle.trailinghalf.filled")
Image("app.appearance")
.resizable()
.renderingMode(.template)
.foregroundColor(.black)
.aspectRatio(contentMode: .fit)
.frame(width: 25.0, height: 25.0)
.clipShape(RoundedRectangle(cornerRadius: 6))
}
}
}
@@ -253,4 +246,16 @@ struct SettingsViewRows {
show.wrappedValue.toggle()
}
}
static var AboutNetNewsWire: some View {
NavigationLink {
AboutView()
} label: {
Label {
Text("About NetNewsWire")
} icon: {
Image(systemName: "questionmark.square.dashed")
}
}
}
}

View File

@@ -15,50 +15,35 @@ struct SettingsView: View {
@State private var showAddAccountView: Bool = false
@State private var helpSheet: HelpSheet = .help
@State private var showHelpSheet: Bool = false
@State private var showAbout: Bool = false
var body: some View {
NavigationView {
List {
Section("Notifications, Badge, Data, and More") {
// System Settings
Section(footer: Text("Configure access to Siri, background app refresh, mobile data, and more.")) {
SettingsViewRows.OpenSystemSettings
SettingsViewRows.ConfigureNewArticleNotifications
}
Section(header: SettingsViewHeaders.AddAccountHeader($showAddAccountView)) {
SettingsViewRows.ActiveAccounts
}
Section("Extensions") {
Section(footer: Text("Add, delete, or disable accounts and extensions.")) {
SettingsViewRows.AddAccount
SettingsViewRows.AddExtension
}
Section("Subscriptions") {
SettingsViewRows.ImportSubscription
SettingsViewRows.ExportSubscription
}
Section("Timeline") {
SettingsViewRows.SortOldestToNewest($appDefaults.timelineSortDirectionBool)
SettingsViewRows.GroupByFeed($appDefaults.timelineGroupByFeed)
SettingsViewRows.RefreshToClearReadArticles($appDefaults.refreshClearsReadArticles)
SettingsViewRows.TimelineLayout
}
Section("Articles") {
SettingsViewRows.ThemeSelection
SettingsViewRows.ConfirmMarkAllAsRead($appDefaults.confirmMarkAllAsRead)
SettingsViewRows.OpenLinksInNetNewsWire($appDefaults.useSystemBrowser)
SettingsViewRows.EnableFullScreenArticles($appDefaults.articleFullscreenEnabled)
}
Section("Appearance") {
Section(footer: Text("Configure the look and feel of NetNewsWire.")) {
SettingsViewRows.ConfigureNewArticleNotifications
SettingsViewRows.ConfigureAppearance
}
Section("Help") {
Section {
ForEach(0..<HelpSheet.allCases.count, id: \.self) { i in
SettingsViewRows.ShowHelpSheet(sheet: HelpSheet.allCases[i], selectedSheet: $helpSheet, $showHelpSheet)
}
SettingsViewRows.AboutNetNewsWire
}
}
.tint(Color(uiColor: AppAssets.primaryAccentColor))
@@ -71,6 +56,9 @@ struct SettingsView: View {
.sheet(isPresented: $showHelpSheet) {
SafariView(url: helpSheet.url)
}
.sheet(isPresented: $showAbout) {
AboutView()
}
}
}
}