mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-26 17:43:22 +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 dateView = 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 lazy var textFields = {
|
||||
@ -27,6 +33,7 @@ class TimelineTableCellView: NSTableCellView {
|
||||
var cellAppearance: TimelineCellAppearance! {
|
||||
didSet {
|
||||
updateTextFields()
|
||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||
needsLayout = true
|
||||
}
|
||||
}
|
||||
@ -297,25 +304,26 @@ private extension TimelineTableCellView {
|
||||
|
||||
func updateAvatar() {
|
||||
|
||||
if !cellData.showAvatar {
|
||||
avatarImageView.image = nil
|
||||
hideView(avatarImageView)
|
||||
// The avatar should be bigger than a favicon. They’re too small; they look weird.
|
||||
guard let image = cellData.avatar, cellData.showAvatar, image.size.height >= 22.0, image.size.width >= 22.0 else {
|
||||
makeAvatarEmpty()
|
||||
return
|
||||
}
|
||||
|
||||
showView(avatarImageView)
|
||||
|
||||
if let image = cellData.avatar {
|
||||
if avatarImageView.image !== image {
|
||||
avatarImageView.image = image
|
||||
}
|
||||
if avatarImageView.image !== image {
|
||||
avatarImageView.image = image
|
||||
needsLayout = true
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
func makeAvatarEmpty() {
|
||||
|
||||
if avatarImageView.image != nil {
|
||||
avatarImageView.image = nil
|
||||
needsLayout = true
|
||||
}
|
||||
|
||||
avatarImageView.wantsLayer = true
|
||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||
hideView(avatarImageView)
|
||||
}
|
||||
|
||||
func hideView(_ view: NSView) {
|
||||
|
Loading…
Reference in New Issue
Block a user