Browse Source

Include Croatian localization + minor tweaks!

pull/101/head
Abhishek 3 years ago
parent
commit
ed9f4f7b78
  1. 27
      Clocker/Clocker.xcodeproj/project.pbxproj
  2. 165
      Clocker/Clocker/hr.lproj/Localizable.strings
  3. 2
      Clocker/Events and Reminders/CalendarHandler.swift
  4. 89
      Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

27
Clocker/Clocker.xcodeproj/project.pbxproj

@ -21,7 +21,6 @@
3531F7F026936DE900DF0111 /* upload-symbols in Resources */ = {isa = PBXBuildFile; fileRef = 3531F7EC26936DE900DF0111 /* upload-symbols */; };
3531F7F126936DE900DF0111 /* upload-symbols in Resources */ = {isa = PBXBuildFile; fileRef = 3531F7EC26936DE900DF0111 /* upload-symbols */; };
3531F7F226936DE900DF0111 /* upload-symbols in Resources */ = {isa = PBXBuildFile; fileRef = 3531F7EC26936DE900DF0111 /* upload-symbols */; };
3531F7F52693882300DF0111 /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3531F7F42693882300DF0111 /* Keys.plist */; };
3531F7F72693882300DF0111 /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3531F7F42693882300DF0111 /* Keys.plist */; };
3531F80626938D7700DF0111 /* GoogleUtilities.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3531F7FC26938D7600DF0111 /* GoogleUtilities.framework */; };
3531F80726938D7700DF0111 /* GoogleUtilities.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3531F7FC26938D7600DF0111 /* GoogleUtilities.framework */; };
@ -53,6 +52,7 @@
3531F82126938D7700DF0111 /* GoogleDataTransport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3531F80526938D7700DF0111 /* GoogleDataTransport.framework */; };
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 */; };
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 */; };
@ -164,8 +164,6 @@
9AB6F1642259D1B900A44663 /* ParentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AB6F1632259D1B800A44663 /* ParentViewController.swift */; };
9AB6F1672259D23200A44663 /* PermissionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AB6F1662259D23200A44663 /* PermissionsViewController.swift */; };
9AB89E031CE97A4900EC8EB1 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9AB89E021CE97A4900EC8EB1 /* Media.xcassets */; };
9ABF454E268FCF10002C779B /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9ABF454D268FCF10002C779B /* Keys.plist */; };
9ABF454F268FCF10002C779B /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9ABF454D268FCF10002C779B /* Keys.plist */; };
9ABF455B268FDABA002C779B /* CopyToClipboardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABF4559268FDABA002C779B /* CopyToClipboardTests.swift */; };
9ABFB3801CA6882000E10745 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9ABFB37F1CA6882000E10745 /* ApplicationServices.framework */; };
9AC678E41C1ABAB9003B4F6B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AC678E31C1ABAB9003B4F6B /* QuartzCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
@ -279,6 +277,8 @@
3531F80326938D7700DF0111 /* FirebaseInstallations.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FirebaseInstallations.framework; path = Frameworks/Firebase/FirebaseInstallations.framework; sourceTree = "<group>"; };
3531F80426938D7700DF0111 /* leveldb-library.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "leveldb-library.framework"; path = "Frameworks/Firebase/leveldb-library.framework"; sourceTree = "<group>"; };
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>"; };
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>"; };
@ -430,7 +430,6 @@
9AB6F1632259D1B800A44663 /* ParentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParentViewController.swift; sourceTree = "<group>"; };
9AB6F1662259D23200A44663 /* PermissionsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PermissionsViewController.swift; sourceTree = "<group>"; };
9AB89E021CE97A4900EC8EB1 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = "<group>"; };
9ABF454D268FCF10002C779B /* Keys.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Keys.plist; path = Internal/Keys.plist; sourceTree = "<group>"; };
9ABF4559268FDABA002C779B /* CopyToClipboardTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CopyToClipboardTests.swift; sourceTree = "<group>"; };
9ABFB37F1CA6882000E10745 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
9AC678E31C1ABAB9003B4F6B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
@ -556,6 +555,7 @@
3508CC99259A0001000E3530 /* StatusItemView.swift */,
3508CC9E259A000E000E3530 /* StatusItemHandler.swift */,
3508CCA9259A0027000E3530 /* StatusContainerView.swift */,
353B5BC42698B78A0023858D /* UpcomingEventStatusItemView.swift */,
);
path = "Menu Bar";
sourceTree = "<group>";
@ -890,7 +890,6 @@
DD4F7BF913C30F9F00825C6E = {
isa = PBXGroup;
children = (
9ABF454D268FCF10002C779B /* Keys.plist */,
35B2FEE4259A2C25005DA84D /* CoreModelKit */,
35B2FED4259A2244005DA84D /* CoreLoggerKit */,
35B2FEB1259A1649005DA84D /* StartupKit */,
@ -1120,6 +1119,7 @@
ar,
"pt-BR",
"zh-Hant",
hr,
);
mainGroup = DD4F7BF913C30F9F00825C6E;
productRefGroup = DD4F7C0513C30F9F00825C6E /* Products */;
@ -1184,7 +1184,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9ABF454F268FCF10002C779B /* Keys.plist in Resources */,
3531F7EE26936DE900DF0111 /* run in Resources */,
9A8B256A232EFAD300204CAD /* Localizable.strings in Resources */,
9AA522C023415BDD00C9E005 /* InfoPlist.strings in Resources */,
@ -1197,7 +1196,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9ABF454E268FCF10002C779B /* Keys.plist in Resources */,
9A13BAEA1CA88A76007C6CBE /* Localizable.strings in Resources */,
357391882507277500D30819 /* HourMarkerViewItem.xib in Resources */,
9AB6F15E2259D08300A44663 /* iVersion.bundle in Resources */,
@ -1205,7 +1203,6 @@
3531F7ED26936DE900DF0111 /* run in Resources */,
9A13BAE01CA882FA007C6CBE /* InfoPlist.strings in Resources */,
35C36F912259EAF4002FA5C6 /* Preferences.storyboard in Resources */,
3531F7F52693882300DF0111 /* Keys.plist in Resources */,
9AB89E031CE97A4900EC8EB1 /* Media.xcassets in Resources */,
9A13BAD61CA87F08007C6CBE /* Panel.xib in Resources */,
35C36F6B2259E0E1002FA5C6 /* FloatingWindow.xib in Resources */,
@ -1329,6 +1326,7 @@
35C36F582259DD8A002FA5C6 /* PanelTableView.swift in Sources */,
35C36F0F225961DA002FA5C6 /* TimePeriodCollection.swift in Sources */,
35C36F18225961DA002FA5C6 /* Date+Comparators.swift in Sources */,
353B5BC52698B78A0023858D /* UpcomingEventStatusItemView.swift in Sources */,
35C36FA02259ED6D002FA5C6 /* CalendarHandler.swift in Sources */,
35C36F1A225961DA002FA5C6 /* Date+Manipulations.swift in Sources */,
35C36F572259DD8A002FA5C6 /* TimezoneDataSource.swift in Sources */,
@ -1438,6 +1436,7 @@
9AA522D723416E6000C9E005 /* it */,
3569A44E25441F320087E254 /* pt-BR */,
35A6A4B925C5DEF300356073 /* zh-Hant */,
353B5BC72698D4BB0023858D /* hr */,
);
name = Localizable.strings;
path = Clocker;
@ -1551,7 +1550,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 95;
CURRENT_PROJECT_VERSION = 96;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
@ -1584,7 +1583,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 21.07.02;
MARKETING_VERSION = 21.07.03;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.abhishek.Clocker;
@ -2120,7 +2119,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 95;
CURRENT_PROJECT_VERSION = 96;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
@ -2154,7 +2153,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 21.07.02;
MARKETING_VERSION = 21.07.03;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
"OTHER_SWIFT_FLAGS[arch=*]" = "-D DEBUG";
@ -2202,7 +2201,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 95;
CURRENT_PROJECT_VERSION = 96;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
@ -2235,7 +2234,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 21.07.02;
MARKETING_VERSION = 21.07.03;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
"OTHER_SWIFT_FLAGS[arch=*]" = "-D RELEASE";

165
Clocker/Clocker/hr.lproj/Localizable.strings

@ -0,0 +1,165 @@
/*
Localizable.strings
Clocker
Created by Abhishek Banthia on 7/9/21.
*/
"CFBundleDisplayName" = "Clocker";
"Thank you for helping make Clocker even better!" = "Hvala što pomažeš poboljšati Clocker!";
"iRateMessageTitle" = "Ocijeni %@";
"iRateAppMessage" = "Ako voliš koristiti %@, ocijeni program. Postupak ocjenjivanja traje manje od jedne minute. Hvala na podršci!";
"iRateGameMessage" = "Ako voliš igrati %@, ocijeni program. Postupak ocjenjivanja traje manje od jedne minute. Hvala na podršci!";
"iRateCancelButton" = "Ne, hvala";
"iRateRateButton" = "Ocijeni";
"iRateRemindButton" = "Podsjeti me kasnije";
"iRateUpdateMessage" = "Sada aktualizirati?";
"ClockerVersion" = "Verzija %@";
"CLFeedbackAlertTitle" = "Hvala što pomažeš poboljšati Clocker!";
"app-name" = "Clocker";
"start-at-login" = "Pokreni nakon prijave";
"setup-steps" = "Za postavljanje programa Clocker potrebna su samo tri koraka";
"Permissions-Header" = "Dozvole";
"See your next Calendar event here." = "Ovdje pogledaj svoje sljedeće kalendarske događaje.";
"Click here to start." = "Pritisni ovdje za pokretanje.";
"Reminders Access" = "Pristup podsjetnicima";
"Calendar Access" = "Pristup kalendaru";
"Permissions" = "Dozvole";
"Calendar Detail" = "Predstojeći događaji iz tvojih osobnih i zajedničkih kalendara mogu se prikazati u traci izbornika i na ploči.";
"Reminders Detail" = "Postavi podsjetnike u tvoju vremensku zonu mjesta. Tvoji se podsjetnici spremaju u standardni program Podsjetnici.";
"Privacy Text" = "Ovo možeš kasnije promijeniti u odjeljku Privatnost u Postavkama sustava.";
"Granted Button Text" = "Dozvoljeno";
"Denied Button Text" = "Zabranjeno";
"Grant Button Text" = "Dozvoli";
// Welcome Onboarding
"It only takes 3 steps to setup Clocker." = "Za postavljanje programa Clocker potrebna su samo tri koraka.";
"Get Started" = "PoÄŤetak";
// Tab Item Titles
"Preferences Tab" = "Postavke";
"Appearance Tab" = "Izgled";
"Calendar Tab" = "Kalendar";
"About Tab" = "Informacije";
"Permissions Tab" = "Dozvole";
// General Preferences Screen
"Start at Login" = "Pokreni Clocker nakon prijave";
"Sort by Time Difference" = "Razvrstaj po vremenskoj ralzici";
"Sort by Name" = "Razvrstaj po imenu";
"Sort by Label" = "Razvrstaj po oznaci";
"Search Field Placeholder" = "Upiši grad, državu ili zemlju";
"No Timezone Selected" = "Odaberi vremensku zonu!";
"Max Timezones Selected" = "OgraniÄŤeno na 100 vremenskih zona!";
"Max Search Characters" = "OgraniÄŤeno na 50 znakova!";
"Add Button Title" = "Dodaj";
"Close Button Title" = "Zatvori";
// Onboarding
"Open Clocker At Login" = "Otvori Clocker nakon prijave";
"Launch Clocker" = "Pokreni Clocker";
// Welcome Onboarding
"It only takes 3 steps to set up Clocker." = "Za postavljanje programa Clocker potrebna su samo tri koraka.";
"Get Started" = "PoÄŤetak";
// Permissions
"Calendar Access Title" = "Pristup kalendaru";
"Reminders Access Title" = "Pristup podsjetnicima";
"Later Config Description" = "Mogu se kasnije konfigurirati u postavkama sustava.";
"Back" = "Natrag";
"Continue" = "Nastavi";
"Clocker is more useful when it can display events from your calendars." = "Clocker je korisniji kad može prikazivati događaje u tvojim kalendarima.";
"Clocker is more useful when it can display events from your calendars. You can change this setting in System Preferences › Security & Privacy › Privacy." = "Clocker je korisniji kad može prikazivati događaje u tvojim kalendarima. Ovu postavku možeš promijeniti u Postavke sustava › Sigurnost i privatnost › Privatnost.";
/* Text for button that takes the user to the System Preferences app. In case the user hasn't given Calendar/Reminders access permission, this button takes you to the System Preferences app where the user can give proper permissions to Clocker. */
"Launch Preferences" = "Pokreni postavke";
"Grant Access" = "Dopusti pristup";
"Upcoming events from your personal and shared calendars can be shown in the menubar and the panel." = "Predstojeći događaji iz tvojih osobnih i zajedničkih kalendara mogu se prikazati u traci izbornika i na ploči.";
"Granted" = "Dodijeljeno";
"Denied" = "Odbijeno";
"Grant" = "Odobrenje";
"Unexpected" = "NeoÄŤekivano";
// Onboarding Search
"Quick Add Locations" = "Brzo dodavanje mjesta";
"More search options in Clocker Preferences." = "Daljnje opcije pretage u Clocker postavkama.";
"Enter 3 or more characters for locations you'll like to add" = "Upiši tri ili više znakova za mjesta koja želiš dodati";
// Start at Login
"Launch at Login" = "Pokreni nakon prijave";
"This can be configured later in Clocker Preferences." = "Ovo se moĹľe kasnije konfigurirati u Clocker postavkama.";
"Should Clocker open automatically on startup?" = "Želiš li automatski pokrenuti Clocker nakon pokretanja računala?";
// Final Onboarding Screen
"You're all set!" = "Sve je spremno!";
"Thank you for the details." = "Hvala ti na detalju.";
"You'll see a clock icon in your Menu Bar when you launch the app. If you'd like to see a dock icon, go to Preferences." = "Kad pokreneš program, u traci izbornika vidjet ćeš ikonu sata. Ako želiš vidjeti ikonu u traci programa, idi na Postavke.";
"If you'd like to help us localize the app in your language or receive infrequent app-related updates, please enter your email!" = "Ako želiš pomoći prevesti program na tvoj jezik ili primati rijetke obavijesti o novim verzijama programa, upiši tvoju e-mail adresu!";
// Appearance Tab
"Panel Theme" = "Tema ploÄŤe";
"Favourite a timezone to enable menubar display options." = "Odaberi vremensku zonu za aktiviranje opcija prikaza trake izbornika.";
"Main Panel Options" = "Opcije glavne ploÄŤe";
"Time Format" = "Format za vrijeme";
"Day Display Options" = "Opcije za prikaz dana";
"Show Future Slider" = "Prikaži klizač budućnosti";
"Show Sunrise/Sunset" = "PrikaĹľi izlazak/zalazak sunca";
"Display the time in seconds" = "PrikaĹľi vrijeme u sekundama";
"Larger Text" = "Veći tekst";
"Future Slider Range" = "Klizač za raspon budućnosti";
"Include Date" = "UkljuÄŤi datum";
"Include Day" = "UkljuÄŤi dan";
"Include Place Name" = "UkljuÄŤi ime mjesta";
"Menubar Display Options" = "Opcije prikaza izbornika";
/* Appears in Preferences -> Appearance which allows the user to switch between the compact and standard menubar mode. It doesn't lead anywhere. */
"Menubar Mode" = "Modus izbornika";
"Preview" = " Pregled";
"Miscellaneous" = "Razno";
// Empty View
"No places added" = "Nema dodanih mjesta";
// Panel
"No upcoming event." = "Nema predstojećih događaja.";
"You have no events scheduled for tomorrow." = "Za sutra nemaš zakazanih događaja.";
// Review
"Enjoy using Clocker?" = "Voliš Clocker?";
// App Feedback
"Tell us what you think!" = "Javi nam što misliš!";
"Contact Information (Optional)" = "Kontaktni podaci (opcionalno)";
"Contact fields are optional! Your contact information will let us contact you in case we need more information or can help!" = "Polja za kontakt nisu obavezna! Tvoji kontaktni podaci omogućit će nam da te kontaktiramo u slučaju da trebamo daljnje informacije ili ako možemo pomoći!";
// About View Screen
"Feedback is always welcome:" = "Uvijek se radujemo povratnim informacijama:";
// Calendars View
"Upcoming Event View Options" = "Opcije prikaza predstojećih događaja";
"Show Upcoming Event View" = "Prikaži prikaz predstojećih događaja";
"Show All Day Meetings" = "PrikaĹľi cjelodnevne sastanke";
"Show Next Meeting Title in Menubar" = "Prikaži sljedeći sastanak u traci izbornika";
"Truncate menubar text longer than" = "Skrati tekst izbone trake koji je duĹľi od";
"characters" = "znakova";
"Show events from" = "Prikaži događaje od";
"If meeting title is \"Meeting with Neel\" and truncate length is set to 5, text in menubar will appear as \"Meeti...\"" = "Ako je naslov sastanka „Sastanak s Vladimirom”, a kraćenje je postavljeno na 5, tekst na traci pojavit će se kao „Sasta …”";
// Notes Popover
"Reminder Set" = "Postavljanje podsjetnika";
"Successfully set." = "Uspješno postavljeno.";
// Errors
"You're offline, maybe?" = "Možda nemaš vezu s internetom?";
"Try again, maybe?" = "Želiš li ponovo pokušati?";
"The Internet connection appears to be offline." = "ÄŚini se da ne postoji veza s internetom.";
// UI Tests
"New Zealand" = "Novi Zeland";
"Florida" = "Florida";
"San Francisco" = "San Francisco";
// DST changes
"Daylights Saving transition will occur in < 24 hours" = "Daylights Saving transition will occur in < 24 hours";
"Copied to Clipboard" = "Copied to Clipboard";

2
Clocker/Events and Reminders/CalendarHandler.swift

@ -428,7 +428,7 @@ struct EventInfo {
func metadataForMeeting() -> String {
let timeIntervalSinceNowForMeeting = event.startDate.timeIntervalSinceNow
if (timeIntervalSinceNowForMeeting < 0 && timeIntervalSinceNowForMeeting > -300) {
return "Event began \(event.startDate.shortTimeAgoSinceNow) ago."
return "started \(event.startDate.shortTimeAgoSinceNow) ago."
} else {
let timeSince = Date().timeAgo(since: event.startDate)
let withoutAn = timeSince.replacingOccurrences(of: "an", with: CLEmptyString)

89
Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

@ -0,0 +1,89 @@
// Copyright © 2015 Abhishek Banthia
import Foundation
import AppKit
class UpcomingEventStatusItemView: NSView {
static let containerWidth = 70
private let nextEventField = NSTextField(labelWithString: "Next Event")
private let etaField = NSTextField(labelWithString: "5 mins")
var dataObject: EventInfo! {
didSet {
initialSetup()
}
}
private var timeAttributes: [NSAttributedString.Key: AnyObject] {
let textColor = hasDarkAppearance ? NSColor.white : NSColor.black
let attributes = [
NSAttributedString.Key.font: compactModeTimeFont,
NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle,
]
return attributes
}
private var textFontAttributes: [NSAttributedString.Key: Any] {
let textColor = hasDarkAppearance ? NSColor.white : NSColor.black
let textFontAttributes = [
NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 10),
NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle,
]
return textFontAttributes
}
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
[etaField, nextEventField].forEach {
$0.wantsLayer = true
$0.applyDefaultStyle()
$0.translatesAutoresizingMaskIntoConstraints = false
addSubview($0)
}
etaField.disableWrapping()
NSLayoutConstraint.activate([
nextEventField.leadingAnchor.constraint(equalTo: leadingAnchor),
nextEventField.trailingAnchor.constraint(equalTo: trailingAnchor),
nextEventField.topAnchor.constraint(equalTo: topAnchor, constant: 7),
nextEventField.heightAnchor.constraint(equalTo: heightAnchor, multiplier: 0.35),
])
NSLayoutConstraint.activate([
etaField.leadingAnchor.constraint(equalTo: leadingAnchor),
etaField.trailingAnchor.constraint(equalTo: trailingAnchor, constant: 0),
etaField.topAnchor.constraint(equalTo: nextEventField.bottomAnchor),
etaField.bottomAnchor.constraint(equalTo: bottomAnchor),
])
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func initialSetup() {
nextEventField.attributedStringValue = NSAttributedString(string: "Next Event", attributes: textFontAttributes)
etaField.attributedStringValue = NSAttributedString(string: dataObject.metadataForMeeting(), attributes: timeAttributes)
}
func updateWithNextEventInfo(_ metadata: String) {
nextEventField.attributedStringValue = NSAttributedString(string: "Next Event", attributes: textFontAttributes)
etaField.attributedStringValue = NSAttributedString(string: metadata, attributes: timeAttributes)
}
override func mouseDown(with event: NSEvent) {
super.mouseDown(with: event)
guard let mainDelegate = NSApplication.shared.delegate as? AppDelegate else {
return
}
mainDelegate.togglePanel(event)
}
}
Loading…
Cancel
Save