Skip to content

Commit a4ce84c

Browse files
committed
Hopefully fix issue #330
1 parent 08830f1 commit a4ce84c

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

StikDebug.xcodeproj/project.pbxproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,14 +568,23 @@
568568
CURRENT_PROJECT_VERSION = 1;
569569
DEVELOPMENT_TEAM = SZ977XLF24;
570570
GENERATE_INFOPLIST_FILE = YES;
571+
HEADER_SEARCH_PATHS = (
572+
"$(inherited)",
573+
"$(PROJECT_DIR)/StikJIT/idevice",
574+
);
571575
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
576+
LIBRARY_SEARCH_PATHS = (
577+
"$(inherited)",
578+
"$(PROJECT_DIR)/StikJIT/idevice",
579+
);
572580
MACOSX_DEPLOYMENT_TARGET = 15.1;
573581
MARKETING_VERSION = 1.0;
574582
PRODUCT_BUNDLE_IDENTIFIER = com.stik.StikJITTests;
575583
PRODUCT_NAME = "$(TARGET_NAME)";
576584
SDKROOT = auto;
577585
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
578586
SWIFT_EMIT_LOC_STRINGS = NO;
587+
SWIFT_INCLUDE_PATHS = "$(inherited) $(PROJECT_DIR)/StikJIT/idevice";
579588
SWIFT_VERSION = 5.0;
580589
TARGETED_DEVICE_FAMILY = "1,2,7";
581590
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StikDebug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StikDebug";
@@ -591,14 +600,23 @@
591600
CURRENT_PROJECT_VERSION = 1;
592601
DEVELOPMENT_TEAM = SZ977XLF24;
593602
GENERATE_INFOPLIST_FILE = YES;
603+
HEADER_SEARCH_PATHS = (
604+
"$(inherited)",
605+
"$(PROJECT_DIR)/StikJIT/idevice",
606+
);
594607
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
608+
LIBRARY_SEARCH_PATHS = (
609+
"$(inherited)",
610+
"$(PROJECT_DIR)/StikJIT/idevice",
611+
);
595612
MACOSX_DEPLOYMENT_TARGET = 15.1;
596613
MARKETING_VERSION = 1.0;
597614
PRODUCT_BUNDLE_IDENTIFIER = com.stik.StikJITTests;
598615
PRODUCT_NAME = "$(TARGET_NAME)";
599616
SDKROOT = auto;
600617
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
601618
SWIFT_EMIT_LOC_STRINGS = NO;
619+
SWIFT_INCLUDE_PATHS = "$(inherited) $(PROJECT_DIR)/StikJIT/idevice";
602620
SWIFT_VERSION = 5.0;
603621
TARGETED_DEVICE_FAMILY = "1,2,7";
604622
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StikDebug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StikDebug";

StikJIT/Views/HomeView.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,26 @@ public extension ProcessInfo {
411411
if isTXMOverridden {
412412
return true
413413
}
414-
return ProcessInfo.detectLocalTXM()
414+
return ProcessInfo.hasTXMSupport(
415+
operatingSystemVersion: operatingSystemVersion,
416+
localTXMDetector: ProcessInfo.detectLocalTXM
417+
)
415418
}
416419

417420
var isTXMOverridden: Bool {
418421
UserDefaults.standard.bool(forKey: UserDefaults.Keys.txmOverride)
419422
}
420423

424+
static func hasTXMSupport(
425+
operatingSystemVersion: OperatingSystemVersion,
426+
localTXMDetector: () -> Bool
427+
) -> Bool {
428+
guard operatingSystemVersion.majorVersion >= 26 else {
429+
return false
430+
}
431+
return localTXMDetector()
432+
}
433+
421434
private static func detectLocalTXM() -> Bool {
422435
if let boot = FileManager.default.filePath(atPath: "/System/Volumes/Preboot", withLength: 36),
423436
let file = FileManager.default.filePath(atPath: "\(boot)/boot", withLength: 96) {

StikJITTests/StikJITTests.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@
55
// Created by Stephen on 3/26/25.
66
//
77

8+
import Foundation
89
import Testing
10+
@testable import StikDebug
911

1012
struct StikJITTests {
1113

12-
@Test func example() async throws {
13-
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
14+
@Test func txmDetectionIgnoresFirmwareFileBeforeIOS26() async throws {
15+
let isSupported = ProcessInfo.hasTXMSupport(
16+
operatingSystemVersion: OperatingSystemVersion(majorVersion: 18, minorVersion: 7, patchVersion: 2),
17+
localTXMDetector: { true }
18+
)
19+
20+
#expect(isSupported == false)
21+
}
22+
23+
@Test func txmDetectionRequiresLocalTXMOnIOS26() async throws {
24+
let iOS26 = OperatingSystemVersion(majorVersion: 26, minorVersion: 0, patchVersion: 0)
25+
26+
#expect(ProcessInfo.hasTXMSupport(operatingSystemVersion: iOS26, localTXMDetector: { false }) == false)
27+
#expect(ProcessInfo.hasTXMSupport(operatingSystemVersion: iOS26, localTXMDetector: { true }) == true)
1428
}
1529

1630
}

0 commit comments

Comments
 (0)