mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 04:20:30 +00:00
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.
25 lines
571 B
Swift
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"
|
|
}
|
|
}
|