Skip to content

Commit

Permalink
Formatting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
acb-mv committed Feb 12, 2024
1 parent 95a7a85 commit 566b6da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ final class PreferencesCellFactory: CellFactoryProtocol {
cell.accessibilityIdentifier = "\(item.accessibilityIdentifier.rawValue) (\(portString))"
cell.applySubCellStyling()

#if DEBUG
#if DEBUG
case .quantumResistanceAutomatic:
guard let cell = cell as? SelectableSettingsCell else { return }

Expand Down Expand Up @@ -191,7 +191,7 @@ final class PreferencesCellFactory: CellFactoryProtocol {
)
cell.accessibilityIdentifier = item.accessibilityIdentifier
cell.applySubCellStyling()
#endif
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
case wireGuardPorts
case wireGuardObfuscation
case wireGuardObfuscationPort
#if DEBUG
#if DEBUG
case quantumResistance
#endif
#endif
}

enum Item: Hashable {
Expand All @@ -66,11 +66,11 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
case wireGuardObfuscationOn
case wireGuardObfuscationOff
case wireGuardObfuscationPort(_ port: UInt16)
#if DEBUG
#if DEBUG
case quantumResistanceAutomatic
case quantumResistanceOn
case quantumResistanceOff
#endif
#endif

static var wireGuardPorts: [Item] {
let defaultPorts = PreferencesViewModel.defaultWireGuardPorts.map {
Expand All @@ -87,11 +87,11 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
[.wireGuardObfuscationPort(0), wireGuardObfuscationPort(80), wireGuardObfuscationPort(5001)]
}

#if DEBUG
#if DEBUG
static var quantumResistance: [Item] {
[.quantumResistanceAutomatic, .quantumResistanceOn, .quantumResistanceOff]
}
#endif
#endif

var accessibilityIdentifier: AccessibilityIdentifier {
switch self {
Expand All @@ -109,14 +109,14 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
return .wireGuardObfuscationOff
case .wireGuardObfuscationPort:
return .wireGuardObfuscationAutomatic
#if DEBUG
#if DEBUG
case .quantumResistanceAutomatic:
return .quantumResistanceAutomatic
case .quantumResistanceOn:
return .quantumResistanceOn
case .quantumResistanceOff:
return .quantumResistanceOff
#endif
#endif
}
}

Expand All @@ -132,10 +132,10 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
return .wireGuardObfuscation
case .wireGuardObfuscationPort:
return .wireGuardObfuscationPort
#if DEBUG
#if DEBUG
case .quantumResistanceAutomatic, .quantumResistanceOn, .quantumResistanceOff:
return .quantumResistance
#endif
#endif
}
}
}
Expand All @@ -158,30 +158,30 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
case .off: .wireGuardObfuscationOff
case .on: .wireGuardObfuscationOn
}
#if DEBUG
#if DEBUG
let quantumResistanceItem: Item = switch viewModel.quantumResistance {
case .automatic: .quantumResistanceAutomatic
case .off: .quantumResistanceOff
case .on: .quantumResistanceOn
}
#endif
#endif

let obfuscationPortItem: Item = .wireGuardObfuscationPort(viewModel.obfuscationPort.portValue)

#if DEBUG
#if DEBUG
return [
wireGuardPortItem,
obfuscationStateItem,
obfuscationPortItem,
quantumResistanceItem,
].compactMap { indexPath(for: $0) }
#else
#else
return [
wireGuardPortItem,
obfuscationStateItem,
obfuscationPortItem,
].compactMap { indexPath(for: $0) }
#endif
#endif
}

init(tableView: UITableView) {
Expand Down Expand Up @@ -286,7 +286,7 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
selectObfuscationPort(port)
delegate?.didChangeViewModel(viewModel)

#if DEBUG
#if DEBUG
case .quantumResistanceAutomatic:
selectQuantumResistance(.automatic)
delegate?.didChangeViewModel(viewModel)
Expand All @@ -296,7 +296,7 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
case .quantumResistanceOff:
selectQuantumResistance(.off)
delegate?.didChangeViewModel(viewModel)
#endif
#endif
default:
break
}
Expand Down Expand Up @@ -334,11 +334,11 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
case .wireGuardObfuscationPort:
configureObfuscationPortHeader(view)
return view
#if DEBUG
#if DEBUG
case .quantumResistance:
configureQuantumResistanceHeader(view)
return view
#endif
#endif

default:
return nil
Expand Down Expand Up @@ -522,7 +522,7 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
}
}

#if DEBUG
#if DEBUG
private func configureQuantumResistanceHeader(_ header: SettingsHeaderView) {
let title = NSLocalizedString(
"QUANTUM_RESISTANCE_HEADER_LABEL",
Expand Down Expand Up @@ -550,7 +550,7 @@ final class PreferencesDataSource: UITableViewDiffableDataSource<
self.map { $0.delegate?.showInfo(for: .quantumResistance) }
}
}
#endif
#endif

private func selectRow(at indexPath: IndexPath?, animated: Bool = false) {
tableView?.selectRow(at: indexPath, animated: animated, scrollPosition: .none)
Expand Down

0 comments on commit 566b6da

Please sign in to comment.