mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Move Always Run Scripts toggle to Behavior settings card (#263)
This commit is contained in:
parent
bf87d9d251
commit
b0ab8c1d6f
4 changed files with 39 additions and 5 deletions
|
|
@ -17,6 +17,7 @@ private func registerAdvancedOptionsDefault() {
|
|||
let enabled = os.majorVersion >= 19
|
||||
UserDefaults.standard.register(defaults: ["enableAdvancedOptions": enabled])
|
||||
UserDefaults.standard.register(defaults: ["enablePiP": enabled])
|
||||
UserDefaults.standard.register(defaults: [UserDefaults.Keys.txmOverride: false])
|
||||
}
|
||||
|
||||
// MARK: - Welcome Sheet
|
||||
|
|
|
|||
|
|
@ -18,3 +18,10 @@ extension UIDocumentPickerViewController {
|
|||
return fix_init(forOpeningContentTypes: contentTypes, asCopy: true)
|
||||
}
|
||||
}
|
||||
|
||||
extension UserDefaults {
|
||||
enum Keys {
|
||||
/// Forces the app to treat the current device as TXM-capable so scripts always run.
|
||||
static let txmOverride = "overrideTXMForScripts"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1656,7 +1656,11 @@ private struct ConnectByPIDSheet: View {
|
|||
|
||||
public extension ProcessInfo {
|
||||
var hasTXM: Bool {
|
||||
{
|
||||
if isTXMOverridden {
|
||||
return true
|
||||
}
|
||||
|
||||
return {
|
||||
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
|
||||
|
|
@ -1667,4 +1671,8 @@ public extension ProcessInfo {
|
|||
}
|
||||
}()
|
||||
}
|
||||
|
||||
var isTXMOverridden: Bool {
|
||||
UserDefaults.standard.bool(forKey: UserDefaults.Keys.txmOverride)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ struct SettingsView: View {
|
|||
@AppStorage("enableAdvancedBetaOptions") private var enableAdvancedBetaOptions = false
|
||||
@AppStorage("enableTesting") private var enableTesting = false
|
||||
@AppStorage("enablePiP") private var enablePiP = false
|
||||
@AppStorage(UserDefaults.Keys.txmOverride) private var overrideTXMDetection = false
|
||||
@AppStorage("customAccentColor") private var customAccentColorHex: String = ""
|
||||
@AppStorage("appTheme") private var appThemeRaw: String = AppTheme.system.rawValue
|
||||
@Environment(\.themeExpansionManager) private var themeExpansion
|
||||
|
|
@ -328,11 +329,22 @@ struct SettingsView: View {
|
|||
Text("Behavior")
|
||||
.font(.headline)
|
||||
.foregroundColor(.primary)
|
||||
|
||||
|
||||
Toggle("Run Default Script After Connecting", isOn: $useDefaultScript)
|
||||
.tint(accentColor)
|
||||
Toggle("Picture in Picture", isOn: $enablePiP)
|
||||
.tint(accentColor)
|
||||
Toggle(isOn: $overrideTXMDetection) {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("Always Run Scripts")
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.foregroundColor(.primary.opacity(0.9))
|
||||
Text("Treat this device as TXM-capable to bypass hardware checks.")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.tint(accentColor)
|
||||
}
|
||||
.onChange(of: enableAdvancedOptions) { _, newValue in
|
||||
if !newValue {
|
||||
|
|
@ -356,7 +368,7 @@ struct SettingsView: View {
|
|||
Text("Advanced")
|
||||
.font(.headline)
|
||||
.foregroundColor(.primary)
|
||||
|
||||
|
||||
Button(action: { openAppFolder() }) {
|
||||
HStack {
|
||||
Image(systemName: "folder")
|
||||
|
|
@ -425,9 +437,15 @@ struct SettingsView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var versionInfo: some View {
|
||||
let txmLabel = ProcessInfo.processInfo.hasTXM ? "TXM" : "Non TXM"
|
||||
let processInfo = ProcessInfo.processInfo
|
||||
let txmLabel: String
|
||||
if processInfo.isTXMOverridden {
|
||||
txmLabel = "TXM (Override)"
|
||||
} else {
|
||||
txmLabel = processInfo.hasTXM ? "TXM" : "Non TXM"
|
||||
}
|
||||
return HStack {
|
||||
Spacer()
|
||||
Text("Version \(appVersion) • iOS \(UIDevice.current.systemVersion) • \(txmLabel)")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue