StikDebug/StikJIT/Utilities/Extensions.swift
Stephen B 06b64192c4 Add device library and external device support (Semi WIP)
Introduces DeviceLibraryStore and DeviceConnectionContext to manage external device profiles and connections. Updates app logic to support switching between local loopback VPN and direct external device connections, including UI for device management and improved connection handling throughout the app.
2025-12-06 15:20:23 -05:00

31 lines
1.1 KiB
Swift

//
// Extensions.swift
// StikDebug
//
// Created by s s on 2025/7/9.
//
import UniformTypeIdentifiers
extension FileManager {
func filePath(atPath path: String, withLength length: Int) -> String? {
guard let file = try? contentsOfDirectory(atPath: path).filter({ $0.count == length }).first else { return nil }
return "\(path)/\(file)"
}
}
extension UIDocumentPickerViewController {
@objc func fix_init(forOpeningContentTypes contentTypes: [UTType], asCopy: Bool) -> 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"
/// Controls whether BGContinuedProcessingTask should be used to keep scripts alive in the background.
static let enableContinuedProcessing = "enableContinuedProcessing"
/// Tracks whether an external device profile is currently active.
static let usingExternalDevice = "UsingExternalDevice"
}
}