mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-28 01:39:47 +01:00
Skip showing favicons in the timeline when they’re too small to look good.
This commit is contained in:
parent
9e743d0192
commit
5643a51d16
@ -17,7 +17,13 @@ class TimelineTableCellView: NSTableCellView {
|
|||||||
private let unreadIndicatorView = UnreadIndicatorView(frame: NSZeroRect)
|
private let unreadIndicatorView = UnreadIndicatorView(frame: NSZeroRect)
|
||||||
private let dateView = TimelineTableCellView.singleLineTextField()
|
private let dateView = TimelineTableCellView.singleLineTextField()
|
||||||
private let feedNameView = TimelineTableCellView.singleLineTextField()
|
private let feedNameView = TimelineTableCellView.singleLineTextField()
|
||||||
private let avatarImageView = TimelineTableCellView.imageView(with: AppImages.genericFeedImage, scaling: .scaleProportionallyDown)
|
|
||||||
|
private lazy var avatarImageView: NSImageView = {
|
||||||
|
let imageView = TimelineTableCellView.imageView(with: AppImages.genericFeedImage, scaling: .scaleProportionallyDown)
|
||||||
|
imageView.wantsLayer = true
|
||||||
|
return imageView
|
||||||
|
}()
|
||||||
|
|
||||||
private let starView = TimelineTableCellView.imageView(with: AppImages.timelineStar, scaling: .scaleNone)
|
private let starView = TimelineTableCellView.imageView(with: AppImages.timelineStar, scaling: .scaleNone)
|
||||||
|
|
||||||
private lazy var textFields = {
|
private lazy var textFields = {
|
||||||
@ -27,6 +33,7 @@ class TimelineTableCellView: NSTableCellView {
|
|||||||
var cellAppearance: TimelineCellAppearance! {
|
var cellAppearance: TimelineCellAppearance! {
|
||||||
didSet {
|
didSet {
|
||||||
updateTextFields()
|
updateTextFields()
|
||||||
|
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||||
needsLayout = true
|
needsLayout = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,25 +304,26 @@ private extension TimelineTableCellView {
|
|||||||
|
|
||||||
func updateAvatar() {
|
func updateAvatar() {
|
||||||
|
|
||||||
if !cellData.showAvatar {
|
// The avatar should be bigger than a favicon. They’re too small; they look weird.
|
||||||
avatarImageView.image = nil
|
guard let image = cellData.avatar, cellData.showAvatar, image.size.height >= 22.0, image.size.width >= 22.0 else {
|
||||||
hideView(avatarImageView)
|
makeAvatarEmpty()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
showView(avatarImageView)
|
showView(avatarImageView)
|
||||||
|
|
||||||
if let image = cellData.avatar {
|
|
||||||
if avatarImageView.image !== image {
|
if avatarImageView.image !== image {
|
||||||
avatarImageView.image = image
|
avatarImageView.image = image
|
||||||
|
needsLayout = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
avatarImageView.image = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
avatarImageView.wantsLayer = true
|
func makeAvatarEmpty() {
|
||||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
|
||||||
|
if avatarImageView.image != nil {
|
||||||
|
avatarImageView.image = nil
|
||||||
|
needsLayout = true
|
||||||
|
}
|
||||||
|
hideView(avatarImageView)
|
||||||
}
|
}
|
||||||
|
|
||||||
func hideView(_ view: NSView) {
|
func hideView(_ view: NSView) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user