diff --git a/Package.swift b/Package.swift index 18b3899..1a4e295 100644 --- a/Package.swift +++ b/Package.swift @@ -37,5 +37,9 @@ let package = Package( dependencies: ["GhostTileCore"], exclude: ["Resources"] ), + .testTarget( + name: "GhostTileAppTests", + dependencies: ["GhostTileApp"] + ), ] ) diff --git a/Resources/Info.plist b/Resources/Info.plist index 2f7bd32..9425f0d 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -19,9 +19,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.0.6 + 2.0.7 CFBundleVersion - 23 + 24 LSMinimumSystemVersion 15.0 LSUIElement diff --git a/Sources/GhostTileApp/Services/Permissions/AppManagementPermissionStatusReader.swift b/Sources/GhostTileApp/Services/Permissions/AppManagementPermissionStatusReader.swift index dad220f..54daa4c 100644 --- a/Sources/GhostTileApp/Services/Permissions/AppManagementPermissionStatusReader.swift +++ b/Sources/GhostTileApp/Services/Permissions/AppManagementPermissionStatusReader.swift @@ -5,6 +5,7 @@ enum AppManagementPermissionStatusReader { private static let frameworkPath = "/System/Library/PrivateFrameworks/TCC.framework/TCC" private static let preflightSymbolName = "TCCAccessPreflight" private static let appManagementServiceSymbolName = "kTCCServiceSystemPolicyAppBundles" + private static let preflightGranted: Int32 = 0 private typealias TCCAccessPreflightFunction = @convention(c) ( CFString, @@ -26,6 +27,10 @@ enum AppManagementPermissionStatusReader { to: TCCAccessPreflightFunction.self ) let service = serviceSymbol.assumingMemoryBound(to: CFString.self).pointee - return preflight(service, nil) != 0 + return isAllowed(preflightResult: preflight(service, nil)) + } + + static func isAllowed(preflightResult: Int32) -> Bool { + preflightResult == preflightGranted } } diff --git a/Sources/GhostTileCore/BuildInfo.swift b/Sources/GhostTileCore/BuildInfo.swift index a7c39bc..ee70fc7 100644 --- a/Sources/GhostTileCore/BuildInfo.swift +++ b/Sources/GhostTileCore/BuildInfo.swift @@ -1,6 +1,6 @@ public enum BuildInfo { - public static let version = "2.0.6" - public static let build = "23" + public static let version = "2.0.7" + public static let build = "24" public static let displayVersion = "\(version) (\(build))" diff --git a/Tests/GhostTileAppTests/AppManagementPermissionStatusReaderTests.swift b/Tests/GhostTileAppTests/AppManagementPermissionStatusReaderTests.swift new file mode 100644 index 0000000..733e88e --- /dev/null +++ b/Tests/GhostTileAppTests/AppManagementPermissionStatusReaderTests.swift @@ -0,0 +1,14 @@ +@testable import GhostTileApp +import Testing + +@Suite("AppManagementPermissionStatusReader") +struct AppManagementPermissionStatusReaderTests { + @Test func preflightResultZeroMeansAllowed() { + #expect(AppManagementPermissionStatusReader.isAllowed(preflightResult: 0)) + } + + @Test func nonZeroPreflightResultsAreNotAllowed() { + #expect(!AppManagementPermissionStatusReader.isAllowed(preflightResult: 1)) + #expect(!AppManagementPermissionStatusReader.isAllowed(preflightResult: 2)) + } +} diff --git a/VERSION b/VERSION index 0bc213a..27a7de2 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -VERSION=2.0.6 -BUILD=23 +VERSION=2.0.7 +BUILD=24 diff --git a/project.yml b/project.yml index 61f7dd1..2ec1c7c 100644 --- a/project.yml +++ b/project.yml @@ -74,8 +74,8 @@ targets: properties: CFBundleDisplayName: GhostTile CFBundleIconName: app - CFBundleShortVersionString: 2.0.6 - CFBundleVersion: "23" + CFBundleShortVersionString: 2.0.7 + CFBundleVersion: "24" LSUIElement: false LSMinimumSystemVersion: "15.0" NSHighResolutionCapable: true diff --git a/releases/2.0.7.html b/releases/2.0.7.html new file mode 100644 index 0000000..156bcf9 --- /dev/null +++ b/releases/2.0.7.html @@ -0,0 +1,3 @@ +