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! {
|
var cellAppearance: TimelineCellAppearance! {
|
||||||
didSet {
|
didSet {
|
||||||
if cellAppearance != oldValue {
|
if cellAppearance != oldValue {
|
||||||
updateTextFieldColors()
|
|
||||||
updateTextFieldFonts()
|
updateTextFieldFonts()
|
||||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||||
needsLayout = true
|
needsLayout = true
|
||||||
|
@ -51,22 +50,6 @@ class TimelineTableCellView: NSTableCellView {
|
||||||
return true
|
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) {
|
override init(frame frameRect: NSRect) {
|
||||||
super.init(frame: frameRect)
|
super.init(frame: frameRect)
|
||||||
commonInit()
|
commonInit()
|
||||||
|
@ -94,7 +77,6 @@ class TimelineTableCellView: NSTableCellView {
|
||||||
override func viewDidMoveToSuperview() {
|
override func viewDidMoveToSuperview() {
|
||||||
|
|
||||||
updateSubviews()
|
updateSubviews()
|
||||||
updateAppearance()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func layout() {
|
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() {
|
func makeTextFieldColorsNormal() {
|
||||||
titleView.textColor = NSColor.labelColor
|
titleView.textColor = NSColor.labelColor
|
||||||
feedNameView.textColor = NSColor.secondaryLabelColor
|
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)
|
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() {
|
func updateTitleView() {
|
||||||
|
|
||||||
updateTextFieldText(titleView, cellData?.title)
|
updateTextFieldText(titleView, cellData?.title)
|
||||||
|
|
|
@ -17,33 +17,8 @@ class UnreadIndicatorView: NSView {
|
||||||
return NSBezierPath(ovalIn: r)
|
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) {
|
override func draw(_ dirtyRect: NSRect) {
|
||||||
|
NSColor.controlAccentColor.setFill()
|
||||||
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()
|
|
||||||
}
|
|
||||||
UnreadIndicatorView.bezierPath.fill()
|
UnreadIndicatorView.bezierPath.fill()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,25 +27,4 @@ class TimelineTableRowView : NSTableRowView {
|
||||||
return nil
|
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