diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Profile/ProfileNameSection.swift b/Passepartout/Library/Sources/AppUIMain/Views/Profile/ProfileNameSection.swift
new file mode 100644
index 00000000..9f86999f
--- /dev/null
+++ b/Passepartout/Library/Sources/AppUIMain/Views/Profile/ProfileNameSection.swift
@@ -0,0 +1,41 @@
+//
+// ProfileNameSection.swift
+// Passepartout
+//
+// Created by Davide De Rosa on 11/27/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 .
+//
+
+import SwiftUI
+import UILibrary
+
+struct ProfileNameSection: View {
+
+ @Binding
+ var name: String
+
+ var body: some View {
+ NameSection(
+ name: $name,
+ placeholder: Strings.Placeholders.Profile.name,
+ footer: Strings.Views.Profile.Sections.Name.footer
+ )
+ }
+}
diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Profile/iOS/ProfileEditView+iOS.swift b/Passepartout/Library/Sources/AppUIMain/Views/Profile/iOS/ProfileEditView+iOS.swift
index 5dbd9e1f..9d0a1c5d 100644
--- a/Passepartout/Library/Sources/AppUIMain/Views/Profile/iOS/ProfileEditView+iOS.swift
+++ b/Passepartout/Library/Sources/AppUIMain/Views/Profile/iOS/ProfileEditView+iOS.swift
@@ -53,9 +53,8 @@ struct ProfileEditView: View, Routable {
var body: some View {
debugChanges()
return List {
- NameSection(
- name: $profileEditor.profile.name,
- placeholder: Strings.Placeholders.Profile.name
+ ProfileNameSection(
+ name: $profileEditor.profile.name
)
modulesSection
StorageSection(
diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Profile/macOS/ProfileGeneralView+macOS.swift b/Passepartout/Library/Sources/AppUIMain/Views/Profile/macOS/ProfileGeneralView+macOS.swift
index 4dc5674c..1b435ba9 100644
--- a/Passepartout/Library/Sources/AppUIMain/Views/Profile/macOS/ProfileGeneralView+macOS.swift
+++ b/Passepartout/Library/Sources/AppUIMain/Views/Profile/macOS/ProfileGeneralView+macOS.swift
@@ -38,9 +38,8 @@ struct ProfileGeneralView: View {
var body: some View {
Form {
- NameSection(
- name: $profileEditor.profile.name,
- placeholder: Strings.Placeholders.Profile.name
+ ProfileNameSection(
+ name: $profileEditor.profile.name
)
StorageSection(
profileEditor: profileEditor,
diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift b/Passepartout/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift
index 528a7fb7..48d69668 100644
--- a/Passepartout/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift
+++ b/Passepartout/Library/Sources/AppUIMain/Views/Providers/ProviderContentModifier.swift
@@ -98,7 +98,7 @@ private extension ProviderContentModifier {
HStack {
lastUpdatedString.map {
Text($0)
- .foregroundStyle(.secondary)
+ .themeFooter()
}
Spacer()
RefreshInfrastructureButton(apis: apis, providerId: providerId)
diff --git a/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift b/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift
index 64ad50e4..1aac4da1 100644
--- a/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift
+++ b/Passepartout/Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift
@@ -804,6 +804,12 @@ public enum Strings {
/// Add module
public static let addModule = Strings.tr("Localizable", "views.profile.rows.add_module", fallback: "Add module")
}
+ public enum Sections {
+ public enum Name {
+ /// Use this name to create your VPN automations from the Shortcuts app.
+ public static let footer = Strings.tr("Localizable", "views.profile.sections.name.footer", fallback: "Use this name to create your VPN automations from the Shortcuts app.")
+ }
+ }
}
public enum Providers {
/// Clear filters
diff --git a/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings b/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings
index 06e80c4f..c66d0705 100644
--- a/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings
+++ b/Passepartout/Library/Sources/UILibrary/Resources/en.lproj/Localizable.strings
@@ -99,6 +99,7 @@
"views.preferences.erase_icloud" = "Erase iCloud store";
"views.preferences.erase_icloud.footer" = "To erase the iCloud store securely, do so on all your synced devices. This will not affect local profiles.";
+"views.profile.sections.name.footer" = "Use this name to create your VPN automations from the Shortcuts app.";
"views.profile.rows.add_module" = "Add module";
"views.profile.module_list.section.footer" = "Drag modules to rearrange them, as their order determines priority.";
"views.profile.alerts.purchase.buttons.ok" = "Save anyway";
diff --git a/Passepartout/Library/Sources/UILibrary/Theme/Platforms/Theme+macOS.swift b/Passepartout/Library/Sources/UILibrary/Theme/Platforms/Theme+macOS.swift
index 1ca825c7..b9299bd8 100644
--- a/Passepartout/Library/Sources/UILibrary/Theme/Platforms/Theme+macOS.swift
+++ b/Passepartout/Library/Sources/UILibrary/Theme/Platforms/Theme+macOS.swift
@@ -91,8 +91,7 @@ extension ThemeRowWithFooterModifier {
footer.map {
Text($0)
- .foregroundStyle(.secondary)
- .font(.subheadline)
+ .themeFooter()
.frame(maxWidth: .infinity, alignment: .leading)
}
}
diff --git a/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift b/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift
index e4a365ee..6e8ede73 100644
--- a/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift
+++ b/Passepartout/Library/Sources/UILibrary/Theme/UI/Theme+Modifiers.swift
@@ -143,6 +143,11 @@ extension View {
modifier(ThemeRowWithFooterModifier(footer: footer))
}
+ public func themeFooter() -> some View {
+ foregroundStyle(.secondary)
+ .font(.subheadline)
+ }
+
public func themeSectionWithSingleRow(header: String? = nil, footer: String, above: Bool = false) -> some View {
Group {
if above {
diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Profile/NameSection.swift b/Passepartout/Library/Sources/UILibrary/Views/UI/NameSection.swift
similarity index 74%
rename from Passepartout/Library/Sources/AppUIMain/Views/Profile/NameSection.swift
rename to Passepartout/Library/Sources/UILibrary/Views/UI/NameSection.swift
index b03be970..85e4dae3 100644
--- a/Passepartout/Library/Sources/AppUIMain/Views/Profile/NameSection.swift
+++ b/Passepartout/Library/Sources/UILibrary/Views/UI/NameSection.swift
@@ -25,21 +25,36 @@
import SwiftUI
-struct NameSection: View {
+public struct NameSection: View {
@Binding
- var name: String
+ private var name: String
- let placeholder: String
+ private let placeholder: String
- var body: some View {
+ private let footer: String?
+
+ public init(name: Binding, placeholder: String, footer: String? = nil) {
+ _name = name
+ self.placeholder = placeholder
+ self.footer = footer
+ }
+
+ public var body: some View {
debugChanges()
return Group {
ThemeTextField(Strings.Global.Nouns.name, text: $name, placeholder: placeholder)
.labelsHidden()
.themeManualInput()
+
+#if os(macOS)
+ footer.map {
+ Text($0)
+ .themeFooter()
+ }
+#endif
}
- .themeSection(header: Strings.Global.Nouns.name)
+ .themeSection(header: Strings.Global.Nouns.name, footer: footer)
}
}