mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 12:30:29 +00:00
Add advanced options toggle (#218)
* Set advanced options default for iOS 19/26 * Fix default advanced options registration
This commit is contained in:
parent
6f9aaaf5fa
commit
d490ae7467
6 changed files with 28 additions and 6 deletions
|
|
@ -10,6 +10,14 @@ import Network
|
|||
import UniformTypeIdentifiers
|
||||
import NetworkExtension
|
||||
|
||||
// Register default settings before the app starts
|
||||
private func registerAdvancedOptionsDefault() {
|
||||
let os = ProcessInfo.processInfo.operatingSystemVersion
|
||||
// Enable advanced options by default on iOS 19/26 and above
|
||||
let enabled = os.majorVersion >= 19
|
||||
UserDefaults.standard.register(defaults: ["enableAdvancedOptions": enabled])
|
||||
}
|
||||
|
||||
// MARK: - Welcome Sheet
|
||||
|
||||
struct WelcomeSheetView: View {
|
||||
|
|
@ -461,8 +469,9 @@ struct HeartbeatApp: App {
|
|||
"DDI/Image.dmg",
|
||||
"DDI/Image.dmg.trustcache"
|
||||
]
|
||||
|
||||
|
||||
init() {
|
||||
registerAdvancedOptionsDefault()
|
||||
newVerCheck()
|
||||
let fixMethod = class_getInstanceMethod(UIDocumentPickerViewController.self, #selector(UIDocumentPickerViewController.fix_init(forOpeningContentTypes:asCopy:)))!
|
||||
let origMethod = class_getInstanceMethod(UIDocumentPickerViewController.self, #selector(UIDocumentPickerViewController.init(forOpeningContentTypes:asCopy:)))!
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ struct HomeView: View {
|
|||
@State private var viewDidAppeared = false
|
||||
@State private var pendingBundleIdToEnableJIT : String? = nil
|
||||
@State private var pendingPIDToEnableJIT : Int? = nil
|
||||
@AppStorage("enableAdvancedOptions") private var enableAdvancedOptions = false
|
||||
|
||||
@AppStorage("useDefaultScript") private var useDefaultScript = false
|
||||
@State var scriptViewShow = false
|
||||
|
|
@ -107,7 +108,7 @@ struct HomeView: View {
|
|||
}
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
if pairingFileExists {
|
||||
if pairingFileExists && enableAdvancedOptions {
|
||||
Button(action: {
|
||||
pidTextAlertShow = true
|
||||
}) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import SwiftUI
|
|||
|
||||
struct MainTabView: View {
|
||||
@AppStorage("customAccentColor") private var customAccentColorHex: String = ""
|
||||
@AppStorage("enableAdvancedOptions") private var enableAdvancedOptions = false
|
||||
|
||||
private var accentColor: Color {
|
||||
if customAccentColorHex.isEmpty {
|
||||
|
|
@ -24,10 +25,12 @@ struct MainTabView: View {
|
|||
.tabItem {
|
||||
Label("Home", systemImage: "house")
|
||||
}
|
||||
ScriptListView()
|
||||
.tabItem {
|
||||
Label("Scripts", systemImage: "scroll")
|
||||
}
|
||||
if enableAdvancedOptions {
|
||||
ScriptListView()
|
||||
.tabItem {
|
||||
Label("Scripts", systemImage: "scroll")
|
||||
}
|
||||
}
|
||||
SettingsView()
|
||||
.tabItem {
|
||||
Label("Settings", systemImage: "gearshape.fill")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ struct SettingsView: View {
|
|||
@AppStorage("customAccentColor") private var customAccentColorHex: String = ""
|
||||
@AppStorage("selectedAppIcon") private var selectedAppIcon: String = "AppIcon"
|
||||
@AppStorage("useDefaultScript") private var useDefaultScript = false
|
||||
@AppStorage("enableAdvancedOptions") private var enableAdvancedOptions = false
|
||||
|
||||
@State private var isShowingPairingFilePicker = false
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
|
@ -274,6 +275,10 @@ struct SettingsView: View {
|
|||
Toggle("Run Default Script After Connecting", isOn: $useDefaultScript)
|
||||
.foregroundColor(.primary)
|
||||
.padding(.vertical, 6)
|
||||
|
||||
Toggle("Enable Advanced Options", isOn: $enableAdvancedOptions)
|
||||
.foregroundColor(.primary)
|
||||
.padding(.vertical, 6)
|
||||
}
|
||||
.padding(.vertical, 20)
|
||||
.padding(.horizontal, 16)
|
||||
|
|
|
|||
|
|
@ -29,3 +29,5 @@
|
|||
"StikJIT only supports 17.4 and above. Your device is running iOS/iPadOS %@" = "StikJIT only supports 17.4 and above. Your device is running iOS/iPadOS %@";
|
||||
"Cancel" = "Cancel";
|
||||
"OK" = "OK";
|
||||
|
||||
"Enable Advanced Options" = "Enable Advanced Options";
|
||||
|
|
|
|||
|
|
@ -29,3 +29,5 @@
|
|||
"StikJIT only supports 17.4 and above. Your device is running iOS/iPadOS %@" = "StikJIT solo es compatible con la versi\u00f3n 17.4 o superior. Tu dispositivo ejecuta iOS/iPadOS %@";
|
||||
"Cancel" = "Cancelar";
|
||||
"OK" = "Aceptar";
|
||||
|
||||
"Enable Advanced Options" = "Habilitar opciones avanzadas";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue