Skip to content

Commit aaacd75

Browse files
authored
Disable default script when advanced options off (#223)
1 parent 41b280f commit aaacd75

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

StikJIT/Views/HomeView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ struct HomeView: View {
303303
startJITInBackground(with: selectedBundle)
304304
}
305305
}
306-
.pipify(isPresented: $isProcessing) {
306+
.pipify(isPresented: Binding(
307+
get: { useDefaultScript && isProcessing },
308+
set: { newValue in isProcessing = newValue }
309+
)) {
307310
RunJSViewPiP(model: $jsModel)
308311
}
309312
.sheet(isPresented: $scriptViewShow) {

StikJIT/Views/SettingsView.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,23 @@ struct SettingsView: View {
272272
.foregroundColor(.primary)
273273
.padding(.bottom, 4)
274274

275-
Toggle("Run Default Script After Connecting", isOn: $useDefaultScript)
276-
.foregroundColor(.primary)
277-
.padding(.vertical, 6)
278-
279275
Toggle("Enable Advanced Options", isOn: $enableAdvancedOptions)
280276
.foregroundColor(.primary)
281277
.padding(.vertical, 6)
278+
279+
if enableAdvancedOptions {
280+
Toggle("Run Default Script After Connecting", isOn: $useDefaultScript)
281+
.foregroundColor(.primary)
282+
.padding(.vertical, 6)
283+
}
282284
}
283285
.padding(.vertical, 20)
284286
.padding(.horizontal, 16)
287+
.onChange(of: enableAdvancedOptions) { _, newValue in
288+
if !newValue {
289+
useDefaultScript = false
290+
}
291+
}
285292
}
286293

287294
// About section

0 commit comments

Comments
 (0)