Skip to content

Commit

Permalink
Remove explanatory text for Direct only in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rablador committed Oct 23, 2024
1 parent d339dae commit 45ae3a0
Showing 1 changed file with 3 additions and 48 deletions.
51 changes: 3 additions & 48 deletions ios/MullvadVPN/View controllers/Settings/SettingsDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ final class SettingsDataSource: UITableViewDiffableDataSource<SettingsDataSource
case main
case version
case problemReport

var sectionFooter: String? {
switch self {
case .daita:
NSLocalizedString(
"SETTINGS_DAITA_SECTION_FOOTER",
tableName: "Settings",
value: "Makes it possible to use DAITA with any server and is automatically enabled.",
comment: ""
)
default:
nil
}
}
}

enum Item: String {
Expand Down Expand Up @@ -150,42 +136,12 @@ final class SettingsDataSource: UITableViewDiffableDataSource<SettingsDataSource
)
}

func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
let sectionIdentifier = snapshot().sectionIdentifiers[section]

return switch sectionIdentifier {
case .main:
interactor.deviceState.isLoggedIn ? 0 : UITableView.automaticDimension
case .daita, .version, .problemReport:
UITableView.automaticDimension
}
}

func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let sectionIdentifier = snapshot().sectionIdentifiers[section]
guard let sectionFooterText = sectionIdentifier.sectionFooter else { return nil }

guard let headerView = tableView
.dequeueReusableView(withIdentifier: HeaderFooterReuseIdentifier.primary)
else { return nil }

var contentConfiguration = UIListContentConfiguration.mullvadGroupedFooter(tableStyle: .plain)
contentConfiguration.text = sectionFooterText

headerView.contentConfiguration = contentConfiguration

return headerView
nil
}

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
let sectionIdentifier = snapshot().sectionIdentifiers[section]

return switch sectionIdentifier {
case .daita:
UITableView.automaticDimension
case .main, .version, .problemReport:
0
}
0
}

// MARK: - Private
Expand All @@ -211,13 +167,12 @@ final class SettingsDataSource: UITableViewDiffableDataSource<SettingsDataSource

if interactor.deviceState.isLoggedIn {
snapshot.appendSections([.daita])
snapshot.appendItems([.daita, .daitaDirectOnly], toSection: .daita)
}

snapshot.appendSections([.main])

if interactor.deviceState.isLoggedIn {
snapshot.appendItems([.daita], toSection: .daita)
snapshot.appendItems([.daitaDirectOnly], toSection: .daita)
snapshot.appendItems([.vpnSettings], toSection: .main)
}

Expand Down

0 comments on commit 45ae3a0

Please sign in to comment.