Skip to content

Commit

Permalink
Show status bar item during onboarding flow (as recommended by AppSto…
Browse files Browse the repository at this point in the history
…re Review
  • Loading branch information
leits committed Mar 24, 2024
1 parent b480f47 commit 7f0d053
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion MeetingBar/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
Defaults[.appVersion] = appVersion
}

statusBarItem = StatusBarItemController()

if Defaults[.onboardingCompleted] {
setEventStoreProvider(provider: Defaults[.eventStoreProvider])
setup()
Expand All @@ -48,7 +50,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
}

func setup() {
statusBarItem = StatusBarItemController()
statusBarItem.setAppDelegate(appdelegate: self)

registerNotificationCategories()
Expand Down
18 changes: 13 additions & 5 deletions MeetingBar/StatusBarItemController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class StatusBarItemController {
statusItem.button?.target = self
statusItem.button?.action = #selector(statusMenuBarAction)
statusItem.button?.sendAction(on: [NSEvent.EventTypeMask.rightMouseDown, NSEvent.EventTypeMask.leftMouseUp, NSEvent.EventTypeMask.leftMouseDown])

// Temporary icon and menu before app delegate setup
statusItem.button?.image = NSImage(named: "AppIcon")!
statusItem.button?.image?.size = NSSize(width: 16, height: 16)
statusItem.button?.imagePosition = .imageLeft
let menuItem = statusItemMenu.addItem(withTitle: "window_title_onboarding".loco(), action: nil, keyEquivalent: "")
menuItem.isEnabled = false
}

@objc
Expand Down Expand Up @@ -181,11 +188,12 @@ class StatusBarItemController {

button.image = image
button.image?.size = NSSize(width: 16, height: 16)
if image.name() == "no_online_session" {
button.imagePosition = .noImage
} else {
button.imagePosition = .imageLeft
}
}

if button.image?.name() == "no_online_session" {
button.imagePosition = .noImage
} else {
button.imagePosition = .imageLeft
}

// create an NSMutableAttributedString that we'll append everything to
Expand Down

0 comments on commit 7f0d053

Please sign in to comment.