28 lines
704 B
Swift
28 lines
704 B
Swift
import Foundation
|
|
import CryptoKit
|
|
|
|
enum ConnectionStrategy: Int, CaseIterable, Identifiable {
|
|
case local = 0
|
|
case remote = 1
|
|
case localFirst = 2
|
|
case remoteFirst = 3
|
|
|
|
var id: Int { rawValue }
|
|
|
|
var transmissionTypes: [TransmissionType] {
|
|
switch self {
|
|
case .local: return [.overLocalWifi]
|
|
case .localFirst: return [.overLocalWifi, .throughServer]
|
|
case .remote: return [.throughServer]
|
|
case .remoteFirst: return [.throughServer, .overLocalWifi]
|
|
}
|
|
}
|
|
}
|
|
|
|
extension ConnectionStrategy: CustomStringConvertible {
|
|
|
|
var description: String {
|
|
transmissionTypes.map { $0.displayName }.joined(separator: " + ")
|
|
}
|
|
}
|