List other modules in TV active profile (#911)

Non-VPN profiles would otherwise be very shallow.
This commit is contained in:
Davide 2024-11-22 10:56:37 +01:00 committed by GitHub
parent 9b366dcaa0
commit a2f246454d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 29 additions and 3 deletions

View File

@ -55,8 +55,6 @@ struct ActiveProfileView: View {
var body: some View { var body: some View {
VStack(spacing: .zero) { VStack(spacing: .zero) {
Spacer()
VStack { VStack {
VStack { VStack {
currentProfileView currentProfileView
@ -76,6 +74,7 @@ struct ActiveProfileView: View {
.clipShape(RoundedRectangle(cornerRadius: 50)) .clipShape(RoundedRectangle(cornerRadius: 50))
} }
.padding(.horizontal, 100) .padding(.horizontal, 100)
.padding(.top, 50)
Spacer() Spacer()
} }
@ -100,7 +99,7 @@ private extension ActiveProfileView {
func detailView(for profile: Profile) -> some View { func detailView(for profile: Profile) -> some View {
VStack(spacing: 10) { VStack(spacing: 10) {
if let connectionModule = profile.firstConnectionModule(ifActive: true) { if let connectionModule {
DetailRowView(title: Strings.Global.protocol) { DetailRowView(title: Strings.Global.protocol) {
Text(connectionModule.moduleHandler.id.name) Text(connectionModule.moduleHandler.id.name)
} }
@ -117,6 +116,11 @@ private extension ActiveProfileView {
} }
} }
} }
if let otherModulesList {
DetailRowView(title: otherModulesList) {
EmptyView()
}
}
} }
.font(.title3) .font(.title3)
} }
@ -163,6 +167,28 @@ private extension ActiveProfileView {
} }
} }
private extension ActiveProfileView {
var connectionModule: ConnectionModule? {
profile?.firstConnectionModule(ifActive: true)
}
var otherModules: [Module]? {
profile?
.activeModules
.filter {
!($0 is ConnectionModule)
}
.nilIfEmpty
}
var otherModulesList: String? {
otherModules?
.map(\.moduleType.localizedDescription)
.sorted()
.joined(separator: ", ")
}
}
// MARK: - // MARK: -
private extension ActiveProfileView { private extension ActiveProfileView {