Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Add ifdefs around platform stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Feb 17, 2024
1 parent 6c97eab commit 23c3a00
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Aware/ActivityTimer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Created by Joshua Peek on 2/16/24.
//

#if os(macOS)

import AppKit

/// Automatically tracks macOS user input activity.
Expand Down Expand Up @@ -158,3 +160,5 @@ private func secondsSinceLastUserEvent() -> CFTimeInterval {
CGEventSource.secondsSinceLastEventType(.combinedSessionState, eventType: eventType)
}.min() ?? 0.0
}

#endif
2 changes: 2 additions & 0 deletions Aware/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import SwiftUI
@main
struct AwareApp: App {
var body: some Scene {
#if os(macOS)
MenuBar()
#endif
}
}
4 changes: 4 additions & 0 deletions Aware/LoginItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Created by Joshua Peek on 2/16/24.
//

#if canImport(ServiceManagement)

import ServiceManagement

class LoginItem: ObservableObject {
Expand Down Expand Up @@ -35,3 +37,5 @@ class LoginItem: ObservableObject {

var changeError: Error?
}

#endif
5 changes: 5 additions & 0 deletions Aware/MenuBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// Created by Joshua Peek on 2/16/24.
//

#if os(macOS)

import AppKit
import SwiftUI

struct MenuBar: Scene {
Expand Down Expand Up @@ -65,3 +68,5 @@ struct MenuBarContentView: View {
}.keyboardShortcut("q")
}
}

#endif

0 comments on commit 23c3a00

Please sign in to comment.