mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Merge pull request #416 from CelloSerenity/main
Fix TXM detection on iOS 27
This commit is contained in:
parent
c504ef3ef5
commit
ef5e962b38
2 changed files with 28 additions and 33 deletions
2
.github/workflows/build_ipa.yml
vendored
2
.github/workflows/build_ipa.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -6,20 +6,24 @@
|
|||
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 {
|
||||
|
|
@ -27,26 +31,20 @@ public extension ProcessInfo {
|
|||
}
|
||||
|
||||
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? {
|
||||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue