Removed pre Mojave code that sometimes set the timeline fields and indicator to white.
This commit is contained in:
parent
b65d563c7c
commit
3d766f61a0
|
@ -33,7 +33,6 @@ class TimelineTableCellView: NSTableCellView {
|
|||
var cellAppearance: TimelineCellAppearance! {
|
||||
didSet {
|
||||
if cellAppearance != oldValue {
|
||||
updateTextFieldColors()
|
||||
updateTextFieldFonts()
|
||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||
needsLayout = true
|
||||
|
@ -51,22 +50,6 @@ class TimelineTableCellView: NSTableCellView {
|
|||
return true
|
||||
}
|
||||
|
||||
var isEmphasized = false {
|
||||
didSet {
|
||||
unreadIndicatorView.isEmphasized = isEmphasized
|
||||
updateTextFieldColors()
|
||||
needsDisplay = true
|
||||
}
|
||||
}
|
||||
|
||||
var isSelected = false {
|
||||
didSet {
|
||||
unreadIndicatorView.isSelected = isSelected
|
||||
updateTextFieldColors()
|
||||
needsDisplay = true
|
||||
}
|
||||
}
|
||||
|
||||
override init(frame frameRect: NSRect) {
|
||||
super.init(frame: frameRect)
|
||||
commonInit()
|
||||
|
@ -94,7 +77,6 @@ class TimelineTableCellView: NSTableCellView {
|
|||
override func viewDidMoveToSuperview() {
|
||||
|
||||
updateSubviews()
|
||||
updateAppearance()
|
||||
}
|
||||
|
||||
override func layout() {
|
||||
|
@ -164,20 +146,6 @@ private extension TimelineTableCellView {
|
|||
}
|
||||
}
|
||||
|
||||
func updateTextFieldColors() {
|
||||
if #available(macOS 10.14, *) {
|
||||
}
|
||||
else {
|
||||
// Pre-Mojave: manually set colors to white when needed.
|
||||
if isEmphasized && isSelected {
|
||||
textFields.forEach { $0.textColor = NSColor.white }
|
||||
}
|
||||
else {
|
||||
makeTextFieldColorsNormal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func makeTextFieldColorsNormal() {
|
||||
titleView.textColor = NSColor.labelColor
|
||||
feedNameView.textColor = NSColor.secondaryLabelColor
|
||||
|
@ -220,18 +188,6 @@ private extension TimelineTableCellView {
|
|||
return TimelineCellLayout(width: bounds.width, height: bounds.height, cellData: cellData, appearance: cellAppearance, hasAvatar: avatarImageView.image != nil)
|
||||
}
|
||||
|
||||
func updateAppearance() {
|
||||
|
||||
if let rowView = superview as? NSTableRowView {
|
||||
isEmphasized = rowView.isEmphasized
|
||||
isSelected = rowView.isSelected
|
||||
}
|
||||
else {
|
||||
isEmphasized = false
|
||||
isSelected = false
|
||||
}
|
||||
}
|
||||
|
||||
func updateTitleView() {
|
||||
|
||||
updateTextFieldText(titleView, cellData?.title)
|
||||
|
|
|
@ -16,34 +16,9 @@ class UnreadIndicatorView: NSView {
|
|||
let r = NSRect(x: 0.0, y: 0.0, width: unreadCircleDimension, height: unreadCircleDimension)
|
||||
return NSBezierPath(ovalIn: r)
|
||||
}()
|
||||
|
||||
static let unreadCircleColor = appDelegate.currentTheme.color(forKey: "MainWindow.Timeline.cell.unreadCircleColor")
|
||||
|
||||
var isEmphasized = false {
|
||||
didSet {
|
||||
if isEmphasized != oldValue {
|
||||
needsDisplay = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isSelected = false {
|
||||
didSet {
|
||||
if isSelected != oldValue {
|
||||
needsDisplay = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func draw(_ dirtyRect: NSRect) {
|
||||
|
||||
if #available(OSX 10.14, *) {
|
||||
let color = isEmphasized && isSelected ? NSColor.white : NSColor.controlAccentColor
|
||||
color.setFill()
|
||||
} else {
|
||||
let color = isEmphasized && isSelected ? NSColor.white : NSColor.systemBlue
|
||||
color.setFill()
|
||||
}
|
||||
NSColor.controlAccentColor.setFill()
|
||||
UnreadIndicatorView.bezierPath.fill()
|
||||
}
|
||||
|
||||
|
|
|
@ -27,25 +27,4 @@ class TimelineTableRowView : NSTableRowView {
|
|||
return nil
|
||||
}
|
||||
|
||||
override var isEmphasized: Bool {
|
||||
didSet {
|
||||
if #available(macOS 10.14, *) {
|
||||
return
|
||||
}
|
||||
if let cellView = cellView {
|
||||
cellView.isEmphasized = isEmphasized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override var isSelected: Bool {
|
||||
didSet {
|
||||
if #available(macOS 10.14, *) {
|
||||
return
|
||||
}
|
||||
if let cellView = cellView {
|
||||
cellView.isSelected = isSelected
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue