Toggle alerts on tap (IOS-14)

This feels kind of good :D
This commit is contained in:
Nathan Mattes 2023-09-26 15:49:58 +02:00
parent ba0f689acd
commit f5365a9d6e
2 changed files with 12 additions and 5 deletions

View File

@ -110,11 +110,19 @@ extension NotificationSettingsViewController: UITableViewDelegate {
let entry = sections[indexPath.section].entries[indexPath.row]
switch entry {
case .alert(_):
break
case .policy:
delegate?.showPolicyList(self, viewModel: viewModel)
case .alert(let alert):
guard let cell = tableView.cellForRow(at: indexPath) as? NotificationSettingTableViewToggleCell else { return }
let newValue = (cell.toggle.isOn == false)
cell.toggle.setOn(newValue, animated: true)
toggleValueChanged(cell, alert: alert, newValue: newValue)
case .policy:
delegate?.showPolicyList(self, viewModel: viewModel)
}
tableView.deselectRow(at: indexPath, animated: true)

View File

@ -23,7 +23,6 @@ class ToggleTableViewCell: UITableViewCell {
toggle.onTintColor = Asset.Colors.Brand.blurple.color
super.init(style: style, reuseIdentifier: reuseIdentifier)
contentView.addSubview(label)
contentView.addSubview(toggle)