Browse Source

Upcoming Event View v2.0.

pull/101/head
Abhishek 3 years ago
parent
commit
592331248c
  1. 28
      Clocker/Clocker.xcodeproj/project.pbxproj
  2. 3
      Clocker/Clocker.xcodeproj/xcshareddata/xcschemes/Clocker.xcscheme
  3. 147
      Clocker/Clocker/en.lproj/Panel.xib
  4. 12
      Clocker/Events and Reminders/CalendarHandler.swift
  5. 35
      Clocker/Panel/ParentPanelController.swift
  6. 22
      Clocker/Panel/Upcoming Events/ParentPanelController+UpcomingEvents.swift
  7. 22
      Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift
  8. 77
      Clocker/Panel/Upcoming Events/UpcomingEventViewItem.xib
  9. 30
      Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

28
Clocker/Clocker.xcodeproj/project.pbxproj

@ -46,6 +46,10 @@
3531F82226938D7700DF0111 /* GoogleDataTransport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3531F80526938D7700DF0111 /* GoogleDataTransport.framework */; };
3531F82326938D7700DF0111 /* GoogleDataTransport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3531F80526938D7700DF0111 /* GoogleDataTransport.framework */; };
353B5BC52698B78A0023858D /* UpcomingEventStatusItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 353B5BC42698B78A0023858D /* UpcomingEventStatusItemView.swift */; };
3548C45A26BECF1B00AFB533 /* UpcomingEventViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3548C45926BECF1B00AFB533 /* UpcomingEventViewItem.xib */; };
3548C45D26BEEF4C00AFB533 /* ParentPanelController+UpcomingEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3548C45C26BEEF4C00AFB533 /* ParentPanelController+UpcomingEvents.swift */; };
3548C45F26BEEFB400AFB533 /* UpcomingEventsDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3548C45E26BEEFB400AFB533 /* UpcomingEventsDataSource.swift */; };
3548C46126BEEFE400AFB533 /* UpcomingEventViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3548C46026BEEFE400AFB533 /* UpcomingEventViewItem.swift */; };
357391872507277500D30819 /* TimeMarkerViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 357391852507277500D30819 /* TimeMarkerViewItem.swift */; };
357391882507277500D30819 /* HourMarkerViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = 357391862507277500D30819 /* HourMarkerViewItem.xib */; };
3579765E2680208C009DDA6E /* ParentPanelController+ModernSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3579765D2680208C009DDA6E /* ParentPanelController+ModernSlider.swift */; };
@ -119,6 +123,7 @@
35C36FA22259ED6D002FA5C6 /* RemindersHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36F9F2259ED6D002FA5C6 /* RemindersHandler.swift */; };
35C36FA42259EEC2002FA5C6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C36FA32259EEC2002FA5C6 /* AppDelegate.swift */; };
35DFBCEF26A8468900D6648B /* ConfigExport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35DFBCEE26A8468900D6648B /* ConfigExport.swift */; };
35DFBCF126A8479000D6648B /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 35DFBCF026A8479000D6648B /* Keys.plist */; };
35E65125268EDD2E00E3E1E3 /* Toasty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35E65124268EDD2E00E3E1E3 /* Toasty.swift */; };
9A0385BB269E3434003B5E72 /* StandardMenubarHandlerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A0385BA269E3434003B5E72 /* StandardMenubarHandlerTests.swift */; };
9A0385C0269E8891003B5E72 /* PermissionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A0385BF269E8891003B5E72 /* PermissionsTests.swift */; };
@ -272,6 +277,10 @@
3531F80526938D7700DF0111 /* GoogleDataTransport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleDataTransport.framework; path = Frameworks/Firebase/GoogleDataTransport.framework; sourceTree = "<group>"; };
353B5BC42698B78A0023858D /* UpcomingEventStatusItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpcomingEventStatusItemView.swift; sourceTree = "<group>"; };
353B5BC72698D4BB0023858D /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Localizable.strings; sourceTree = "<group>"; };
3548C45926BECF1B00AFB533 /* UpcomingEventViewItem.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UpcomingEventViewItem.xib; sourceTree = "<group>"; };
3548C45C26BEEF4C00AFB533 /* ParentPanelController+UpcomingEvents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ParentPanelController+UpcomingEvents.swift"; sourceTree = "<group>"; };
3548C45E26BEEFB400AFB533 /* UpcomingEventsDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpcomingEventsDataSource.swift; sourceTree = "<group>"; };
3548C46026BEEFE400AFB533 /* UpcomingEventViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpcomingEventViewItem.swift; sourceTree = "<group>"; };
3569A44E25441F320087E254 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };
357391852507277500D30819 /* TimeMarkerViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeMarkerViewItem.swift; sourceTree = "<group>"; };
357391862507277500D30819 /* HourMarkerViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HourMarkerViewItem.xib; sourceTree = "<group>"; };
@ -348,6 +357,7 @@
35C36F9F2259ED6D002FA5C6 /* RemindersHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersHandler.swift; sourceTree = "<group>"; };
35C36FA32259EEC2002FA5C6 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = SOURCE_ROOT; };
35DFBCEE26A8468900D6648B /* ConfigExport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigExport.swift; sourceTree = "<group>"; };
35DFBCF026A8479000D6648B /* Keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Keys.plist; path = ../Internal/Keys.plist; sourceTree = "<group>"; };
35E65124268EDD2E00E3E1E3 /* Toasty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toasty.swift; sourceTree = "<group>"; };
9A0385BA269E3434003B5E72 /* StandardMenubarHandlerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StandardMenubarHandlerTests.swift; sourceTree = "<group>"; };
9A0385BF269E8891003B5E72 /* PermissionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionsTests.swift; sourceTree = "<group>"; };
@ -534,6 +544,17 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
3548C45B26BEEF2100AFB533 /* Upcoming Events */ = {
isa = PBXGroup;
children = (
3548C45C26BEEF4C00AFB533 /* ParentPanelController+UpcomingEvents.swift */,
3548C45E26BEEFB400AFB533 /* UpcomingEventsDataSource.swift */,
3548C46026BEEFE400AFB533 /* UpcomingEventViewItem.swift */,
3548C45926BECF1B00AFB533 /* UpcomingEventViewItem.xib */,
);
path = "Upcoming Events";
sourceTree = "<group>";
};
35C36EB522595834002FA5C6 /* Dependencies */ = {
isa = PBXGroup;
children = (
@ -599,6 +620,7 @@
35C36F242259D64D002FA5C6 /* Panel */ = {
isa = PBXGroup;
children = (
3548C45B26BEEF2100AFB533 /* Upcoming Events */,
35C36F632259DE9D002FA5C6 /* Rate Controller */,
35C36F522259DC9B002FA5C6 /* UI */,
35C36F512259DC85002FA5C6 /* Data Layer */,
@ -889,6 +911,7 @@
DD4F7BF913C30F9F00825C6E = {
isa = PBXGroup;
children = (
35DFBCF026A8479000D6648B /* Keys.plist */,
35B2FEE4259A2C25005DA84D /* CoreModelKit */,
35B2FED4259A2244005DA84D /* CoreLoggerKit */,
35B2FEB1259A1649005DA84D /* StartupKit */,
@ -1200,6 +1223,8 @@
3531F7C226936C6E00DF0111 /* GoogleService-Info.plist in Resources */,
35C36F17225961DA002FA5C6 /* DateTools.bundle in Resources */,
35C36EF322595F14002FA5C6 /* WelcomeView.xib in Resources */,
3548C45A26BECF1B00AFB533 /* UpcomingEventViewItem.xib in Resources */,
35DFBCF126A8479000D6648B /* Keys.plist in Resources */,
35C36EF822595F14002FA5C6 /* Onboarding.storyboard in Resources */,
35C36F612259DE67002FA5C6 /* NotesPopover.xib in Resources */,
9A3169C11D2CC5AA0079FDF8 /* com.abhishek.ClockerHelper.plist in Resources */,
@ -1278,6 +1303,7 @@
35C36F672259DF4C002FA5C6 /* ReviewController.swift in Sources */,
35C36F472259D892002FA5C6 /* Reach.swift in Sources */,
35C36EF222595F14002FA5C6 /* OnboardingWelcomeViewController.swift in Sources */,
3548C45F26BEEFB400AFB533 /* UpcomingEventsDataSource.swift in Sources */,
35C36F732259E1AA002FA5C6 /* FloatingWindowController.swift in Sources */,
35C36F6F2259E185002FA5C6 /* CustomSliderCell.swift in Sources */,
35C36EF122595F14002FA5C6 /* OnboardingPermissionsViewController.swift in Sources */,
@ -1292,6 +1318,7 @@
35C36F16225961DA002FA5C6 /* Date+Inits.swift in Sources */,
35C36F4F2259D981002FA5C6 /* AppDefaults.swift in Sources */,
35C36F5D2259DD96002FA5C6 /* TimezoneDataOperations.swift in Sources */,
3548C45D26BEEF4C00AFB533 /* ParentPanelController+UpcomingEvents.swift in Sources */,
3508CC942599FFEC000E3530 /* MenubarHandler.swift in Sources */,
35C36F14225961DA002FA5C6 /* Integer+DateTools.swift in Sources */,
35C36FA22259ED6D002FA5C6 /* RemindersHandler.swift in Sources */,
@ -1335,6 +1362,7 @@
35C36F2022596253002FA5C6 /* OneWindowController.swift in Sources */,
35C36F0E225961DA002FA5C6 /* Date+Bundle.swift in Sources */,
9AB6F1672259D23200A44663 /* PermissionsViewController.swift in Sources */,
3548C46126BEEFE400AFB533 /* UpcomingEventViewItem.swift in Sources */,
9AB6F1642259D1B900A44663 /* ParentViewController.swift in Sources */,
35C36F1C225961DA002FA5C6 /* TimePeriodChain.swift in Sources */,
3508CCAA259A0027000E3530 /* StatusContainerView.swift in Sources */,

3
Clocker/Clocker.xcodeproj/xcshareddata/xcschemes/Clocker.xcscheme

@ -78,6 +78,9 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableAddressSanitizer = "YES"
enableASanStackUseAfterReturn = "YES"
enableUBSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"

147
Clocker/Clocker/en.lproj/Panel.xib

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="PanelController" customModule="Clocker" customModuleProvider="target">
<connections>
<outlet property="backgroundView" destination="6" id="20"/>
<outlet property="calendarButton" destination="OmF-0e-AfS" id="tok-uM-llD"/>
<outlet property="calendarColorView" destination="KFy-Xe-qhq" id="Qta-Vq-YyP"/>
<outlet property="futureSlider" destination="Vf2-uI-yf3" id="waZ-HW-18U"/>
<outlet property="futureSliderView" destination="C7R-Dq-MFr" id="IsR-aV-vjD"/>
<outlet property="goBackwardsButton" destination="aW8-hr-4Zh" id="EWT-EA-AGP"/>
@ -21,7 +20,6 @@
<outlet property="modernContainerView" destination="8W7-rS-Uob" id="qgZ-SS-ayy"/>
<outlet property="modernSlider" destination="lxA-64-3QU" id="kS5-ub-7gV"/>
<outlet property="modernSliderLabel" destination="e2d-EI-Dm0" id="eby-rL-B21"/>
<outlet property="nextEventLabel" destination="rld-Ag-KL1" id="GTY-j3-A1g"/>
<outlet property="pinButton" destination="YXE-4J-5cn" id="k6V-HK-7XG"/>
<outlet property="preferencesButton" destination="Ctq-BV-GPN" id="cdL-5h-qmx"/>
<outlet property="reviewView" destination="TDn-Kk-KkV" id="YdI-Y4-zrg"/>
@ -32,8 +30,9 @@
<outlet property="shutdownButton" destination="1cR-pI-osG" id="ZFz-9l-yNi"/>
<outlet property="sliderDatePicker" destination="zN8-JF-j7O" id="c06-EE-0kh"/>
<outlet property="stackView" destination="OZA-6o-SbE" id="lIT-4b-8WZ"/>
<outlet property="upcomingEventCollectionView" destination="Tp2-pl-yIm" id="gLE-03-1cZ"/>
<outlet property="upcomingEventContainerView" destination="Akn-cR-W4G" id="1cy-z6-392"/>
<outlet property="upcomingEventView" destination="Akn-cR-W4G" id="SKK-Ai-Vas"/>
<outlet property="whiteRemoveButton" destination="R8q-7U-hbU" id="a9E-WB-pML"/>
<outlet property="window" destination="5" id="7"/>
</connections>
</customObject>
@ -44,7 +43,7 @@
<windowCollectionBehavior key="collectionBehavior" moveToActiveSpace="YES" ignoresCycle="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="1000" y="379" width="350" height="460"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<view key="contentView" focusRingType="none" id="6" customClass="BackgroundPanelView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="350" height="440"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -53,13 +52,13 @@
<rect key="frame" x="0.0" y="0.0" width="350" height="440"/>
<subviews>
<scrollView focusRingType="none" borderType="none" autohidesScrollers="YES" horizontalLineScroll="96" horizontalPageScroll="1" verticalLineScroll="96" verticalPageScroll="1" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" scrollerKnobStyle="light" translatesAutoresizingMaskIntoConstraints="NO" id="4Gd-Nv-fXr">
<rect key="frame" x="-29" y="175" width="379" height="265"/>
<rect key="frame" x="-20" y="175" width="370" height="265"/>
<clipView key="contentView" focusRingType="none" drawsBackground="NO" copiesOnScroll="NO" id="4MZ-Di-yNR">
<rect key="frame" x="0.0" y="0.0" width="379" height="265"/>
<rect key="frame" x="0.0" y="0.0" width="370" height="265"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="95" viewBased="YES" id="dFw-ts-8OZ" customClass="PanelTableView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="379" height="265"/>
<rect key="frame" x="0.0" y="0.0" width="370" height="265"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="1"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -78,11 +77,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="timeZoneCell" id="qbN-ba-fho" customClass="TimezoneCellView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="1" y="0.0" width="338" height="111"/>
<rect key="frame" x="11" y="0.0" width="347" height="111"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" verticalCompressionResistancePriority="749" tag="102" preferredMaxLayoutWidth="72" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QUd-7D-q14">
<rect key="frame" x="28" y="50" width="180" height="22"/>
<rect key="frame" x="28" y="50" width="189" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" identifier="relative-day-height" id="JkG-8f-zhJ"/>
</constraints>
@ -93,7 +92,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" tag="101" preferredMaxLayoutWidth="110" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vnv-J2-7r1">
<rect key="frame" x="206" y="67" width="114" height="35"/>
<rect key="frame" x="215" y="67" width="114" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="35" identifier="height" id="Bwf-I6-2Pc"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="110" id="cQV-gJ-zMz"/>
@ -105,7 +104,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="50" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uOg-ij-alO">
<rect key="frame" x="236" y="49" width="84" height="20"/>
<rect key="frame" x="245" y="49" width="84" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="89H-r0-Dnh"/>
<constraint firstAttribute="width" constant="80" identifier="width" id="8KH-Ks-d4T"/>
@ -117,7 +116,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6At-J8-gzZ">
<rect key="frame" x="28" y="0.0" width="310" height="22"/>
<rect key="frame" x="28" y="0.0" width="319" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="eYP-TP-f1a"/>
</constraints>
@ -128,7 +127,7 @@
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sML-fJ-nbv">
<rect key="frame" x="216" y="49" width="20" height="20"/>
<rect key="frame" x="225" y="49" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="2NE-mf-cN5"/>
<constraint firstAttribute="width" constant="20" id="EXa-Tf-sR6"/>
@ -136,7 +135,7 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageAlignment="right" imageScaling="proportionallyDown" id="cfP-C4-ENJ"/>
</imageView>
<textField verticalHuggingPriority="751" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="751" tag="100" preferredMaxLayoutWidth="150" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="etF-33-bCB">
<rect key="frame" x="28" y="79" width="172" height="20"/>
<rect key="frame" x="28" y="79" width="181" height="20"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" placeholderString="Timezone Name" id="rnh-AP-ooc">
<font key="font" size="15" name="Avenir-Medium"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@ -214,11 +213,11 @@
</connections>
</tableCellView>
<tableCellView identifier="addCell" id="rb3-TW-xSb" customClass="AddTableViewCell" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="1" y="112" width="338" height="100"/>
<rect key="frame" x="11" y="112" width="347" height="100"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AzA-5G-LR7">
<rect key="frame" x="129" y="10" width="80" height="80"/>
<rect key="frame" x="134" y="10" width="80" height="80"/>
<constraints>
<constraint firstAttribute="height" constant="80" id="bRv-Of-5l3"/>
<constraint firstAttribute="width" constant="80" id="cRC-Fx-WLR"/>
@ -263,10 +262,10 @@
</scroller>
</scrollView>
<customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="C7R-Dq-MFr" userLabel="Slider View">
<rect key="frame" x="0.0" y="145" width="350" height="30"/>
<rect key="frame" x="0.0" y="235" width="350" height="30"/>
<subviews>
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Vf2-uI-yf3">
<rect key="frame" x="7" y="6" width="201" height="19"/>
<rect key="frame" x="7" y="2" width="201" height="23"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="cS7-i2-mHU"/>
</constraints>
@ -441,7 +440,7 @@
<rect key="frame" x="75" y="2" width="200" height="21"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WVY-D9-AAX">
<rect key="frame" x="-6" y="-7" width="108" height="32"/>
<rect key="frame" x="-7" y="-7" width="110" height="33"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="4zI-xY-iLf"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="96" id="weK-At-NNy"/>
@ -455,7 +454,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="w3d-CG-aBO">
<rect key="frame" x="98" y="-7" width="108" height="32"/>
<rect key="frame" x="97" y="-6" width="110" height="32"/>
<buttonCell key="cell" type="push" title="Yes!" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="VE1-Cu-JUr">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="Avenir-Light"/>
@ -487,77 +486,41 @@
<customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="Akn-cR-W4G" userLabel="Upcoming Event View" customClass="UpcomingEventView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="0.0" y="40" width="350" height="75"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Etf-aa-udM" customClass="ClockerTextBackgroundView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="10" y="10" width="330" height="55"/>
<subviews>
<button focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OmF-0e-AfS">
<rect key="frame" x="23" y="11" width="267" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="ouD-k5-ZNV"/>
</constraints>
<buttonCell key="cell" type="bevel" title="All Day Event" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingHead" truncatesLastVisibleLine="YES" state="on" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="BRO-ih-6GZ">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="12" name="Avenir-Heavy"/>
</buttonCell>
<accessibility identifier="CalendarAccessory"/>
<connections>
<action selector="calendarButtonAction:" target="-2" id="qH2-O4-fpb"/>
</connections>
</button>
<customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="KFy-Xe-qhq">
<rect key="frame" x="10" y="11" width="3" height="34"/>
<constraints>
<constraint firstAttribute="width" constant="3" id="iW8-dm-8UQ"/>
<constraint firstAttribute="height" constant="34" id="jE3-Wf-6GX"/>
</constraints>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rld-Ag-KL1">
<rect key="frame" x="21" y="26" width="271" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="aer-Hh-Lga"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" title="Nandita Jaiswal's 35th birthday" placeholderString="" id="gWF-HH-zj0">
<font key="font" size="14" name="Avenir-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="1" green="0.5" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" tag="55" translatesAutoresizingMaskIntoConstraints="NO" id="R8q-7U-hbU">
<rect key="frame" x="290" y="10" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="HPk-IL-BH6"/>
<constraint firstAttribute="height" constant="35" id="cKO-Aj-Fq6"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="Remove" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="Qhe-aW-bBW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="dismissNextEventLabel:" target="-2" id="c3V-HV-7OP"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="OmF-0e-AfS" firstAttribute="leading" secondItem="rld-Ag-KL1" secondAttribute="leading" id="78b-Ic-Ont"/>
<constraint firstItem="rld-Ag-KL1" firstAttribute="leading" secondItem="KFy-Xe-qhq" secondAttribute="trailing" constant="10" id="Dbc-Ua-6LK"/>
<constraint firstItem="OmF-0e-AfS" firstAttribute="bottom" secondItem="KFy-Xe-qhq" secondAttribute="bottom" id="EaO-VK-aSp"/>
<constraint firstItem="rld-Ag-KL1" firstAttribute="centerY" secondItem="Etf-aa-udM" secondAttribute="centerY" constant="-10" id="ZL3-an-mCL"/>
<constraint firstItem="R8q-7U-hbU" firstAttribute="centerY" secondItem="Etf-aa-udM" secondAttribute="centerY" id="cZc-vc-rKd"/>
<constraint firstItem="R8q-7U-hbU" firstAttribute="leading" secondItem="rld-Ag-KL1" secondAttribute="trailing" id="d5O-iy-zGi"/>
<constraint firstItem="KFy-Xe-qhq" firstAttribute="centerY" secondItem="Etf-aa-udM" secondAttribute="centerY" id="gjc-cr-6nS"/>
<constraint firstItem="KFy-Xe-qhq" firstAttribute="leading" secondItem="Etf-aa-udM" secondAttribute="leading" constant="10" id="hZu-c0-P4T"/>
<constraint firstItem="R8q-7U-hbU" firstAttribute="leading" secondItem="OmF-0e-AfS" secondAttribute="trailing" id="n3q-Am-kYG"/>
<constraint firstAttribute="trailing" secondItem="R8q-7U-hbU" secondAttribute="trailing" constant="5" id="ysB-dm-dbJ"/>
</constraints>
</customView>
<scrollView wantsLayer="YES" focusRingType="none" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5BT-DM-xru">
<rect key="frame" x="0.0" y="0.0" width="350" height="75"/>
<clipView key="contentView" id="QHw-sR-BYe">
<rect key="frame" x="0.0" y="0.0" width="350" height="75"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView id="Tp2-pl-yIm">
<rect key="frame" x="0.0" y="0.0" width="350" height="75"/>
<autoresizingMask key="autoresizingMask" heightSizable="YES"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" scrollDirection="horizontal" id="g4p-GT-v9Y">
<size key="itemSize" width="50" height="50"/>
<edgeInsets key="sectionInset" left="10" right="0.0" top="0.0" bottom="0.0"/>
</collectionViewFlowLayout>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</collectionView>
</subviews>
<color key="backgroundColor" name="Accent Color"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Akw-Iw-iVY">
<rect key="frame" x="-100" y="-100" width="345" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="MXo-gV-Bdf">
<rect key="frame" x="-100" y="-100" width="16" height="75"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="Etf-aa-udM" secondAttribute="trailing" constant="10" id="6TF-6x-Waq"/>
<constraint firstItem="Etf-aa-udM" firstAttribute="top" secondItem="Akn-cR-W4G" secondAttribute="top" constant="10" id="6Zz-hK-knx"/>
<constraint firstItem="Etf-aa-udM" firstAttribute="leading" secondItem="Akn-cR-W4G" secondAttribute="leading" constant="10" id="JSl-8d-7xg"/>
<constraint firstAttribute="height" constant="75" id="JUg-Of-bAv"/>
<constraint firstAttribute="bottom" secondItem="Etf-aa-udM" secondAttribute="bottom" constant="10" id="ikw-nw-27q"/>
<constraint firstAttribute="bottom" secondItem="5BT-DM-xru" secondAttribute="bottom" id="Kq0-6J-4rc"/>
<constraint firstItem="5BT-DM-xru" firstAttribute="leading" secondItem="Akn-cR-W4G" secondAttribute="leading" id="jCJ-jE-SF5"/>
<constraint firstAttribute="width" constant="350" id="oPv-7I-Y3n"/>
<constraint firstAttribute="trailing" secondItem="5BT-DM-xru" secondAttribute="trailing" id="rIv-zJ-6DJ"/>
<constraint firstItem="5BT-DM-xru" firstAttribute="top" secondItem="Akn-cR-W4G" secondAttribute="top" id="zo2-i3-2uS"/>
</constraints>
<accessibility identifier="UpcomingEventView"/>
</customView>
@ -689,7 +652,9 @@
<image name="Extra" width="700" height="700"/>
<image name="Float-White" width="15" height="13"/>
<image name="PowerIcon" width="350" height="350"/>
<image name="Remove" width="700" height="700"/>
<image name="SharingDarkIcon" width="19" height="22"/>
<namedColor name="Accent Color">
<color red="0.092000000178813934" green="0.0" blue="0.99900001287460327" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>

12
Clocker/Events and Reminders/CalendarHandler.swift

@ -191,6 +191,18 @@ extension EventCenter {
return filteredAllDayEvent
}
func upcomingEventsForDay(_: [EventInfo]) -> [EventInfo]? {
if calendarAccessDenied() || calendarAccessNotDetermined() {
return nil
}
let relevantEvents = filteredEvents[autoupdatingCalendar.startOfDay(for: Date())] ?? []
return relevantEvents.filter {
$0.event.startDate.timeIntervalSinceNow > -300
}
}
func initializeStoreIfNeccesary() {
if eventStore == nil {

35
Clocker/Panel/ParentPanelController.swift

@ -95,6 +95,11 @@ class ParentPanelController: NSWindowController {
@IBOutlet var modernContainerView: ModernSliderContainerView!
@IBOutlet var goBackwardsButton: NSButton!
@IBOutlet var goForwardButton: NSButton!
// Upcoming Events
@IBOutlet var upcomingEventCollectionView: NSCollectionView!
@IBOutlet var upcomingEventContainerView: NSView!
public let upcomingEventsDataSource = UpcomingEventsDataSource()
var defaultPreferences: [Data] {
return DataStore.shared().timezones()
@ -219,6 +224,7 @@ class ParentPanelController: NSWindowController {
}
setupModernSliderIfNeccessary()
setupUpcomingEventViewCollectionViewIfNeccesary()
if roundedDateView != nil {
setupRoundedDateView()
@ -314,11 +320,13 @@ class ParentPanelController: NSWindowController {
if eventCenter.calendarAccessGranted() {
// Nice. Events will be retrieved when we open the panel
} else if eventCenter.calendarAccessNotDetermined() {
nextEventLabel.stringValue = NSLocalizedString("See your next Calendar event here.",
comment: "Next Event Label for no Calendar access")
setCalendarButtonTitle(buttonTitle: NSLocalizedString("Click here to start.",
comment: "Button Title for no Calendar access"))
calendarColorView.layer?.backgroundColor = NSColor(red: 97 / 255.0, green: 194 / 255.0, blue: 80 / 255.0, alpha: 1.0).cgColor
if nextEventLabel != nil {
nextEventLabel.stringValue = NSLocalizedString("See your next Calendar event here.",
comment: "Next Event Label for no Calendar access")
setCalendarButtonTitle(buttonTitle: NSLocalizedString("Click here to start.",
comment: "Button Title for no Calendar access"))
calendarColorView.layer?.backgroundColor = NSColor(red: 97 / 255.0, green: 194 / 255.0, blue: 80 / 255.0, alpha: 1.0).cgColor
}
} else {
removeUpcomingEventView()
}
@ -353,9 +361,6 @@ class ParentPanelController: NSWindowController {
if upcomingEventView?.isHidden == false {
upcomingEventView?.layer?.backgroundColor = NSColor.clear.cgColor
nextEventLabel.textColor = sharedThemer.mainTextColor()
whiteRemoveButton.image = sharedThemer.removeImage()
setCalendarButtonTitle(buttonTitle: calendarButton.title)
}
shutdownButton.image = sharedThemer.shutdownImage()
@ -832,6 +837,14 @@ class ParentPanelController: NSWindowController {
if let events = eventCenter.eventsForDate[NSCalendar.autoupdatingCurrent.startOfDay(for: now)], events.isEmpty == false {
OperationQueue.main.addOperation {
if self.upcomingEventCollectionView != nil,
let upcomingEvents = eventCenter.upcomingEventsForDay(events) {
self.upcomingEventsDataSource.updateEventsDataSource(upcomingEvents)
self.upcomingEventCollectionView.reloadData()
return
}
guard let upcomingEvent = eventCenter.nextOccuring(events) else {
self.setPlaceholdersForUpcomingCalendarView()
if #available(OSX 10.14, *) {
@ -863,6 +876,12 @@ class ParentPanelController: NSWindowController {
}
}
} else {
if self.upcomingEventCollectionView != nil {
self.upcomingEventsDataSource.updateEventsDataSource([])
self.upcomingEventCollectionView.reloadData()
return
}
setPlaceholdersForUpcomingCalendarView()
if #available(OSX 10.14, *) {
PerfLogger.endMarker("Fetch Calendar Events")

22
Clocker/Panel/Upcoming Events/ParentPanelController+UpcomingEvents.swift

@ -0,0 +1,22 @@
// Copyright © 2015 Abhishek Banthia
import Foundation
var avenirLightFont: NSFont {
if let avenirFont = NSFont(name: "Avenir-Light", size: 12) {
return avenirFont
}
return NSFont.systemFont(ofSize: 12)
}
extension ParentPanelController {
func setupUpcomingEventViewCollectionViewIfNeccesary() {
if upcomingEventCollectionView != nil {
upcomingEventCollectionView.enclosingScrollView?.scrollerInsets = NSEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
upcomingEventCollectionView.enclosingScrollView?.backgroundColor = NSColor.clear
upcomingEventCollectionView.setAccessibility("UpcomingEventCollectionView")
upcomingEventCollectionView.dataSource = upcomingEventsDataSource
upcomingEventCollectionView.delegate = upcomingEventsDataSource
}
}
}

22
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift

@ -0,0 +1,22 @@
// Copyright © 2015 Abhishek Banthia
import Foundation
class UpcomingEventViewItem: NSCollectionViewItem {
static let reuseIdentifier = NSUserInterfaceItemIdentifier("UpcomingEventViewItem")
@IBOutlet weak var calendarColorView: NSView!
@IBOutlet weak var eventTitleLabel: NSTextField!
@IBOutlet weak var eventSubtitleLabel: NSButton!
func setup(_ title: String, _ subtitle: String, _ color: NSColor) {
calendarColorView.layer?.backgroundColor = color.cgColor
eventTitleLabel.stringValue = title
eventSubtitleLabel.stringValue = subtitle
}
override var acceptsFirstResponder: Bool {
return false
}
}

77
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.xib

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="250" height="75"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="aM6-TI-1os" customClass="ClockerTextBackgroundView" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="250" height="75"/>
<subviews>
<button focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Khp-8n-4FA">
<rect key="frame" x="16" y="21" width="232" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="asu-Dd-XhW"/>
</constraints>
<buttonCell key="cell" type="bevel" title="All Day Event" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingHead" truncatesLastVisibleLine="YES" state="on" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="JOt-0Q-EAr">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="10" name="Avenir-Heavy"/>
</buttonCell>
</button>
<customView wantsLayer="YES" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="Bbu-oG-vAb">
<rect key="frame" x="5" y="21" width="2" height="34"/>
<constraints>
<constraint firstAttribute="width" constant="2" id="Qhx-45-1Hc"/>
<constraint firstAttribute="height" constant="34" id="xeh-m2-Fhh"/>
</constraints>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fTt-gC-72b">
<rect key="frame" x="15" y="31" width="235" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="BA4-1v-xiZ"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" title="Nandita Jaiswal's 35th birthday" placeholderString="" id="Dtv-o3-gqd">
<font key="font" size="12" name="Avenir-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="1" green="0.5" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="fTt-gC-72b" firstAttribute="top" secondItem="Bbu-oG-vAb" secondAttribute="top" id="FeN-R0-t1A"/>
<constraint firstItem="Khp-8n-4FA" firstAttribute="bottom" secondItem="Bbu-oG-vAb" secondAttribute="bottom" id="LQD-54-bUh"/>
<constraint firstItem="Bbu-oG-vAb" firstAttribute="leading" secondItem="aM6-TI-1os" secondAttribute="leading" constant="5" id="Myg-8W-znN"/>
<constraint firstItem="Khp-8n-4FA" firstAttribute="trailing" secondItem="fTt-gC-72b" secondAttribute="trailing" id="URW-gt-WbF"/>
<constraint firstAttribute="trailing" secondItem="fTt-gC-72b" secondAttribute="trailing" constant="2" id="UmL-0o-BVG"/>
<constraint firstItem="Khp-8n-4FA" firstAttribute="leading" secondItem="fTt-gC-72b" secondAttribute="leading" constant="-1" id="VyL-Kt-2aT"/>
<constraint firstItem="fTt-gC-72b" firstAttribute="leading" secondItem="Bbu-oG-vAb" secondAttribute="trailing" constant="10" id="arv-Oe-yih"/>
<constraint firstItem="Bbu-oG-vAb" firstAttribute="centerY" secondItem="aM6-TI-1os" secondAttribute="centerY" id="wkl-Vo-0kU"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="aM6-TI-1os" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="2AJ-xz-nf9"/>
<constraint firstItem="aM6-TI-1os" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="D6T-PQ-RdE"/>
<constraint firstAttribute="bottom" secondItem="aM6-TI-1os" secondAttribute="bottom" id="DmC-7T-lrT"/>
<constraint firstAttribute="trailing" secondItem="aM6-TI-1os" secondAttribute="trailing" id="aCZ-sV-Mnd"/>
</constraints>
<point key="canvasLocation" x="147" y="239"/>
</customView>
<customObject id="p0M-E4-898" customClass="UpcomingEventViewItem" customModule="Clocker" customModuleProvider="target">
<connections>
<outlet property="calendarColorView" destination="Bbu-oG-vAb" id="tBe-V1-qmC"/>
<outlet property="eventSubtitleLabel" destination="Khp-8n-4FA" id="mXV-EZ-2AW"/>
<outlet property="eventTitleLabel" destination="fTt-gC-72b" id="bOh-LO-tiH"/>
<outlet property="view" destination="Hz6-mo-xeY" id="9S0-wg-csq"/>
</connections>
</customObject>
</objects>
</document>

30
Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

@ -0,0 +1,30 @@
// Copyright © 2015 Abhishek Banthia
import Foundation
class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollectionViewDelegateFlowLayout {
private var upcomingEvents: [EventInfo] = []
func updateEventsDataSource(_ events: [EventInfo]) {
upcomingEvents = events
}
func collectionView(_: NSCollectionView, numberOfItemsInSection _: Int) -> Int {
return upcomingEvents.count
}
func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
let item = collectionView.makeItem(withIdentifier: UpcomingEventViewItem.reuseIdentifier, for: indexPath) as! UpcomingEventViewItem
let currentEventInfo = upcomingEvents[indexPath.item]
let upcomingEventSubtitle = currentEventInfo.isAllDay ? "All-Day" : currentEventInfo.metadataForMeeting()
item.setup(currentEventInfo.event.title, upcomingEventSubtitle, currentEventInfo.event.calendar.color)
return item
}
func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
let currentEventInfo = upcomingEvents[indexPath.item]
let prefferedSize = avenirLightFont.size(currentEventInfo.event.title, 250, attributes: [NSAttributedString.Key.font: avenirLightFont,])
return NSSize(width: prefferedSize.width, height: 50)
}
}
Loading…
Cancel
Save