Skip to content

Commit c504ef3

Browse files
committed
Add a toggle
1 parent ca2df1e commit c504ef3

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

StikDebug/App/AppBootstrapper.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ enum AppBootstrapper {
2121
UserDefaults.standard.register(defaults: [
2222
"enableAdvancedOptions": enableAdvancedOptions,
2323
UserDefaults.Keys.txmOverride: false,
24+
UserDefaults.Keys.confirmExternalJITRequests: true,
2425
"keepAliveAudio": true,
2526
"keepAliveLocation": true
2627
])

StikDebug/Support/UserDefaults+Keys.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ extension UserDefaults {
99
enum Keys {
1010
/// Forces the app to treat the current device as TXM-capable so scripts always run.
1111
static let txmOverride = "overrideTXMForScripts"
12+
/// Requires confirmation before external links can enable JIT.
13+
static let confirmExternalJITRequests = "confirmExternalJITRequests"
1214
static let bundleScriptMap = "BundleScriptMap"
1315
static let defaultScriptName = "DefaultScriptName"
1416
static let defaultScriptNameValue = ""

StikDebug/Views/HomeView.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import SwiftUI
1010
struct HomeView: View {
1111
@AppStorage("autoQuitAfterEnablingJIT") private var doAutoQuitAfterEnablingJIT = false
1212
@AppStorage("bundleID") private var bundleID: String = ""
13+
@AppStorage(UserDefaults.Keys.confirmExternalJITRequests) private var confirmExternalJITRequests = true
1314

1415
@ObservedObject private var mounting = MountingProgress.shared
1516

@@ -180,7 +181,12 @@ struct HomeView: View {
180181
config.scriptData = scriptInfo.data
181182
config.scriptName = scriptInfo.name
182183
}
183-
pendingExternalURLAction = .enableJIT(config)
184+
let action = HomeExternalAction.enableJIT(config)
185+
if confirmExternalJITRequests {
186+
pendingExternalURLAction = action
187+
} else {
188+
performExternalURLAction(action)
189+
}
184190
case "kill-process":
185191
if let pidStr = queryValue(["pid"], in: components), let pid = Int(pidStr) {
186192
pendingExternalURLAction = .killProcess(pid)

StikDebug/Views/SettingsView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ private enum SettingsLinks {
1515

1616
struct SettingsView: View {
1717
@AppStorage(UserDefaults.Keys.txmOverride) private var overrideTXMDetection = false
18+
@AppStorage(UserDefaults.Keys.confirmExternalJITRequests) private var confirmExternalJITRequests = true
1819
@AppStorage("keepAliveAudio") private var keepAliveAudio = true
1920
@AppStorage("keepAliveLocation") private var keepAliveLocation = true
2021

@@ -112,6 +113,14 @@ struct SettingsView: View {
112113
}
113114

114115
Section("Behavior") {
116+
Toggle(isOn: $confirmExternalJITRequests) {
117+
VStack(alignment: .leading, spacing: 2) {
118+
Text("Confirm JIT Links")
119+
Text("Ask before external links enable JIT or run scripts.")
120+
.font(.caption).foregroundStyle(.secondary)
121+
}
122+
}
123+
115124
Toggle(isOn: $overrideTXMDetection) {
116125
VStack(alignment: .leading, spacing: 2) {
117126
Text("Always Run Scripts")

0 commit comments

Comments
 (0)