Make AI, MCP, Metrics, and Wake-on-LAN free while retaining iCloud sync as a Pro feature. Limit free accounts to three saved hosts and preserve excess hosts with remote-operation locks. Gate host creation, import, and runtime access; preserve stable host admission across persistence and sync. Add upgrade states on macOS and iOS, open the paywall from locked Wake actions, and use wrench icons for MCP. Include regression coverage, opt-in UI review fixtures, localized copy, and the updated pricing website revision.
27 lines
836 B
Swift
27 lines
836 B
Swift
import TermindDomain
|
|
|
|
import struct TermindDomain.Host
|
|
|
|
public nonisolated enum HostWakeOutcome: Equatable, Sendable {
|
|
case accessDenied
|
|
case configurationRequired
|
|
case sent
|
|
case failed
|
|
}
|
|
|
|
extension HostLibraryModel {
|
|
/// Lock checks precede configuration and packet transmission.
|
|
public func requestWake(_ proposed: Host) -> HostWakeOutcome {
|
|
guard (try? hostAccess.requireAccess(to: proposed.id, in: hosts)) != nil else { return .accessDenied }
|
|
let host = host(proposed.id) ?? proposed
|
|
guard host.wakeOnLAN.address != nil else { return .configurationRequired }
|
|
do {
|
|
guard let wakeOnLAN else { throw WakeOnLANError.noLocalNetwork }
|
|
try wakeOnLAN.wake(host.wakeOnLAN)
|
|
return .sent
|
|
} catch {
|
|
return .failed
|
|
}
|
|
}
|
|
}
|