Browse Source

Conform UpcomingEventStatusItemView to StatusItemViewConforming.

pull/113/head
Abhishek 3 years ago
parent
commit
34aba40bc7
  1. 21
      Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

21
Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

@ -71,10 +71,16 @@ class UpcomingEventStatusItemView: NSView {
} }
private func initialSetup() { private func initialSetup() {
nextEventField.attributedStringValue = NSAttributedString(string: "Next Event", attributes: textFontAttributes) nextEventField.attributedStringValue = NSAttributedString(string: dataObject.event.title, attributes: textFontAttributes)
etaField.attributedStringValue = NSAttributedString(string: dataObject.metadataForMeeting(), attributes: timeAttributes) etaField.attributedStringValue = NSAttributedString(string: dataObject.metadataForMeeting(), attributes: timeAttributes)
} }
@available(OSX 10.14, *)
override func viewDidChangeEffectiveAppearance() {
super.viewDidChangeEffectiveAppearance()
statusItemViewSetNeedsDisplay()
}
func updateWithNextEventInfo(_ metadata: String) { func updateWithNextEventInfo(_ metadata: String) {
nextEventField.attributedStringValue = NSAttributedString(string: "Next Event", attributes: textFontAttributes) nextEventField.attributedStringValue = NSAttributedString(string: "Next Event", attributes: textFontAttributes)
etaField.attributedStringValue = NSAttributedString(string: metadata, attributes: timeAttributes) etaField.attributedStringValue = NSAttributedString(string: metadata, attributes: timeAttributes)
@ -89,3 +95,16 @@ class UpcomingEventStatusItemView: NSView {
mainDelegate.togglePanel(event) mainDelegate.togglePanel(event)
} }
} }
extension UpcomingEventStatusItemView: StatusItemViewConforming {
func statusItemViewSetNeedsDisplay() {
nextEventField.attributedStringValue = NSAttributedString(string: dataObject.event.title, attributes: textFontAttributes)
etaField.attributedStringValue = NSAttributedString(string: dataObject.metadataForMeeting(), attributes: timeAttributes)
}
func statusItemViewIdentifier() -> String {
return "upcoming_event_view"
}
}

Loading…
Cancel
Save