use LSApplicationWorkspace to open PB

This commit is contained in:
leminlimez committed 2025-06-03 19:57:53 -04:00
1 parent 582efbacbf
commit b15c6854f2
4 files changed
+20 -5

No files matched your search

@@ -22,6 +22,17 @@ class PosterBoardManager {
return tendiesStoreURL
}
static func openPosterBoard() -> Bool {
guard let obj = objc_getClass("LSApplicationWorkspace") as? NSObject else { return false }
let workspace = obj.perform(Selector(("defaultWorkspace")))?.takeUnretainedValue() as? NSObject
if let success = workspace?.perform(Selector(("openApplicationWithBundleID:")), with: "com.apple.PosterBoard") {
return success != nil
}
return false
}
private static func unzipFile(at url: URL) throws -> URL {
let fileName = url.deletingPathExtension().lastPathComponent
let fileData = try Data(contentsOf: url)