Skip to content

Commit

Permalink
Remove NSLogs for success cases
Browse files Browse the repository at this point in the history
  • Loading branch information
leits committed Jun 27, 2023
1 parent 08614fe commit 4d4eb67
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 34 deletions.
13 changes: 0 additions & 13 deletions MeetingBar/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
if response.notification.request.content.categoryIdentifier == "EVENT" || response.notification.request.content.categoryIdentifier == "SNOOZE_EVENT" {
if let eventID = response.notification.request.content.userInfo["eventID"] as? String {
if let event = statusBarItem.events.first(where: { $0.ID == eventID }) {
NSLog("Join \(event.title) event from notication")
event.openMeeting()
}
}
Expand All @@ -232,11 +231,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
if response.notification.request.content.categoryIdentifier == "EVENT" || response.notification.request.content.categoryIdentifier == "SNOOZE_EVENT" {
if let eventID = response.notification.request.content.userInfo["eventID"] as? String {
if let event = statusBarItem.events.first(where: { $0.ID == eventID }) {
if action.durationInSeconds == 0 {
NSLog("Snooze event until start")
} else {
NSLog("Snooze event for \(action.durationInMins) mins")
}
snoozeEventNotification(event, action)
}
}
Expand All @@ -250,7 +244,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
*/

func openOnboardingWindow() {
NSLog("Open onboarding window")
let contentView = OnboardingView()
let onboardingWindow = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 660, height: 450),
Expand All @@ -271,7 +264,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele

@objc
func openChangelogWindow(_: NSStatusBarButton?) {
NSLog("Open changelof window")
let contentView = ChangelogView()
let changelogWindow = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 600, height: 400),
Expand All @@ -294,7 +286,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele

@objc
func openPrefecencesWindow(_: NSStatusBarButton?) {
NSLog("Open preferences window")
let contentView = PreferencesView()

if let preferencesWindow {
Expand Down Expand Up @@ -356,7 +347,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele

@objc
func eventStoreChanged(_: NSNotification) {
NSLog("Store changed. Update status bar menu.")
if statusBarItem == nil {
return
}
Expand All @@ -367,15 +357,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele

@objc
private func fetchEvents() {
NSLog("Firing reccuring fetchEvents")
DispatchQueue.main.async {
self.statusBarItem.loadEvents()
}
}

@objc
private func updateStatusBarItem() {
NSLog("Firing reccuring updateStatusBarItem")
DispatchQueue.main.async {
self.statusBarItem.updateTitle()
self.statusBarItem.updateMenu()
Expand All @@ -384,7 +372,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele

@objc
func quit(_: NSStatusBarButton) {
NSLog("User click Quit")
NSApplication.shared.terminate(self)
}
}
1 change: 0 additions & 1 deletion MeetingBar/EventStores/GCEventStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class GCEventStore: NSObject, EventStore, OIDExternalUserAgent {
if let url = URL(string: "https://www.googleapis.com/calendar/v3/calendars/\(calendar.ID)/events?singleEvents=true&orderBy=startTime&timeMax=\(timeMax)&timeMin=\(timeMin)") {
let service = GTMSessionFetcherService()
service.authorizer = auth
NSLog("Request GoogleAPI")
service.fetcher(with: url).beginFetch { data, error in
if error != nil {
if [OIDOAuthTokenErrorDomain, OIDHTTPErrorDomain].contains((error as NSError?)?.domain) {
Expand Down
6 changes: 1 addition & 5 deletions MeetingBar/Extensions/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,18 @@ extension URL {

NSWorkspace.shared.open([self], withApplicationAt: URL(fileURLWithPath: browserPath), configuration: configuration) { app, error in
guard app != nil else {
NSLog("Can't open \(self) in \(browserName): \(String(describing: error?.localizedDescription))")
sendNotification("link_url_cant_open_title".loco(browserName), "link_url_cant_open_message".loco(browserName))
self.openInDefaultBrowser()
return
}
NSLog("Opening \(self) in \(browserName)")
}
}
}

@discardableResult
func openInDefaultBrowser() -> Bool {
let result = NSWorkspace.shared.open(self)
if result {
NSLog("Opening \(self) in default browser")
} else {
if !result {
sendNotification("link_url_cant_open_title".loco("preferences_services_link_default_browser_value".loco()), "preferences_services_create_meeting_custom_url_placeholder".loco())
}
return result
Expand Down
1 change: 0 additions & 1 deletion MeetingBar/MeetingServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ enum CreateMeetingServices: String, Codable, CaseIterable {
}

func createMeeting() {
NSLog("Create meeting in \(Defaults[.createMeetingService].rawValue)")
let browser: Browser = Defaults[.browserForCreateMeeting]

switch Defaults[.createMeetingService] {
Expand Down
9 changes: 1 addition & 8 deletions MeetingBar/Notifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,12 @@ func registerNotificationCategories() {

notificationCenter.setNotificationCategories([eventCategory, snoozeEventCategory])

notificationCenter.getNotificationCategories { categories in
for category in categories {
NSLog("Category \(category.identifier) was registered")
}
}
notificationCenter.getNotificationCategories { _ in }
}

func sendUserNotification(_ title: String, _ text: String, _ categoryIdentier: String? = nil) {
requestNotificationAuthorization() // By the apple best practices

NSLog("Send notification: \(title) - \(text)")
let center = UNUserNotificationCenter.current()

let content = UNMutableNotificationContent()
Expand Down Expand Up @@ -134,8 +129,6 @@ func sendNotification(_ title: String, _ text: String) {
* adds an alert for the user- we will only use NSAlert if the user has switched off notifications
*/
func displayAlert(title: String, text: String) {
NSLog("Display alert: \(title) - \(text)")

let userAlert = NSAlert()
userAlert.messageText = title
userAlert.informativeText = text
Expand Down
2 changes: 0 additions & 2 deletions MeetingBar/Scripts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ func createAppleScriptParametersForEvent(event: MBEvent) -> NSAppleEventDescript

// runs the predefined script with parameters.
func runMeetingStartsScript(event: MBEvent, type: ScriptType) {
NSLog("Run apple script for event \(String(describing: event.ID))")

let parameters = createAppleScriptParametersForEvent(event: event)

let appleEvent = NSAppleEventDescriptor(
Expand Down
4 changes: 0 additions & 4 deletions MeetingBar/StatusBarItemController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,8 @@ class StatusBarItemController {
@objc
func joinNextMeeting() {
if let nextEvent = getNextEvent(events: events) {
NSLog("Join next event")
nextEvent.openMeeting()
} else {
NSLog("No next event")
sendNotification("next_meeting_empty_title".loco(), "next_meeting_empty_message".loco())
}
}
Expand Down Expand Up @@ -882,15 +880,13 @@ class StatusBarItemController {

@objc
func joinBookmark(sender: NSMenuItem) {
NSLog("Called to join bookmark")
if let bookmark: Bookmark = sender.representedObject as? Bookmark {
openMeetingURL(bookmark.service, bookmark.url, nil)
}
}

@objc
func clickOnEvent(sender: NSMenuItem) {
NSLog("Click on event (\(sender.title))!")
if let event: MBEvent = sender.representedObject as? MBEvent {
event.openMeeting()
}
Expand Down

0 comments on commit 4d4eb67

Please sign in to comment.