Skip to content

Commit

Permalink
List other modules in TV active profile (#911)
Browse files Browse the repository at this point in the history
Non-VPN profiles would otherwise be very shallow.
  • Loading branch information
keeshux authored Nov 22, 2024
1 parent 9b366dc commit a2f2464
Showing 1 changed file with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ struct ActiveProfileView: View {

var body: some View {
VStack(spacing: .zero) {
Spacer()

VStack {
VStack {
currentProfileView
Expand All @@ -76,6 +74,7 @@ struct ActiveProfileView: View {
.clipShape(RoundedRectangle(cornerRadius: 50))
}
.padding(.horizontal, 100)
.padding(.top, 50)

Spacer()
}
Expand All @@ -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)
}
Expand All @@ -117,6 +116,11 @@ private extension ActiveProfileView {
}
}
}
if let otherModulesList {
DetailRowView(title: otherModulesList) {
EmptyView()
}
}
}
.font(.title3)
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a2f2464

Please sign in to comment.