-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open Event in Calendar #79
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/xcode,swift,macos | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=xcode,swift,macos | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Swift ### | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## User settings | ||
xcuserdata/ | ||
|
||
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) | ||
*.xcscmblueprint | ||
*.xccheckout | ||
|
||
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) | ||
build/ | ||
DerivedData/ | ||
*.moved-aside | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
||
## App packaging | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# Swift Package Manager | ||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. | ||
# Packages/ | ||
# Package.pins | ||
# Package.resolved | ||
# *.xcodeproj | ||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata | ||
# hence it is not needed unless you have added a package configuration file to your project | ||
# .swiftpm | ||
|
||
.build/ | ||
|
||
# CocoaPods | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# Pods/ | ||
# Add this line if you want to avoid checking in source code from the Xcode workspace | ||
# *.xcworkspace | ||
|
||
# Carthage | ||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build/ | ||
|
||
# Accio dependency management | ||
Dependencies/ | ||
.accio/ | ||
|
||
# fastlane | ||
# It is recommended to not store the screenshots in the git repo. | ||
# Instead, use fastlane to re-generate the screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output | ||
|
||
# Code Injection | ||
# After new code Injection tools there's a generated folder /iOSInjectionProject | ||
# https://github.com/johnno1962/injectionforxcode | ||
|
||
iOSInjectionProject/ | ||
|
||
### Xcode ### | ||
# Xcode | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
|
||
|
||
|
||
## Gcc Patch | ||
/*.gcno | ||
|
||
### Xcode Patch ### | ||
*.xcodeproj/* | ||
!*.xcodeproj/project.pbxproj | ||
!*.xcodeproj/xcshareddata/ | ||
!*.xcworkspace/contents.xcworkspacedata | ||
**/xcshareddata/WorkspaceSettings.xcsettings | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/xcode,swift,macos |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,6 +184,29 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele | |
|
||
completionHandler() | ||
} | ||
|
||
// just opens the calendar | ||
@objc func openCalendar(_: Any? = nil) { | ||
NSLog("Open Calendar") | ||
let url = URL(string: "ical://") | ||
NSWorkspace.shared.open([url!], | ||
withAppBundleIdentifier:"com.apple.iCal", | ||
options: [], | ||
additionalEventParamDescriptor: nil, | ||
launchIdentifiers: nil) | ||
} | ||
|
||
// try to open to specific event | ||
@objc func openCalendarEvent(_: Any? = nil){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried a bunch of things but can't get the event identifier passed in as an argument! Could you (@leits or anyone else) point me in the right direction? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will take a look at this, I have already implemented this here, so it shouldn't be much different There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I'm a bit mixed on this too, but often when I'm looking at the details for an event I just want to click so the calendar comes up to that event. We can take the option out of the main menu but leave it in the submenu for each event? Or if possible make it such that clicking anywhere in the submenu will open the calendar event? But I couldn't figure out how to do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use the modifier flags to do a different action when clicking with specific keys |
||
let identifier = "EF087808-AC5B-4672-A49E-90FC400D4C61" // HARDCODED identifier works! | ||
NSLog("Open Calendar EVENT with identifier \(identifier)") | ||
let url = URL(string: "ical://ekevent/\(identifier)") | ||
NSWorkspace.shared.open([url!], | ||
withAppBundleIdentifier:"com.apple.iCal", | ||
options: [], | ||
additionalEventParamDescriptor: nil, | ||
launchIdentifiers: nil) | ||
} | ||
|
||
@objc func createMeeting(_: Any? = nil) { | ||
NSLog("Create meeting in \(Defaults[.createMeetingService].rawValue)") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,12 @@ class StatusBarItemControler { | |
action: #selector(AppDelegate.createMeeting), | ||
keyEquivalent: "") | ||
createItem.setShortcut(for: .createMeetingShortcut) | ||
|
||
self.item.menu!.addItem( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is relevant to add a button to open the Calendar when you could just use Spotlight? |
||
withTitle: "Open Calendar", | ||
action: #selector(AppDelegate.openCalendar), | ||
keyEquivalent: "") | ||
|
||
} | ||
|
||
func createDateSection(date: Date, title: String) { | ||
|
@@ -192,7 +198,13 @@ class StatusBarItemControler { | |
let titleItem = eventMenu.addItem(withTitle: eventTitle, action: nil, keyEquivalent: "") | ||
titleItem.attributedTitle = NSAttributedString(string: eventTitle, attributes: [NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 15)]) | ||
eventMenu.addItem(NSMenuItem.separator()) | ||
|
||
|
||
// Open in Calendar | ||
eventMenu.addItem( | ||
withTitle: "Open in Calendar", | ||
action: #selector(AppDelegate.openCalendarEvent), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
keyEquivalent: "") | ||
|
||
// Calendar | ||
if Defaults[.selectedCalendarIDs].count > 1 { | ||
eventMenu.addItem(withTitle: "Calendar:", action: nil, keyEquivalent: "") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to add more responsibilities to the AppDelegate, what do you think @leits ?
Should we have another class in charge of all this actions?