-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathBondingManager.swift
More file actions
66 lines (54 loc) · 1.91 KB
/
Copy pathBondingManager.swift
File metadata and controls
66 lines (54 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright © 2024 Snap, Inc. All rights reserved.
public import Foundation
// MARK: - BondingManager Protocol
public protocol BondingManager: Sendable {
func bind(request: BondingRequest, deeplinkAsyncStream: AsyncStream<URL>) async -> BondingResult
func unbind(id: String, deeplinkAsyncStream: AsyncStream<URL>) async -> BondingResult
func availableBondings() -> [any Bonding]
func getBonding(id: String) -> (any Bonding)?
func createSession(
bonding: any Bonding,
request: SessionRequest,
delegateBuilder: @escaping (any SpectaclesSession) -> any SpectaclesRequestDelegate
) throws -> any SpectaclesSession
}
public struct ClientIdentifier: Sendable {
public let clientId: String
public let appName: String
public enum ClientIdentifierError: Error {
case emptyValue
}
public init?(clientId: String, appName: String) {
guard !clientId.isEmpty else {
return nil
}
self.clientId = clientId
self.appName = appName
}
}
public protocol Authentication: Sendable {
// We haven't finalized the authentication solution yet,
// and will provide the details once it's confirmed.
}
public protocol Bonding: Sendable {
var id: String { get }
}
public typealias BondingResult = Result<any Bonding, any Error>
public enum BondingRequest: Sendable {
case singleLens(lensId: String)
case singleLensByName(lensName: String)
}
public struct SessionRequest: Sendable {
public let autoReconnect: Bool
public let acceptUnfusedSpectacles: Bool
public let acceptUntrustedLenses: Bool
public init(
autoReconnect: Bool = true,
acceptUnfusedSpectacles: Bool = false,
acceptUntrustedLenses: Bool = false
) {
self.autoReconnect = autoReconnect
self.acceptUnfusedSpectacles = acceptUnfusedSpectacles
self.acceptUntrustedLenses = acceptUntrustedLenses
}
}