Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_ipa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: 1. Fetch Source Code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: 2. Configure Xcode Environment
uses: maxim-lobanov/setup-xcode@v1
Expand Down
59 changes: 27 additions & 32 deletions StikDebug/Support/ProcessInfo+TXM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,45 @@
import Foundation

public extension ProcessInfo {
var hasTXMClassic: Bool {
ProcessInfo.processInfo.isiOSAppOnMac ? false : ProcessInfo.detectLocalTXM()
}

var hasTXM: Bool {
if isTXMOverridden {
return true
}

return ProcessInfo.hasTXMSupport(
isIOS266OrNewer: ProcessInfo.isIOS266OrNewer,
hasTXMClassic: hasTXMClassic,
hardwareIdentifier: hardwareIdentifier()
)
let hardware = hardwareIdentifier()

if ProcessInfo.isIOS27OrNewer {
return hardware != "iPad8,11" && hardware != "iPad8,12"
}

if ProcessInfo.isIOS26OrNewer {
return ProcessInfo.hasTXMSupport(
hardwareIdentifier: hardware
)
}

return false
}

var isTXMOverridden: Bool {
UserDefaults.standard.bool(forKey: UserDefaults.Keys.txmOverride)
}

internal static func hasTXMSupport(
isIOS266OrNewer: Bool,
hasTXMClassic: Bool,
hardwareIdentifier: String
) -> Bool {
if isIOS266OrNewer, !hasTXMClassic {
let firstTXM = 14.2
let iPadTXM = 14.5

if let ver = ProcessInfo.processInfo.deviceVersion(from: hardwareIdentifier) {
if hardwareIdentifier.hasPrefix("iPad") {
return ver >= iPadTXM
} else {
return ver >= firstTXM
}
}
let firstTXM = 14.2
let iPadTXM = 14.5

guard let ver = ProcessInfo.processInfo.deviceVersion(from: hardwareIdentifier) else {
return false
}

return hasTXMClassic
if hardwareIdentifier.hasPrefix("iPad") {
return ver >= iPadTXM
}

return ver >= firstTXM
}

func deviceVersion(from identifier: String) -> Double? {
Expand Down Expand Up @@ -74,19 +72,16 @@ public extension ProcessInfo {
return extractVersion(iPhonePattern) ?? extractVersion(iPadPattern)
}

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) {
return access("\(file)/usr/standalone/firmware/FUD/Ap,TrustedExecutionMonitor.img4", F_OK) == 0
private static var isIOS26OrNewer: Bool {
if #available(iOS 26.0, *) {
return true
}

return FileManager.default.filePath(atPath: "/private/preboot", withLength: 96).map {
access("\($0)/usr/standalone/firmware/FUD/Ap,TrustedExecutionMonitor.img4", F_OK) == 0
} ?? false
return false
}

private static var isIOS266OrNewer: Bool {
if #available(iOS 26.6, *) {
private static var isIOS27OrNewer: Bool {
if #available(iOS 27.0, *) {
return true
}

Expand Down
Loading