parent
e8d5f2477b
commit
63b0199a39
|
@ -35,7 +35,6 @@ struct AboutView: View {
|
|||
|
||||
var body: some View {
|
||||
listView
|
||||
.navigationTitle(Strings.Views.About.title)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import SwiftUI
|
|||
extension AboutView {
|
||||
var listView: some View {
|
||||
List {
|
||||
SettingsSection()
|
||||
Section {
|
||||
// TODO: #585, donations
|
||||
// donateLink
|
||||
|
@ -45,6 +46,7 @@ extension AboutView {
|
|||
.withTrailingText(BundleConfiguration.mainVersionString)
|
||||
}
|
||||
}
|
||||
.navigationTitle(Strings.Global.settings)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ extension AboutView {
|
|||
Text(BundleConfiguration.mainVersionString)
|
||||
.padding(.bottom)
|
||||
}
|
||||
.navigationTitle(Strings.Views.About.title)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ struct AppToolbar: ToolbarContent {
|
|||
}
|
||||
} else {
|
||||
ToolbarItem(placement: .navigation) {
|
||||
moreMenu
|
||||
moreButton
|
||||
}
|
||||
ToolbarItemGroup(placement: .primaryAction) {
|
||||
addProfileMenu
|
||||
|
@ -77,12 +77,9 @@ private extension AppToolbar {
|
|||
)
|
||||
}
|
||||
|
||||
var moreMenu: some View {
|
||||
Menu {
|
||||
settingsButton
|
||||
aboutButton
|
||||
} label: {
|
||||
ThemeImage(.moreDetails)
|
||||
var moreButton: some View {
|
||||
Button(action: onAbout) {
|
||||
ThemeImageLabel(Strings.Global.about, .moreDetails)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// SettingsSection.swift
|
||||
// Passepartout
|
||||
//
|
||||
// Created by Davide De Rosa on 10/3/24.
|
||||
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
|
||||
//
|
||||
// https://github.com/passepartoutvpn
|
||||
//
|
||||
// This file is part of Passepartout.
|
||||
//
|
||||
// Passepartout is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Passepartout is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
import CommonLibrary
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsSection: View {
|
||||
|
||||
@AppStorage(AppPreference.confirmsQuit.key)
|
||||
private var confirmsQuit = true
|
||||
|
||||
@AppStorage(AppPreference.locksInBackground.key)
|
||||
private var locksInBackground = false
|
||||
|
||||
var header: String?
|
||||
|
||||
var body: some View {
|
||||
Section {
|
||||
#if os(macOS)
|
||||
confirmsQuitToggle
|
||||
#endif
|
||||
#if os(iOS)
|
||||
lockInBackgroundToggle
|
||||
#endif
|
||||
} header: {
|
||||
header.map(Text.init)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension SettingsSection {
|
||||
var confirmsQuitToggle: some View {
|
||||
Toggle(Strings.Views.Settings.Rows.confirmQuit, isOn: $confirmsQuit)
|
||||
}
|
||||
|
||||
var lockInBackgroundToggle: some View {
|
||||
Toggle(Strings.Views.Settings.Rows.lockInBackground, isOn: $locksInBackground)
|
||||
}
|
||||
}
|
|
@ -23,17 +23,10 @@
|
|||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
import CommonLibrary
|
||||
import SwiftUI
|
||||
|
||||
public struct SettingsView: View {
|
||||
|
||||
@AppStorage(AppPreference.confirmsQuit.key)
|
||||
private var confirmsQuit = true
|
||||
|
||||
@AppStorage(AppPreference.locksInBackground.key)
|
||||
private var locksInBackground = false
|
||||
|
||||
@State
|
||||
private var path = NavigationPath()
|
||||
|
||||
|
@ -42,14 +35,7 @@ public struct SettingsView: View {
|
|||
|
||||
public var body: some View {
|
||||
Form {
|
||||
Section {
|
||||
#if os(macOS)
|
||||
confirmsQuitToggle
|
||||
#endif
|
||||
#if os(iOS)
|
||||
lockInBackgroundToggle
|
||||
#endif
|
||||
}
|
||||
SettingsSection()
|
||||
}
|
||||
.themeForm()
|
||||
.navigationTitle(Strings.Global.settings)
|
||||
|
@ -59,13 +45,3 @@ public struct SettingsView: View {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private extension SettingsView {
|
||||
var confirmsQuitToggle: some View {
|
||||
Toggle(Strings.Views.Settings.Rows.confirmQuit, isOn: $confirmsQuit)
|
||||
}
|
||||
|
||||
var lockInBackgroundToggle: some View {
|
||||
Toggle(Strings.Views.Settings.Rows.lockInBackground, isOn: $locksInBackground)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue