Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove explanatory text for Direct only in settings #7044

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 2 additions & 54 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 @@ -116,6 +102,7 @@ final class SettingsDataSource: UITableViewDiffableDataSource<SettingsDataSource
settingsCellFactory.makeCell(for: itemIdentifier, indexPath: indexPath)
}

tableView.sectionFooterHeight = 0
tableView.delegate = self
settingsCellFactory.delegate = self

Expand Down Expand Up @@ -150,44 +137,6 @@ 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
}

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
}
}

// MARK: - Private

private func registerClasses() {
Expand All @@ -211,13 +160,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
Loading