message: Use Touch Bar Public API for AppStore and Private API for non-AppStore (mac)
diff: @@ -45,7 +45,14 @@ final class TouchBarService: NSObject {
  // MARK: Variables
  var isEnabled = true
  - private var touchBar: NSTouchBar?
  + private lazy var touchBar: NSTouchBar = {
  + let touchBar = NSTouchBar()
  + touchBar.delegate = self
  + touchBar.customizationIdentifier = .mainTouchBar
  + touchBar.defaultItemIdentifiers = [.timeEntryItem, .startStopItem]
  + return touchBar
  + }()
  +
  weak var delegate: TouchBarServiceDelegate?
  private var timeEntries: [TimeEntryViewItem] = []
  private var displayState = DisplayState.normal { didSet { updateDisplayState() }}
  @@ -77,11 +84,14 @@ final class TouchBarService: NSObject {
  func makeTouchBar() -> NSTouchBar? {
  guard isEnabled else { return nil }
  - touchBar = NSTouchBar()
  - touchBar?.delegate = self
  - touchBar?.customizationIdentifier = .mainTouchBar
  - touchBar?.defaultItemIdentifiers = [.timeEntryItem, .startStopItem]
  +
  + // Use public APIs for AppStore version
  + #if APP_STORE
  return touchBar
  + #endif
  +
  + // Return nil and use Private APIs
  + return nil
  }
  func updateRunningItem(_ timeEntry: TimeEntryViewItem) {
  @@ -143,6 +153,10 @@ extension TouchBarService {
  selector: #selector(self.stateButtonTimerBarChangeNotification(_:)),
  name: NSNotification.Name(kStartButtonStateChange),
  object: nil)
  + NotificationCenter.default.addObserver(self,
  + selector: #selector(self.touchbarSettingChangedNoti(_:)),
  + name: NSNotification.Name(kTouchBarSettingChanged),
  + object: nil)
  }
  @objc private func stateButtonTimerBarChangeNotification(_ noti: Notification) {
  @@ -153,8 +167,11 @@ extension TouchBarService {
  displayState = startButton.state == .on ? .tracking : .normal
  }
  + @objc private func touchbarSettingChangedNoti(_ noti: Notification) {
  +
  + }
  +
  private func updateDisplayState() {
  - guard let touchBar = touchBar else { return }
  switch displayState {
  case .normal:
  touchBar.defaultItemIdentifiers.removeAll(where: { $0 == .runningTimeEntry })
  