Skip to content

Commit

Permalink
match xcode launch date
Browse files Browse the repository at this point in the history
  • Loading branch information
llsc12 committed Mar 20, 2024
1 parent 957a184 commit 52f65b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion XRPC/AXScrape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AXScrape: ObservableObject {
func scrape() {
guard UIElement.isProcessTrusted(withPrompt: false) else { return }

let xcodeProcess = NSWorkspace.shared.runningApplications.first { $0.bundleIdentifier == xcodeBundleId }
guard let xcodeApp = Application.allForBundleID(xcodeBundleId).first else { self.presenceState = .xcodeNotRunning; return }

let windows = try? xcodeApp.windows()
Expand Down Expand Up @@ -62,9 +63,11 @@ class AXScrape: ObservableObject {
workspace: workspace,
editorFile: doc,
isEditingFile: isEditing,
sessionDate: currentSessionDate ?? .now /// preserve xcode last date or make new date, used for timings
sessionDate: currentSessionDate ?? xcodeProcess?.launchDate ?? .now /// preserve xcode last date or make new date, used for timings
)



self.presenceState = .working(xcState)
}
}
Expand Down

0 comments on commit 52f65b7

Please sign in to comment.