Browse Source

Fixes.

pull/101/head
Abhishek 3 years ago
parent
commit
f02ed01d8b
  1. 4
      Clocker/ClockerUITests/PermissionsTests.swift
  2. 7
      Clocker/Events and Reminders/CalendarHandler.swift
  3. 4
      Clocker/Overall App/Themer.swift
  4. 4
      Clocker/Panel/ParentPanelController.swift
  5. 6
      Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift
  6. 1
      Clocker/Panel/Upcoming Events/UpcomingEventViewItem.xib
  7. 14
      Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

4
Clocker/ClockerUITests/PermissionsTests.swift

@ -15,7 +15,7 @@ class PermissionsTests: XCTestCase {
func testAcceptingCalendarPermissions() {
app.tapMenubarIcon()
app/*@START_MENU_TOKEN@*/.buttons["Preferences"]/*[[".dialogs[\"Clocker Panel\"].buttons[\"Preferences\"]",".buttons[\"Preferences\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.click()
app/*@START_MENU_TOKEN@*/ .buttons["Preferences"]/*[[".dialogs[\"Clocker Panel\"].buttons[\"Preferences\"]",".buttons[\"Preferences\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ .click()
let clockerWindow = app.windows["Clocker"]
@ -53,7 +53,7 @@ class PermissionsTests: XCTestCase {
func testAcceptingRemindersPermissions() {
app.tapMenubarIcon()
app/*@START_MENU_TOKEN@*/.buttons["Preferences"]/*[[".dialogs[\"Clocker Panel\"].buttons[\"Preferences\"]",".buttons[\"Preferences\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.click()
app/*@START_MENU_TOKEN@*/ .buttons["Preferences"]/*[[".dialogs[\"Clocker Panel\"].buttons[\"Preferences\"]",".buttons[\"Preferences\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ .click()
let clockerWindow = app.windows["Clocker"]

7
Clocker/Events and Reminders/CalendarHandler.swift

@ -494,11 +494,8 @@ struct EventInfo {
return "in \(withoutAgo.lowercased())"
} else if event.startDate.isTomorrow {
let timeSince = event.startDate.shortTimeAgoSinceNow
let withoutAn = timeSince.replacingOccurrences(of: "an", with: CLEmptyString)
let withoutAgo = withoutAn.replacingOccurrences(of: "ago", with: CLEmptyString)
return "in \(withoutAgo.lowercased())"
let hoursUntil = event.startDate.hoursUntil
return "in \(hoursUntil)h"
}
return "Error"

4
Clocker/Overall App/Themer.swift

@ -210,8 +210,8 @@ extension Themer {
return
themeIndex == .light
? NSImage(named: NSImage.Name("Settings"))!
: NSImage(named: NSImage.Name("Settings-White"))!
? NSImage(named: NSImage.Name("Settings"))!
: NSImage(named: NSImage.Name("Settings-White"))!
}
func pinImage() -> NSImage {

4
Clocker/Panel/ParentPanelController.swift

@ -310,7 +310,7 @@ class ParentPanelController: NSWindowController {
if eventCenter.calendarAccessGranted() {
// Nice. Events will be retrieved when we open the panel
} else if eventCenter.calendarAccessNotDetermined() {
upcomingEventCollectionView.reloadData()
upcomingEventCollectionView.reloadData()
} else {
removeUpcomingEventView()
}
@ -344,7 +344,7 @@ class ParentPanelController: NSWindowController {
let sharedThemer = Themer.shared()
if upcomingEventContainerView?.isHidden == false {
upcomingEventContainerView?.layer?.backgroundColor = NSColor.clear.cgColor
upcomingEventContainerView?.layer?.backgroundColor = NSColor.clear.cgColor
}
shutdownButton.image = sharedThemer.shutdownImage()

6
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift

@ -9,6 +9,7 @@ class UpcomingEventViewItem: NSCollectionViewItem {
@IBOutlet var leadingConstraint: NSLayoutConstraint!
@IBOutlet var eventTitleLabel: NSTextField!
@IBOutlet var eventSubtitleButton: NSButton!
@IBOutlet var supplementaryButtonWidthConstraint: NSLayoutConstraint!
@IBOutlet var zoomButton: NSButton!
private var meetingLink: URL?
@ -34,8 +35,13 @@ class UpcomingEventViewItem: NSCollectionViewItem {
panelDelegate = delegate
if meetingURL != nil {
zoomButton.isHidden = false
meetingLink = meetingURL
zoomButton.image = Themer.shared().videoCallImage()
supplementaryButtonWidthConstraint.constant = 24.0
} else {
zoomButton.image = nil
supplementaryButtonWidthConstraint.constant = 0.0
}
}

1
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.xib

@ -87,6 +87,7 @@
<outlet property="eventSubtitleButton" destination="Khp-8n-4FA" id="mXV-EZ-2AW"/>
<outlet property="eventTitleLabel" destination="fTt-gC-72b" id="bOh-LO-tiH"/>
<outlet property="leadingConstraint" destination="Myg-8W-znN" id="OUR-Na-THS"/>
<outlet property="supplementaryButtonWidthConstraint" destination="ZRs-Vt-FOM" id="S8K-B3-ZLb"/>
<outlet property="view" destination="Hz6-mo-xeY" id="9S0-wg-csq"/>
<outlet property="zoomButton" destination="qRe-Ao-1fr" id="0IC-Fx-l3Q"/>
</connections>

14
Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

@ -6,6 +6,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
private var upcomingEvents: [EventInfo] = []
private var eventCenter: EventCenter!
private weak var delegate: UpcomingEventPanelDelegate?
private static let panelWidth: CGFloat = 350.0
init(_ panelDelegate: UpcomingEventPanelDelegate?, _ center: EventCenter) {
super.init()
@ -45,14 +46,15 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
func collectionView(_ collectionView: NSCollectionView, layout _: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
if eventCenter.calendarAccessNotDetermined() {
return NSSize(width: collectionView.frame.width - 40, height: collectionView.frame.height - 15)
return NSSize(width: UpcomingEventsDataSource.panelWidth - 25, height: collectionView.frame.height - 15)
} else if upcomingEvents.isEmpty {
return NSSize(width: collectionView.frame.width - 25, height: collectionView.frame.height - 15)
return NSSize(width: UpcomingEventsDataSource.panelWidth - 25, height: collectionView.frame.height - 15)
} else {
let currentEventInfo = upcomingEvents[indexPath.item]
let attributedString = NSAttributedString(string: currentEventInfo.event.title, attributes: [NSAttributedString.Key.font : avenirBookFont])
let maxWidth = max(attributedString.size().width + 60.0, collectionView.frame.width / 2)
return NSSize(width: maxWidth, height: collectionView.frame.height - 15)
let currentEventInfo = upcomingEvents[indexPath.item]
let bufferWidth: CGFloat = currentEventInfo.meetingURL != nil ? 60.0 : 20.0
let attributedString = NSAttributedString(string: currentEventInfo.event.title, attributes: [NSAttributedString.Key.font: avenirBookFont])
let maxWidth = min(attributedString.size().width + bufferWidth, UpcomingEventsDataSource.panelWidth / 2)
return NSSize(width: maxWidth, height: collectionView.frame.height - 20)
}
}
}

Loading…
Cancel
Save