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 {
VStack(spacing: .zero) {
Spacer()
VStack {
VStack {
currentProfileView
@ -76,6 +74,7 @@ struct ActiveProfileView: View {
.clipShape(RoundedRectangle(cornerRadius: 50))
}
.padding(.horizontal, 100)
.padding(.top, 50)
Spacer()
}
@ -100,7 +99,7 @@ private extension ActiveProfileView {
func detailView(for profile: Profile) -> some View {
VStack(spacing: 10) {
if let connectionModule = profile.firstConnectionModule(ifActive: true) {
if let connectionModule {
DetailRowView(title: Strings.Global.protocol) {
Text(connectionModule.moduleHandler.id.name)
}
@ -117,6 +116,11 @@ private extension ActiveProfileView {
}
}
}
if let otherModulesList {
DetailRowView(title: otherModulesList) {
EmptyView()
}
}
}
.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: -
private extension ActiveProfileView {