Browse Source

Meeting invites!

pull/101/head
Abhishek 4 years ago
parent
commit
fa7ca265d8
  1. 7
      Clocker/Events and Reminders/CalendarHandler.swift
  2. 9
      Clocker/Overall App/Themer.swift
  3. 14
      Clocker/Panel/ParentPanelController.swift

7
Clocker/Events and Reminders/CalendarHandler.swift

@ -201,7 +201,7 @@ extension EventCenter {
for event in events {
if selectedCalendars.contains(event.event.calendar.calendarIdentifier) {
if filteredEvents[date] == nil {
filteredEvents[date] = []
filteredEvents[date] = Array()
}
filteredEvents[date]?.append(event)
@ -342,7 +342,7 @@ extension EventCenter {
return eventInfo
}
static var dataDetector: NSDataDetector? = nil
static var dataDetector: NSDataDetector?
// Borrowing logic from Ityscal
@discardableResult
@ -356,7 +356,7 @@ extension EventCenter {
if actualLink.contains("zoom.us/j/") || actualLink.contains("zoom.us/s/") || actualLink.contains("zoom.us/w/") {
// Create a Zoom App link
let workspace = NSWorkspace.shared
if (workspace.urlForApplication(toOpen: URL(string: "zoommtg://")!) != nil) {
if workspace.urlForApplication(toOpen: URL(string: "zoommtg://")!) != nil {
actualLink = actualLink.replacingOccurrences(of: "https://", with: "zoommtg://")
actualLink = actualLink.replacingOccurrences(of: "?", with: "&")
actualLink = actualLink.replacingOccurrences(of: "/j/", with: "/join?confno=")
@ -365,7 +365,6 @@ extension EventCenter {
if let appLink = URL(string: actualLink) {
return appLink
}
}
} else if actualLink.contains("zoommtg://")
|| actualLink.contains("meet.google.com/")

9
Clocker/Overall App/Themer.swift

@ -442,6 +442,15 @@ extension Themer {
NSColor(deviceRed: 42.0 / 255.0, green: 55.0 / 255.0, blue: 62.0 / 255.0, alpha: 1.0)
}
func videoCallImage() -> NSImage? {
if #available(macOS 11.0, *) {
let symbolConfig = NSImage.SymbolConfiguration(pointSize: 20, weight: .regular)
return symbolImage(for: "video.circle.fill")?.withSymbolConfiguration(symbolConfig)
} else {
return nil
}
}
func symbolImage(for name: String) -> NSImage? {
assert(name.isEmpty == false)

14
Clocker/Panel/ParentPanelController.swift

@ -696,6 +696,16 @@ class ParentPanelController: NSWindowController {
func removeUpcomingEventView() {
OperationQueue.main.addOperation {
let eventCenter = EventCenter.sharedCenter()
let now = Date()
if let events = eventCenter.eventsForDate[NSCalendar.autoupdatingCurrent.startOfDay(for: now)], events.isEmpty == false {
guard let upcomingEvent = eventCenter.nextOccuring(events), let meetingLink = upcomingEvent.meetingURL else {
return
}
NSWorkspace.shared.open(meetingLink)
return
}
if self.stackView.arrangedSubviews.contains(self.upcomingEventView!), self.upcomingEventView?.isHidden == false {
self.upcomingEventView?.isHidden = true
UserDefaults.standard.set("NO", forKey: CLShowUpcomingEventView)
@ -828,6 +838,10 @@ class ParentPanelController: NSWindowController {
self.setCalendarButtonTitle(buttonTitle: "in \(withoutAgo.lowercased())")
if upcomingEvent.meetingURL != nil {
self.whiteRemoveButton.image = Themer.shared().videoCallImage()
}
if #available(OSX 10.14, *) {
PerfLogger.endMarker("Fetch Calendar Events")
}

Loading…
Cancel
Save