|
|
|
@ -73,33 +73,10 @@ extension AdvancedSettingsViewController: UITableViewDataSource { |
|
|
|
|
|
|
|
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
|
|
|
|
let row = viewModel.rows[indexPath.row] |
|
|
|
|
switch row { |
|
|
|
|
case .analytics, .changeCurrency, .changeLanguage, .clearBrowserCache, .console, .tokenScript: |
|
|
|
|
let cell: SettingTableViewCell = tableView.dequeueReusableCell(for: indexPath) |
|
|
|
|
cell.configure(viewModel: .init(titleText: row.title, subTitleText: nil, icon: row.icon)) |
|
|
|
|
|
|
|
|
|
return cell |
|
|
|
|
case .useTaiChiNetwork: |
|
|
|
|
let cell: SwitchTableViewCell = tableView.dequeueReusableCell(for: indexPath) |
|
|
|
|
cell.configure(viewModel: .init(titleText: row.title, icon: row.icon, value: config.useTaiChiNetwork)) |
|
|
|
|
cell.delegate = self |
|
|
|
|
|
|
|
|
|
return cell |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
extension AdvancedSettingsViewController: SwitchTableViewCellDelegate { |
|
|
|
|
|
|
|
|
|
func cell(_ cell: SwitchTableViewCell, switchStateChanged isOn: Bool) { |
|
|
|
|
guard let indexPath = cell.indexPath else { return } |
|
|
|
|
|
|
|
|
|
switch viewModel.rows[indexPath.row] { |
|
|
|
|
case .analytics, .changeCurrency, .changeLanguage, .clearBrowserCache, .console, .tokenScript: |
|
|
|
|
break |
|
|
|
|
case .useTaiChiNetwork: |
|
|
|
|
config.useTaiChiNetwork = isOn |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -139,8 +116,6 @@ extension AdvancedSettingsViewController: UITableViewDelegate { |
|
|
|
|
delegate?.advancedSettingsViewControllerChangeCurrencySelected(in: self) |
|
|
|
|
case .analytics: |
|
|
|
|
delegate?.advancedSettingsViewControllerAnalyticsSelected(in: self) |
|
|
|
|
case .useTaiChiNetwork: |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|