UI/UX-improvements (IOS-241)
This commit is contained in:
parent
94ad86cd66
commit
363a521e68
|
@ -17,6 +17,9 @@ class NotificationPolicyFilterTableViewCell: ToggleTableViewCell {
|
|||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
|
||||
label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold))
|
||||
subtitleLabel.textColor = .secondaryLabel
|
||||
|
||||
toggle.addTarget(self, action: #selector(NotificationPolicyFilterTableViewCell.toggleValueChanged(_:)), for: .valueChanged)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import UIKit
|
||||
import MastodonLocalization
|
||||
import MastodonAsset
|
||||
|
||||
enum NotificationFilterSection: Hashable {
|
||||
case main
|
||||
|
@ -14,6 +15,7 @@ enum NotificationFilterItem: Hashable, CaseIterable {
|
|||
case privateMentions
|
||||
|
||||
var title: String {
|
||||
// TODO: Localization
|
||||
switch self {
|
||||
case .notFollowing:
|
||||
return "People you don't follow"
|
||||
|
@ -27,6 +29,7 @@ enum NotificationFilterItem: Hashable, CaseIterable {
|
|||
}
|
||||
|
||||
var subtitle: String {
|
||||
// TODO: Localization
|
||||
switch self {
|
||||
case .notFollowing:
|
||||
return "Until you manually approve them"
|
||||
|
@ -56,7 +59,6 @@ struct NotificationFilterViewModel {
|
|||
|
||||
class NotificationPolicyViewController: UIViewController {
|
||||
|
||||
//TODO: DataSource, Source, Items
|
||||
let tableView: UITableView
|
||||
var dataSource: UITableViewDiffableDataSource<NotificationFilterSection, NotificationFilterItem>?
|
||||
let items: [NotificationFilterItem]
|
||||
|
@ -77,8 +79,6 @@ class NotificationPolicyViewController: UIViewController {
|
|||
fatalError("No NotificationPolicyFilterTableViewCell")
|
||||
}
|
||||
|
||||
//TODO: Configuration
|
||||
|
||||
let item = items[indexPath.row]
|
||||
cell.configure(with: item, viewModel: self.viewModel)
|
||||
cell.delegate = self
|
||||
|
@ -86,6 +86,9 @@ class NotificationPolicyViewController: UIViewController {
|
|||
return cell
|
||||
}
|
||||
|
||||
// TODO: Localization
|
||||
title = "Filter Notifications from"
|
||||
|
||||
tableView.dataSource = dataSource
|
||||
tableView.delegate = self
|
||||
|
||||
|
@ -137,6 +140,22 @@ class NotificationPolicyViewController: UIViewController {
|
|||
extension NotificationPolicyViewController: UITableViewDelegate {
|
||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
|
||||
let filterItem = items[indexPath.row]
|
||||
switch filterItem {
|
||||
case .notFollowing:
|
||||
viewModel.notFollowing.toggle()
|
||||
case .noFollower:
|
||||
viewModel.noFollower.toggle()
|
||||
case .newAccount:
|
||||
viewModel.newAccount.toggle()
|
||||
case .privateMentions:
|
||||
viewModel.privateMentions.toggle()
|
||||
}
|
||||
|
||||
if let snapshot = dataSource?.snapshot() {
|
||||
dataSource?.applySnapshotUsingReloadData(snapshot)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ class ToggleTableViewCell: UITableViewCell {
|
|||
labelStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
labelStackView.alignment = .leading
|
||||
labelStackView.axis = .vertical
|
||||
labelStackView.spacing = 4
|
||||
|
||||
toggle = UISwitch()
|
||||
toggle.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
|
Loading…
Reference in New Issue