mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix lint issues.
This commit is contained in:
@@ -15,7 +15,7 @@ protocol MainFeedTableViewSectionHeaderDelegate {
|
||||
class MainFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
|
||||
var delegate: MainFeedTableViewSectionHeaderDelegate?
|
||||
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
set {}
|
||||
get {
|
||||
@@ -37,7 +37,7 @@ class MainFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
return NSLocalizedString("Collapsed", comment: "Disclosure button collapsed state for accessibility")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var unreadCount: Int {
|
||||
get {
|
||||
return unreadCountView.unreadCount
|
||||
@@ -50,7 +50,7 @@ class MainFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var name: String {
|
||||
get {
|
||||
return titleView.text ?? ""
|
||||
@@ -62,16 +62,16 @@ class MainFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var disclosureExpanded = false {
|
||||
didSet {
|
||||
updateExpandedState(animate: true)
|
||||
updateUnreadCountView()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var isLastSection = false
|
||||
|
||||
|
||||
private let titleView: UILabel = {
|
||||
let label = NonIntrinsicLabel()
|
||||
label.numberOfLines = 0
|
||||
@@ -80,7 +80,7 @@ class MainFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
label.font = .preferredFont(forTextStyle: .body)
|
||||
return label
|
||||
}()
|
||||
|
||||
|
||||
private let unreadCountView = MainFeedUnreadCountView(frame: CGRect.zero)
|
||||
|
||||
private lazy var disclosureButton: UIButton = {
|
||||
@@ -98,27 +98,27 @@ class MainFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
view.backgroundColor = UIColor.separator
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
private let bottomSeparatorView: UIView = {
|
||||
let view = UIView()
|
||||
view.backgroundColor = UIColor.separator
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
override init(reuseIdentifier: String?) {
|
||||
super.init(reuseIdentifier: reuseIdentifier)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
|
||||
override func sizeThatFits(_ size: CGSize) -> CGSize {
|
||||
let layout = MainFeedTableViewSectionHeaderLayout(cellWidth: size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView)
|
||||
return CGSize(width: bounds.width, height: layout.height)
|
||||
|
||||
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
@@ -137,7 +137,7 @@ private extension MainFeedTableViewSectionHeader {
|
||||
@objc func toggleDisclosure() {
|
||||
delegate?.mainFeedTableViewSectionHeaderDisclosureDidToggle(self)
|
||||
}
|
||||
|
||||
|
||||
func commonInit() {
|
||||
addSubviewAtInit(unreadCountView)
|
||||
addSubviewAtInit(titleView)
|
||||
@@ -147,14 +147,14 @@ private extension MainFeedTableViewSectionHeader {
|
||||
addSubviewAtInit(topSeparatorView)
|
||||
addSubviewAtInit(bottomSeparatorView)
|
||||
}
|
||||
|
||||
|
||||
func updateExpandedState(animate: Bool) {
|
||||
if !isLastSection && self.disclosureExpanded {
|
||||
self.bottomSeparatorView.isHidden = false
|
||||
}
|
||||
|
||||
|
||||
let duration = animate ? 0.3 : 0.0
|
||||
|
||||
|
||||
UIView.animate(
|
||||
withDuration: duration,
|
||||
animations: {
|
||||
@@ -169,7 +169,7 @@ private extension MainFeedTableViewSectionHeader {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
func updateUnreadCountView() {
|
||||
if !disclosureExpanded && unreadCount > 0 {
|
||||
UIView.animate(withDuration: 0.3) {
|
||||
@@ -186,7 +186,7 @@ private extension MainFeedTableViewSectionHeader {
|
||||
contentView.addSubview(view)
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
|
||||
func layoutWith(_ layout: MainFeedTableViewSectionHeaderLayout) {
|
||||
titleView.setFrameIfNotEqual(layout.titleRect)
|
||||
unreadCountView.setFrameIfNotEqual(layout.unreadCountRect)
|
||||
@@ -198,14 +198,14 @@ private extension MainFeedTableViewSectionHeader {
|
||||
|
||||
let top = CGRect(x: x, y: 0, width: width, height: height)
|
||||
topSeparatorView.setFrameIfNotEqual(top)
|
||||
|
||||
|
||||
let bottom = CGRect(x: x, y: frame.height - height, width: width, height: height)
|
||||
bottomSeparatorView.setFrameIfNotEqual(bottom)
|
||||
}
|
||||
|
||||
|
||||
func addBackgroundView() {
|
||||
self.backgroundView = UIView(frame: self.bounds)
|
||||
self.backgroundView?.backgroundColor = AppAssets.sectionHeaderColor
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user