From a4ce84cdd48efbf21fb0cdf40519a58f2c64766b Mon Sep 17 00:00:00 2001 From: Stephen <158498287+StephenDev0@users.noreply.github.com> Date: Mon, 18 May 2026 09:38:57 -0400 Subject: [PATCH] Hopefully fix issue #330 --- StikDebug.xcodeproj/project.pbxproj | 18 ++++++++++++++++++ StikJIT/Views/HomeView.swift | 15 ++++++++++++++- StikJITTests/StikJITTests.swift | 18 ++++++++++++++++-- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/StikDebug.xcodeproj/project.pbxproj b/StikDebug.xcodeproj/project.pbxproj index 33127f1..7338aee 100644 --- a/StikDebug.xcodeproj/project.pbxproj +++ b/StikDebug.xcodeproj/project.pbxproj @@ -568,7 +568,15 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SZ977XLF24; GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/StikJIT/idevice", + ); IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/StikJIT/idevice", + ); MACOSX_DEPLOYMENT_TARGET = 15.1; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.stik.StikJITTests; @@ -576,6 +584,7 @@ SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_INCLUDE_PATHS = "$(inherited) $(PROJECT_DIR)/StikJIT/idevice"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StikDebug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StikDebug"; @@ -591,7 +600,15 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = SZ977XLF24; GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/StikJIT/idevice", + ); IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/StikJIT/idevice", + ); MACOSX_DEPLOYMENT_TARGET = 15.1; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.stik.StikJITTests; @@ -599,6 +616,7 @@ SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_INCLUDE_PATHS = "$(inherited) $(PROJECT_DIR)/StikJIT/idevice"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StikDebug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StikDebug"; diff --git a/StikJIT/Views/HomeView.swift b/StikJIT/Views/HomeView.swift index f056e03..eb5e775 100644 --- a/StikJIT/Views/HomeView.swift +++ b/StikJIT/Views/HomeView.swift @@ -411,13 +411,26 @@ public extension ProcessInfo { if isTXMOverridden { return true } - return ProcessInfo.detectLocalTXM() + return ProcessInfo.hasTXMSupport( + operatingSystemVersion: operatingSystemVersion, + localTXMDetector: ProcessInfo.detectLocalTXM + ) } var isTXMOverridden: Bool { UserDefaults.standard.bool(forKey: UserDefaults.Keys.txmOverride) } + static func hasTXMSupport( + operatingSystemVersion: OperatingSystemVersion, + localTXMDetector: () -> Bool + ) -> Bool { + guard operatingSystemVersion.majorVersion >= 26 else { + return false + } + return localTXMDetector() + } + private static func detectLocalTXM() -> Bool { if let boot = FileManager.default.filePath(atPath: "/System/Volumes/Preboot", withLength: 36), let file = FileManager.default.filePath(atPath: "\(boot)/boot", withLength: 96) { diff --git a/StikJITTests/StikJITTests.swift b/StikJITTests/StikJITTests.swift index c04793b..a52c821 100644 --- a/StikJITTests/StikJITTests.swift +++ b/StikJITTests/StikJITTests.swift @@ -5,12 +5,26 @@ // Created by Stephen on 3/26/25. // +import Foundation import Testing +@testable import StikDebug struct StikJITTests { - @Test func example() async throws { - // Write your test here and use APIs like `#expect(...)` to check expected conditions. + @Test func txmDetectionIgnoresFirmwareFileBeforeIOS26() async throws { + let isSupported = ProcessInfo.hasTXMSupport( + operatingSystemVersion: OperatingSystemVersion(majorVersion: 18, minorVersion: 7, patchVersion: 2), + localTXMDetector: { true } + ) + + #expect(isSupported == false) + } + + @Test func txmDetectionRequiresLocalTXMOnIOS26() async throws { + let iOS26 = OperatingSystemVersion(majorVersion: 26, minorVersion: 0, patchVersion: 0) + + #expect(ProcessInfo.hasTXMSupport(operatingSystemVersion: iOS26, localTXMDetector: { false }) == false) + #expect(ProcessInfo.hasTXMSupport(operatingSystemVersion: iOS26, localTXMDetector: { true }) == true) } }