Browse Source

Make upcoming events source optional.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
2bc03f820b
  1. 6
      Clocker/Panel/ParentPanelController.swift

6
Clocker/Panel/ParentPanelController.swift

@ -89,7 +89,7 @@ class ParentPanelController: NSWindowController {
// Upcoming Events // Upcoming Events
@IBOutlet var upcomingEventCollectionView: NSCollectionView! @IBOutlet var upcomingEventCollectionView: NSCollectionView!
@IBOutlet var upcomingEventContainerView: NSView! @IBOutlet var upcomingEventContainerView: NSView!
public var upcomingEventsDataSource: UpcomingEventsDataSource! public var upcomingEventsDataSource: UpcomingEventsDataSource?
var defaultPreferences: [Data] { var defaultPreferences: [Data] {
return DataStore.shared().timezones() return DataStore.shared().timezones()
@ -829,7 +829,7 @@ class ParentPanelController: NSWindowController {
if self.upcomingEventCollectionView != nil, if self.upcomingEventCollectionView != nil,
let upcomingEvents = eventCenter.upcomingEventsForDay(events) let upcomingEvents = eventCenter.upcomingEventsForDay(events)
{ {
self.upcomingEventsDataSource.updateEventsDataSource(upcomingEvents) self.upcomingEventsDataSource?.updateEventsDataSource(upcomingEvents)
self.upcomingEventCollectionView.reloadData() self.upcomingEventCollectionView.reloadData()
return return
} }
@ -840,7 +840,7 @@ class ParentPanelController: NSWindowController {
} }
} else { } else {
if upcomingEventCollectionView != nil { if upcomingEventCollectionView != nil {
upcomingEventsDataSource.updateEventsDataSource([]) upcomingEventsDataSource?.updateEventsDataSource([])
upcomingEventCollectionView.reloadData() upcomingEventCollectionView.reloadData()
return return
} }

Loading…
Cancel
Save