Sesame-iOS/Sesame/Common/ConnectionStrategy.swift
Christoph Hagen f284696e21 Improve texts
2023-12-20 19:04:48 +01:00

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: " + ")
}
}