StikDebug/StikJIT/Utilities/DeviceConnectionContext.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

25 lines
571 B
Swift

//
// DeviceConnectionContext.swift
// StikJIT
//
// Created by Stephen.
//
import Foundation
enum DeviceConnectionContext {
static var isUsingExternalDevice: Bool {
DeviceLibraryStore.shared.isUsingExternalDevice
}
static var requiresLoopbackVPN: Bool {
!isUsingExternalDevice
}
static var targetIPAddress: String {
if let device = DeviceLibraryStore.shared.activeDevice {
return device.ipAddress
}
return UserDefaults.standard.string(forKey: "TunnelDeviceIP") ?? "10.7.0.2"
}
}