diff --git a/AirSync.xcodeproj/project.pbxproj b/AirSync.xcodeproj/project.pbxproj index 9271129b..674c6c89 100644 --- a/AirSync.xcodeproj/project.pbxproj +++ b/AirSync.xcodeproj/project.pbxproj @@ -7,6 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + B94971602F62509A00F59BC9 /* BigInt in Frameworks */ = {isa = PBXBuildFile; productRef = B949715F2F62509A00F59BC9 /* BigInt */; }; + B94971632F6250DE00F59BC9 /* ASN1 in Frameworks */ = {isa = PBXBuildFile; productRef = B94971622F6250DE00F59BC9 /* ASN1 */; }; + B94971662F62514500F59BC9 /* SwiftECC in Frameworks */ = {isa = PBXBuildFile; productRef = B94971652F62514500F59BC9 /* SwiftECC */; }; + B94971692F62525800F59BC9 /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = B94971682F62525800F59BC9 /* SwiftProtobuf */; }; + B949716B2F62525800F59BC9 /* SwiftProtobufPluginLibrary in Frameworks */ = {isa = PBXBuildFile; productRef = B949716A2F62525800F59BC9 /* SwiftProtobufPluginLibrary */; }; B995A3332E4D2B3F00FA7A41 /* AppIcon-uni.icon in Resources */ = {isa = PBXBuildFile; fileRef = B995A3322E4D2B3F00FA7A41 /* AppIcon-uni.icon */; }; B9AEBC0A2E6235D3006BA027 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = B9AEBC092E6235D3006BA027 /* Sparkle */; }; B9B1C00D2E94E15D0005F6CB /* LottieUI in Frameworks */ = {isa = PBXBuildFile; productRef = B9B1C00C2E94E15D0005F6CB /* LottieUI */; }; @@ -52,11 +57,16 @@ buildActionMask = 2147483647; files = ( B9D2631B2F60D97900628704 /* Sentry in Frameworks */, + B94971602F62509A00F59BC9 /* BigInt in Frameworks */, B9D263292F60D9CF00628704 /* SentrySwiftUI in Frameworks */, + B94971692F62525800F59BC9 /* SwiftProtobuf in Frameworks */, B9AEBC0A2E6235D3006BA027 /* Sparkle in Frameworks */, + B94971662F62514500F59BC9 /* SwiftECC in Frameworks */, B9D742FC2E39CF850053128A /* Swifter in Frameworks */, B9C3181E2E37AA1D00367F16 /* QRCode in Frameworks */, B9B1C00D2E94E15D0005F6CB /* LottieUI in Frameworks */, + B949716B2F62525800F59BC9 /* SwiftProtobufPluginLibrary in Frameworks */, + B94971632F6250DE00F59BC9 /* ASN1 in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -114,6 +124,11 @@ B9B1C00C2E94E15D0005F6CB /* LottieUI */, B9D2631A2F60D97900628704 /* Sentry */, B9D263282F60D9CF00628704 /* SentrySwiftUI */, + B949715F2F62509A00F59BC9 /* BigInt */, + B94971622F6250DE00F59BC9 /* ASN1 */, + B94971652F62514500F59BC9 /* SwiftECC */, + B94971682F62525800F59BC9 /* SwiftProtobuf */, + B949716A2F62525800F59BC9 /* SwiftProtobufPluginLibrary */, ); productName = "airsync-mac"; productReference = B9673B572E35A2A1006D284A /* AirSync.app */; @@ -149,6 +164,10 @@ B9AEBC082E6235D3006BA027 /* XCRemoteSwiftPackageReference "Sparkle" */, B9B1C00B2E94E15D0005F6CB /* XCRemoteSwiftPackageReference "LottieUI" */, B9D263162F60D26700628704 /* XCRemoteSwiftPackageReference "sentry-cocoa" */, + B949715E2F62509A00F59BC9 /* XCRemoteSwiftPackageReference "BigInt" */, + B94971612F6250DE00F59BC9 /* XCRemoteSwiftPackageReference "ASN1" */, + B94971642F62514500F59BC9 /* XCRemoteSwiftPackageReference "SwiftECC" */, + B94971672F62525800F59BC9 /* XCRemoteSwiftPackageReference "swift-protobuf" */, ); preferredProjectObjectVersion = 77; productRefGroup = B9673B582E35A2A1006D284A /* Products */; @@ -542,6 +561,38 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ + B949715E2F62509A00F59BC9 /* XCRemoteSwiftPackageReference "BigInt" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/leif-ibsen/BigInt"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 1.22.0; + }; + }; + B94971612F6250DE00F59BC9 /* XCRemoteSwiftPackageReference "ASN1" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/leif-ibsen/ASN1"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.7.0; + }; + }; + B94971642F62514500F59BC9 /* XCRemoteSwiftPackageReference "SwiftECC" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/leif-ibsen/SwiftECC"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 5.5.0; + }; + }; + B94971672F62525800F59BC9 /* XCRemoteSwiftPackageReference "swift-protobuf" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/apple/swift-protobuf.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 1.36.0; + }; + }; B9AEBC082E6235D3006BA027 /* XCRemoteSwiftPackageReference "Sparkle" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/sparkle-project/Sparkle"; @@ -585,6 +636,31 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + B949715F2F62509A00F59BC9 /* BigInt */ = { + isa = XCSwiftPackageProductDependency; + package = B949715E2F62509A00F59BC9 /* XCRemoteSwiftPackageReference "BigInt" */; + productName = BigInt; + }; + B94971622F6250DE00F59BC9 /* ASN1 */ = { + isa = XCSwiftPackageProductDependency; + package = B94971612F6250DE00F59BC9 /* XCRemoteSwiftPackageReference "ASN1" */; + productName = ASN1; + }; + B94971652F62514500F59BC9 /* SwiftECC */ = { + isa = XCSwiftPackageProductDependency; + package = B94971642F62514500F59BC9 /* XCRemoteSwiftPackageReference "SwiftECC" */; + productName = SwiftECC; + }; + B94971682F62525800F59BC9 /* SwiftProtobuf */ = { + isa = XCSwiftPackageProductDependency; + package = B94971672F62525800F59BC9 /* XCRemoteSwiftPackageReference "swift-protobuf" */; + productName = SwiftProtobuf; + }; + B949716A2F62525800F59BC9 /* SwiftProtobufPluginLibrary */ = { + isa = XCSwiftPackageProductDependency; + package = B94971672F62525800F59BC9 /* XCRemoteSwiftPackageReference "swift-protobuf" */; + productName = SwiftProtobufPluginLibrary; + }; B9AEBC092E6235D3006BA027 /* Sparkle */ = { isa = XCSwiftPackageProductDependency; package = B9AEBC082E6235D3006BA027 /* XCRemoteSwiftPackageReference "Sparkle" */; diff --git a/AirSync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AirSync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index feee0794..5f680032 100644 --- a/AirSync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AirSync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,6 +1,33 @@ { - "originHash" : "026803ee83a0d19508aba90df6f960df300fa6d5f03714ba5c27057052f8d872", + "originHash" : "3a9dd44284e893e29974876842b0280bd4676a75ec2a6c65c874e664d9730f2a", "pins" : [ + { + "identity" : "asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/leif-ibsen/ASN1", + "state" : { + "revision" : "e38d1b8b43d8b53ffadde9836f34289176bb7a0c", + "version" : "2.7.0" + } + }, + { + "identity" : "bigint", + "kind" : "remoteSourceControl", + "location" : "https://github.com/leif-ibsen/BigInt", + "state" : { + "revision" : "8c6f93aa37504b7b1ba3954335b5548a19fbbd82", + "version" : "1.22.0" + } + }, + { + "identity" : "digest", + "kind" : "remoteSourceControl", + "location" : "https://github.com/leif-ibsen/Digest", + "state" : { + "revision" : "95ba89b494aaff5f3cd2933c03b9a890323dbf2c", + "version" : "1.13.0" + } + }, { "identity" : "lottie-spm", "kind" : "remoteSourceControl", @@ -46,6 +73,15 @@ "version" : "2.7.1" } }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "86970144a0b86068c81ff48ee29b3f97cae0b879", + "version" : "1.36.0" + } + }, { "identity" : "swift-qrcode-generator", "kind" : "remoteSourceControl", @@ -55,6 +91,15 @@ "version" : "2.0.2" } }, + { + "identity" : "swiftecc", + "kind" : "remoteSourceControl", + "location" : "https://github.com/leif-ibsen/SwiftECC", + "state" : { + "revision" : "85c529c9c56b649a8d8edcef60aab3925ab0f69f", + "version" : "5.5.0" + } + }, { "identity" : "swifter", "kind" : "remoteSourceControl", diff --git a/airsync-mac/AirSync-Bridging-Header.h b/airsync-mac/AirSync-Bridging-Header.h new file mode 100644 index 00000000..fa1539f0 --- /dev/null +++ b/airsync-mac/AirSync-Bridging-Header.h @@ -0,0 +1,6 @@ +// +// AirSync-Bridging-Header.h +// AirSync +// + +#import "Core/QuickShare/NDNotificationCenterHackery.h" diff --git a/airsync-mac/Components/Custom/DropTargetModifier.swift b/airsync-mac/Components/Custom/DropTargetModifier.swift index c880b500..e75a13e9 100644 --- a/airsync-mac/Components/Custom/DropTargetModifier.swift +++ b/airsync-mac/Components/Custom/DropTargetModifier.swift @@ -7,68 +7,119 @@ import SwiftUI import UniformTypeIdentifiers +import Foundation +import AppKit struct DropTargetModifier: ViewModifier { @State private var isTargeted = false + @State private var dragLabel: String = "" let appState: AppState func body(content: Content) -> some View { content - .onDrop(of: [.plainText, .fileURL], isTargeted: $isTargeted) { providers in - handleDrop(providers: providers) - return true - } + .onDrop(of: [.plainText, .fileURL], delegate: QuickShareDropDelegate( + appState: appState, + isTargeted: $isTargeted, + dragLabel: $dragLabel + )) .overlay( Group { if isTargeted { - DropTargetOverlay() + DropTargetOverlay(label: dragLabel) } } ) } +} - private func handleDrop(providers: [NSItemProvider]) { - guard appState.device != nil else { - // Show notification if no device connected - appState.postNativeNotification( - id: "no_device", - appName: "AirSync", - title: "No Device Connected", - body: "Connect an Android device first to send text" - ) - return +struct QuickShareDropDelegate: DropDelegate { + let appState: AppState + @Binding var isTargeted: Bool + @Binding var dragLabel: String + + private func updateLabel() { + let optionPressed = NSEvent.modifierFlags.contains(.option) + if optionPressed { + dragLabel = Localizer.shared.text("quickshare.drop.pick_device") + } else if let deviceName = appState.device?.name { + dragLabel = String(format: Localizer.shared.text("quickshare.drop.send_to"), deviceName) + } else { + dragLabel = Localizer.shared.text("quickshare.drop.pick_device") } + } + + func dropEntered(info: DropInfo) { + isTargeted = true + updateLabel() + } + + func dropUpdated(info: DropInfo) -> DropOperation? { + updateLabel() + return .copy + } + + func dropExited(info: DropInfo) { + isTargeted = false + } + + func performDrop(info: DropInfo) -> Bool { + isTargeted = false + + let providers = info.itemProviders(for: [.plainText, .fileURL]) + handleDrop(providers: providers) + return true + } + + private func handleDrop(providers: [NSItemProvider]) { + let group = DispatchGroup() + var urls: [URL] = [] + let urlLock = NSLock() + var text: String? + let textLock = NSLock() for provider in providers { - if provider.hasItemConformingToTypeIdentifier(UTType.plainText.identifier) { - provider.loadItem(forTypeIdentifier: UTType.plainText.identifier, options: nil) { item, error in - if let text = item as? String ?? (item as? Data).flatMap({ String(data: $0, encoding: .utf8) }) { - DispatchQueue.main.async { - sendTextToDevice(text) - } + if provider.canLoadObject(ofClass: URL.self) { + group.enter() + _ = provider.loadObject(ofClass: URL.self) { url, error in + if let url = url { + urlLock.lock() + urls.append(url) + urlLock.unlock() } + group.leave() } - return - } else if provider.hasItemConformingToTypeIdentifier(UTType.fileURL.identifier) { - provider.loadItem(forTypeIdentifier: UTType.fileURL.identifier, options: nil) { item, error in - guard let url = (item as? URL) ?? (item as? Data).flatMap({ URL(dataRepresentation: $0, relativeTo: nil) }) else { return } - - // Initiate file transfer - DispatchQueue.main.async { - WebSocketServer.shared.sendFile(url: url) + } else if provider.hasItemConformingToTypeIdentifier(UTType.plainText.identifier) { + group.enter() + provider.loadItem(forTypeIdentifier: UTType.plainText.identifier, options: nil) { item, error in + if let s = item as? String ?? (item as? Data).flatMap({ String(data: $0, encoding: .utf8) }) { + textLock.lock() + text = s + textLock.unlock() } + group.leave() } - return } } - } - private func sendTextToDevice(_ text: String) { - appState.sendClipboardToAndroid(text: text) + group.notify(queue: .main) { + if !urls.isEmpty { + let optionPressed = NSEvent.modifierFlags.contains(.option) + let connectedDeviceName = appState.device?.name + let targetName = (!optionPressed) ? connectedDeviceName : nil + + QuickShareManager.shared.startDiscovery(autoTargetName: targetName) + QuickShareManager.shared.transferURLs = urls + appState.showingQuickShareTransfer = true + } else if let text = text { + appState.sendClipboardToAndroid(text: text) + } + } } } struct DropTargetOverlay: View { + let label: String + var body: some View { ZStack { RoundedRectangle(cornerRadius: 12) @@ -78,9 +129,16 @@ struct DropTargetOverlay: View { .stroke(Color.accentColor, style: StrokeStyle(lineWidth: 3, dash: [10, 5])) .padding(8) - Image(systemName: "arrow.up.circle.fill") - .font(.system(size: 64, weight: .semibold)) - .foregroundColor(.accentColor) + VStack(spacing: 16) { + Image(systemName: "arrow.up.circle.fill") + .font(.system(size: 48, weight: .semibold)) + .foregroundColor(.accentColor) + + Text(label) + .font(.headline) + .multilineTextAlignment(.center) + .padding(.horizontal) + } } .padding(4) .allowsHitTesting(false) @@ -88,7 +146,7 @@ struct DropTargetOverlay: View { } extension View { - func dropTarget(appState: AppState) -> some View { + func dropTarget(appState: AppState, autoTargetName: String? = nil) -> some View { self.modifier(DropTargetModifier(appState: appState)) } } diff --git a/airsync-mac/Components/Custom/RadarView.swift b/airsync-mac/Components/Custom/RadarView.swift new file mode 100644 index 00000000..db0e3dac --- /dev/null +++ b/airsync-mac/Components/Custom/RadarView.swift @@ -0,0 +1,112 @@ +// +// RadarView.swift +// airsync-mac +// +// Created by AI Assistant on 2026-03-12. +// + +import SwiftUI + +struct RadarView: View { + let devices: [RemoteDeviceInfo] + let onDeviceSelected: (RemoteDeviceInfo) -> Void + + @State private var animateCircles = false + + var body: some View { + ZStack { + // Animated concentric circles + ZStack { + Circle() + .stroke(Color.accentColor.opacity(1), lineWidth: 4) + .scaleEffect(animateCircles ? 1.0 : 0.0) + .opacity(animateCircles ? 0.0 : 1.0) + + Circle() + .stroke(Color.accentColor.opacity(1), lineWidth: 4) + .scaleEffect(animateCircles ? 1.0 : 0.0) + .opacity(animateCircles ? 0.0 : 0.8) + .animation(.linear(duration: 4).repeatForever(autoreverses: false).delay(1), value: animateCircles) + + Circle() + .stroke(Color.accentColor.opacity(1), lineWidth: 4) + .scaleEffect(animateCircles ? 1.0 : 0.0) + .opacity(animateCircles ? 0.0 : 0.6) + .animation(.linear(duration: 4).repeatForever(autoreverses: false).delay(2), value: animateCircles) + } + .frame(width: 250, height: 250) // Constrain circles to center + .onAppear { + withAnimation(.linear(duration: 4).repeatForever(autoreverses: false)) { + animateCircles = true + } + } + + // Central "Self" node with Glass effect + GlassBoxView(width: 44, height: 44, radius: 22) + .overlay( + Image(systemName: "antenna.radiowaves.left.and.right") + .font(.title3) + .foregroundStyle(Color.accentColor) + ) + + // Discovered devices far away + ForEach(devices, id: \.id) { device in + // Find index to calculate position + let index = devices.firstIndex(where: { $0.id == device.id }) ?? 0 + DeviceNodeView(device: device, index: index, total: devices.count) { + onDeviceSelected(device) + } + .transition(.asymmetric( + insertion: .scale.combined(with: .opacity), + removal: .scale(scale: 0.1).combined(with: .opacity) + )) + } + } + .frame(maxWidth: .infinity, minHeight: 300) + .animation(.spring(response: 0.8, dampingFraction: 0.7, blendDuration: 0.5), value: devices) + } +} + +struct DeviceNodeView: View { + let device: RemoteDeviceInfo + let index: Int + let total: Int + let action: () -> Void + + var body: some View { + let angle = Double(index) * (2.0 * .pi / Double(max(total, 1))) + let radius: CGFloat = 100 // Increased orbital distance + let x = cos(angle) * radius + let y = sin(angle) * radius + + Button(action: action) { + VStack(spacing: 6) { + ZStack { + GlassBoxView(width: 70, height: 70, radius: 35) // Bigger node + .overlay( + Image(systemName: iconForDeviceType(device.type)) + .font(.system(size: 28)) // Bigger icon + ) + } + + Text(device.name) + .font(.caption) + .bold() + .lineLimit(2) // Support 2 lines + .multilineTextAlignment(.center) + .frame(width: 90) + } + } + .buttonStyle(.plain) + .offset(x: x, y: y) + } + + private func iconForDeviceType(_ type: RemoteDeviceInfo.DeviceType) -> String { + switch type { + case .phone: return "iphone" + case .tablet: return "ipad" + case .computer: return "macbook" + default: return "questionmark.circle" + } + } +} diff --git a/airsync-mac/Core/AppDelegate.swift b/airsync-mac/Core/AppDelegate.swift index ca2bea00..0cf1339b 100644 --- a/airsync-mac/Core/AppDelegate.swift +++ b/airsync-mac/Core/AppDelegate.swift @@ -35,6 +35,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate { // Initialize Menu Bar Manager menuBarManager = MenuBarManager.shared + + // Initialize Quick Share + _ = QuickShareManager.shared // Register Services Provider NSApp.servicesProvider = self @@ -46,18 +49,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate { } func application(_ application: NSApplication, open urls: [URL]) { - for url in urls { - print("[AppDelegate] Opening file: \(url.path)") - WebSocketServer.shared.sendFile(url: url) + if !urls.isEmpty { + QuickShareManager.shared.startDiscovery(autoTargetName: nil) + QuickShareManager.shared.transferURLs = urls + AppState.shared.showingQuickShareTransfer = true } } @objc func handleServices(_ pboard: NSPasteboard, userData: String, error: AutoreleasingUnsafeMutablePointer) { - if let urls = pboard.readObjects(forClasses: [NSURL.self], options: nil) as? [URL] { - for url in urls { - print("[AppDelegate] Services menu received file: \(url.path)") - WebSocketServer.shared.sendFile(url: url) - } + if let urls = pboard.readObjects(forClasses: [NSURL.self], options: nil) as? [URL], !urls.isEmpty { + QuickShareManager.shared.startDiscovery(autoTargetName: nil) + QuickShareManager.shared.transferURLs = urls + AppState.shared.showingQuickShareTransfer = true } } diff --git a/airsync-mac/Core/AppState.swift b/airsync-mac/Core/AppState.swift index 248f47e2..73411148 100644 --- a/airsync-mac/Core/AppState.swift +++ b/airsync-mac/Core/AppState.swift @@ -7,7 +7,7 @@ import SwiftUI import Foundation import Cocoa -internal import Combine +import Combine import UserNotifications import AVFoundation @@ -53,7 +53,8 @@ class AppState: ObservableObject { self.notificationSound = UserDefaults.standard.string(forKey: "notificationSound") ?? "default" self.dismissNotif = UserDefaults.standard.bool(forKey: "dismissNotif") - self.showFileShareDialog = UserDefaults.standard.object(forKey: "showFileShareDialog") == nil ? true : UserDefaults.standard.bool(forKey: "showFileShareDialog") + self.autoAcceptQuickShare = UserDefaults.standard.bool(forKey: "autoAcceptQuickShare") + self.quickShareEnabled = UserDefaults.standard.object(forKey: "quickShareEnabled") == nil ? true : UserDefaults.standard.bool(forKey: "quickShareEnabled") let savedNotificationMode = UserDefaults.standard.string(forKey: "callNotificationMode") ?? CallNotificationMode.popup.rawValue self.callNotificationMode = CallNotificationMode(rawValue: savedNotificationMode) ?? .popup @@ -325,9 +326,15 @@ class AppState: ObservableObject { } } - @Published var showFileShareDialog: Bool { + @Published var autoAcceptQuickShare: Bool { didSet { - UserDefaults.standard.set(showFileShareDialog, forKey: "showFileShareDialog") + UserDefaults.standard.set(autoAcceptQuickShare, forKey: "autoAcceptQuickShare") + } + } + + @Published var quickShareEnabled: Bool { + didSet { + UserDefaults.standard.set(quickShareEnabled, forKey: "quickShareEnabled") } } @@ -376,6 +383,7 @@ class AppState: ObservableObject { // ADB Transfer Progress @Published var isADBTransferring: Bool = false @Published var adbTransferringFilePath: String? = nil + @Published var showingQuickShareTransfer = false @Published var showHiddenFiles: Bool = false { didSet { @@ -384,10 +392,6 @@ class AppState: ObservableObject { } } - // File transfer tracking state - @Published var transfers: [String: FileTransferSession] = [:] - @Published var activeTransferId: String? = nil - var transferDismissTimer: Timer? // Toggle licensing let licenseCheck: Bool = true @@ -667,7 +671,11 @@ class AppState: ObservableObject { self.notifications.removeAll() self.status = nil self.currentDeviceWallpaperBase64 = nil - self.transfers = [:] + + // Clean up Quick Share state + if QuickShareManager.shared.transferState != .idle { + QuickShareManager.shared.transferState = .idle + } if self.adbConnected { ADBConnector.disconnectADB() diff --git a/airsync-mac/Core/Discovery/UDPDiscoveryManager.swift b/airsync-mac/Core/Discovery/UDPDiscoveryManager.swift index 882d47ea..431f3a45 100644 --- a/airsync-mac/Core/Discovery/UDPDiscoveryManager.swift +++ b/airsync-mac/Core/Discovery/UDPDiscoveryManager.swift @@ -1,6 +1,6 @@ import Foundation import Network -internal import Combine +import Combine import SwiftUI struct DiscoveredDevice: Identifiable, Equatable, Hashable { diff --git a/airsync-mac/Core/MenuBarManager.swift b/airsync-mac/Core/MenuBarManager.swift index 1f768fac..621539f0 100644 --- a/airsync-mac/Core/MenuBarManager.swift +++ b/airsync-mac/Core/MenuBarManager.swift @@ -7,7 +7,7 @@ import SwiftUI import AppKit -internal import Combine +import Combine class MenuBarManager: NSObject { static let shared = MenuBarManager() @@ -17,6 +17,7 @@ class MenuBarManager: NSObject { private var eventMonitor: Any? private var cancellables = Set() private var appState = AppState.shared + private var temporaryDragLabel: String? private let statusButton: MenuBarStatusButton = { let view = MenuBarStatusButton(frame: NSRect(x: 0, y: 0, width: 22, height: 22)) @@ -37,9 +38,6 @@ class MenuBarManager: NSObject { statusButton.clickHandler = { [weak self] in self?.togglePopover() } - statusButton.dragEnteredHandler = { [weak self] in - self?.showPopover() - } // Add statusButton as a subview of the statusItem's button to handle events button.addSubview(statusButton) @@ -65,17 +63,19 @@ class MenuBarManager: NSObject { private func setupBindings() { // Update menu bar when appState changes - Publishers.Merge4( + Publishers.Merge5( appState.$device.map { _ in () }, appState.$notifications.map { _ in () }, appState.$status.map { _ in () }, - appState.$showMenubarText.map { _ in () } + appState.$showMenubarText.map { _ in () }, + appState.$showingQuickShareTransfer.map { _ in () } ) .receive(on: RunLoop.main) .sink { [weak self] in self?.updateStatusItem() } .store(in: &cancellables) + } func updateStatusItem() { @@ -90,13 +90,25 @@ class MenuBarManager: NSObject { button.imagePosition = .imageLeft // Update text if enabled - if appState.showMenubarText, let text = getDeviceStatusText() { + if let dragLabel = temporaryDragLabel { + button.title = dragLabel + } else if appState.showMenubarText, let text = getDeviceStatusText() { button.title = text } else { button.title = "" } } + func showDragLabel(_ label: String) { + temporaryDragLabel = label + updateStatusItem() + } + + func clearDragLabel() { + temporaryDragLabel = nil + updateStatusItem() + } + private func getDeviceStatusText() -> String? { guard let device = appState.device else { return nil } @@ -165,6 +177,7 @@ class MenuBarStatusButton: NSView { var statusItem: NSStatusItem? var clickHandler: (() -> Void)? var dragEnteredHandler: (() -> Void)? + var dragExitedHandler: (() -> Void)? override init(frame frameRect: NSRect) { super.init(frame: frameRect) @@ -182,13 +195,60 @@ class MenuBarStatusButton: NSView { // MARK: - Drag and Drop override func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation { - guard AppState.shared.device != nil else { return [] } + updateDragLabel() dragEnteredHandler?() return .copy } override func draggingUpdated(_ sender: NSDraggingInfo) -> NSDragOperation { - guard AppState.shared.device != nil else { return [] } + updateDragLabel() return .copy } + + override func draggingExited(_ sender: NSDraggingInfo?) { + MenuBarManager.shared.clearDragLabel() + dragExitedHandler?() + } + + private func updateDragLabel() { + let optionPressed = NSEvent.modifierFlags.contains(.option) + let label: String + if optionPressed { + label = Localizer.shared.text("quickshare.drop.pick_device") + } else if let deviceName = AppState.shared.device?.name { + label = String(format: Localizer.shared.text("quickshare.drop.send_to"), deviceName) + } else { + label = Localizer.shared.text("quickshare.drop.pick_device") + } + MenuBarManager.shared.showDragLabel(label) + } + + override func performDragOperation(_ sender: NSDraggingInfo) -> Bool { + MenuBarManager.shared.clearDragLabel() + let pboard = sender.draggingPasteboard + + // Handle file URLs + if let urls = pboard.readObjects(forClasses: [NSURL.self], options: nil) as? [URL], !urls.isEmpty { + DispatchQueue.main.async { + let optionPressed = NSEvent.modifierFlags.contains(.option) + let connectedDeviceName = AppState.shared.device?.name + let autoTargetName = (!optionPressed) ? connectedDeviceName : nil + + QuickShareManager.shared.transferURLs = urls + QuickShareManager.shared.startDiscovery(autoTargetName: autoTargetName) + AppState.shared.showingQuickShareTransfer = true + } + return true + } + + // Handle strings + if let strings = pboard.readObjects(forClasses: [NSString.self], options: nil) as? [String], let text = strings.first { + DispatchQueue.main.async { + AppState.shared.sendClipboardToAndroid(text: text) + } + return true + } + + return false + } } diff --git a/airsync-mac/Core/QuickConnect/QuickConnectManager.swift b/airsync-mac/Core/QuickConnect/QuickConnectManager.swift index d0080852..9a6c842c 100644 --- a/airsync-mac/Core/QuickConnect/QuickConnectManager.swift +++ b/airsync-mac/Core/QuickConnect/QuickConnectManager.swift @@ -6,7 +6,7 @@ // import Foundation -internal import Combine +import Combine /// Manages quick reconnection functionality for previously connected devices class QuickConnectManager: ObservableObject { diff --git a/airsync-mac/Core/QuickShare/Data+Extensions.swift b/airsync-mac/Core/QuickShare/Data+Extensions.swift new file mode 100644 index 00000000..5bf1a077 --- /dev/null +++ b/airsync-mac/Core/QuickShare/Data+Extensions.swift @@ -0,0 +1,54 @@ +// +// Data+URLSafeBase64.swift +// NearDrop +// +// Created by Grishka on 08.04.2023. +// + +import Foundation +import CoreFoundation + +extension Data{ + func urlSafeBase64EncodedString() -> String { + return String(base64EncodedString().replacingOccurrences(of: "=", with: "").map { + if $0=="/"{ + return "_" + } else if $0=="+" { + return "-" + } else { + return $0 + } + }) + } + + func suffixOfAtMost(numBytes:Int) -> Data{ + if count<=numBytes{ + return self; + } + return subdata(in: count-numBytes.. Data{ + var data=Data(count: length) + data.withUnsafeMutableBytes { + guard 0 == SecRandomCopyBytes(kSecRandomDefault, length, $0.baseAddress!) else { fatalError() } + } + return data + } + + static func dataFromUrlSafeBase64(_ str:String)->Data?{ + var regularB64=String(str.map{ + if $0=="_"{ + return "/" + }else if $0=="-"{ + return "+" + }else{ + return $0 + } + }) + while (regularB64.count%4) != 0{ + regularB64=regularB64+"=" + } + return Data(base64Encoded: regularB64, options: .ignoreUnknownCharacters) + } +} diff --git a/airsync-mac/Core/QuickShare/InboundNearbyConnection.swift b/airsync-mac/Core/QuickShare/InboundNearbyConnection.swift new file mode 100644 index 00000000..674ddf6f --- /dev/null +++ b/airsync-mac/Core/QuickShare/InboundNearbyConnection.swift @@ -0,0 +1,441 @@ +// +// InboundNearbyConnection.swift +// NearDrop +// +// Created by Grishka on 08.04.2023. +// + +import Foundation +import Network +import CryptoKit +import CommonCrypto +import System +import AppKit + +import SwiftECC +import BigInt +@preconcurrency import SwiftProtobuf + +@MainActor +public class InboundNearbyConnection: NearbyConnection{ + + private var currentState:State = .initial + public var delegate:InboundNearbyConnectionDelegate? + private var cipherCommitment:Data? + + private var textPayloadID:Int64=0 + + enum State{ + case initial, receivedConnectionRequest, sentUkeyServerInit, receivedUkeyClientFinish, sentConnectionResponse, sentPairedKeyResult, receivedPairedKeyResult, waitingForUserConsent, receivingFiles, disconnected + } + + override init(connection: NWConnection, id:String) { + super.init(connection: connection, id: id) + } + + override func handleConnectionClosure() { + super.handleConnectionClosure() + currentState = .disconnected + do{ + try deletePartiallyReceivedFiles() + }catch{ + print("Error deleting partially received files: \(error)") + } + DispatchQueue.main.async { + self.delegate?.connectionWasTerminated(connection: self, error: self.lastError) + } + } + + override internal func processReceivedFrame(frameData:Data){ + do{ + switch currentState { + case .initial: + let frame=try Location_Nearby_Connections_OfflineFrame(serializedData: frameData) + try processConnectionRequestFrame(frame) + case .receivedConnectionRequest: + let msg=try Securegcm_Ukey2Message(serializedData: frameData) + ukeyClientInitMsgData=frameData + try processUkey2ClientInit(msg) + case .sentUkeyServerInit: + let msg=try Securegcm_Ukey2Message(serializedData: frameData) + try processUkey2ClientFinish(msg, raw: frameData) + case .receivedUkeyClientFinish: + let frame=try Location_Nearby_Connections_OfflineFrame(serializedData: frameData) + try processConnectionResponseFrame(frame) + default: + let smsg=try Securemessage_SecureMessage(serializedBytes: frameData) + try decryptAndProcessReceivedSecureMessage(smsg) + } + }catch{ + lastError=error + print("Deserialization error: \(error) in state \(currentState)") +#if !DEBUG + protocolError() +#endif + } + } + + override internal func processTransferSetupFrame(_ frame:Sharing_Nearby_Frame) throws{ + if frame.hasV1 && frame.v1.hasType, case .cancel = frame.v1.type { + print("Transfer canceled") + try sendDisconnectionAndDisconnect() + return + } + switch currentState{ + case .sentConnectionResponse: + try processPairedKeyEncryptionFrame(frame) + case .sentPairedKeyResult: + if frame.v1.hasPairedKeyResult { + try processPairedKeyResultFrame(frame) + } + case .receivedPairedKeyResult: + if frame.v1.hasIntroduction { + try processIntroductionFrame(frame) + } else { + print("Received non-introduction setup frame in receivedPairedKeyResult state: \(frame.v1.type)") + } + case .receivingFiles: + if frame.v1.type == .progressUpdate { + return + } + print("Unexpected frame in receivingFiles state: \(frame.v1.type)") + default: + print("Unexpected connection state in processTransferSetupFrame: \(currentState)") + print(frame) + } + } + + override func isServer() -> Bool { + return true + } + + override func processFileChunk(frame: Location_Nearby_Connections_PayloadTransferFrame) throws{ + let id=frame.payloadHeader.id + guard let fileInfo=transferredFiles[id] else { throw NearbyError.protocolError("File payload ID \(id) is not known") } + let currentOffset=fileInfo.bytesTransferred + guard frame.payloadChunk.offset==currentOffset else { throw NearbyError.protocolError("Invalid offset into file \(frame.payloadChunk.offset), expected \(currentOffset)") } + guard currentOffset+Int64(frame.payloadChunk.body.count)<=fileInfo.meta.size else { throw NearbyError.protocolError("Transferred file size exceeds previously specified value") } + if frame.payloadChunk.body.count>0{ + fileInfo.fileHandle?.write(frame.payloadChunk.body) + transferredFiles[id]!.bytesTransferred+=Int64(frame.payloadChunk.body.count) + fileInfo.progress?.completedUnitCount=transferredFiles[id]!.bytesTransferred + let progress = Double(transferredFiles[id]!.bytesTransferred) / Double(fileInfo.meta.size) + delegate?.incomingTransferProgress(connection: self, id: String(id), progress: progress) + } + if (frame.payloadChunk.flags & 1)==1{ + try? fileInfo.fileHandle?.close() + transferredFiles[id]!.fileHandle=nil + fileInfo.progress?.unpublish() + transferredFiles.removeValue(forKey: id) + if transferredFiles.isEmpty{ + delegate?.transferDidComplete(connection: self) + sendDisconnectionAndDisconnect() + } + } + } + + override func processBytesPayload(payload: Data, id: Int64) throws -> Bool { + if id==textPayloadID{ + if let urlStr=String(data: payload, encoding: .utf8), let url=URL(string: urlStr){ + NSWorkspace.shared.open(url) + } + try sendDisconnectionAndDisconnect() + return true + }else if let fileInfo=transferredFiles[id]{ + fileInfo.fileHandle?.write(payload) + transferredFiles[id]!.bytesTransferred+=Int64(payload.count) + fileInfo.progress?.completedUnitCount=transferredFiles[id]!.bytesTransferred + let progress = Double(transferredFiles[id]!.bytesTransferred) / Double(fileInfo.meta.size) + delegate?.incomingTransferProgress(connection: self, id: String(id), progress: progress) + try fileInfo.fileHandle?.close() + transferredFiles[id]!.fileHandle=nil + fileInfo.progress?.unpublish() + transferredFiles.removeValue(forKey: id) + try sendDisconnectionAndDisconnect() + return true + } + return false + } + + private func processConnectionRequestFrame(_ frame:Location_Nearby_Connections_OfflineFrame) throws{ + guard frame.hasV1 && frame.v1.hasConnectionRequest && frame.v1.connectionRequest.hasEndpointInfo else { throw NearbyError.requiredFieldMissing("connectionRequest.endpointInfo") } + guard case .connectionRequest = frame.v1.type else { throw NearbyError.protocolError("Unexpected frame type \(frame.v1.type)") } + let endpointInfo=frame.v1.connectionRequest.endpointInfo + guard endpointInfo.count>17 else { throw NearbyError.protocolError("Endpoint info too short") } + let deviceNameLength=Int(endpointInfo[17]) + guard endpointInfo.count>=deviceNameLength+18 else { throw NearbyError.protocolError("Endpoint info too short to contain the device name") } + guard let deviceName=String(data: endpointInfo[18..<(18+deviceNameLength)], encoding: .utf8) else { throw NearbyError.protocolError("Device name is not valid UTF-8") } + let rawDeviceType:Int=Int(endpointInfo[0] & 7) >> 1 + remoteDeviceInfo=RemoteDeviceInfo(name: deviceName, type: RemoteDeviceInfo.DeviceType.fromRawValue(value: rawDeviceType)) + currentState = .receivedConnectionRequest + } + + private func processUkey2ClientInit(_ msg:Securegcm_Ukey2Message) throws{ + guard msg.hasMessageType, msg.hasMessageData else { throw NearbyError.requiredFieldMissing("clientInit ukey2message.type|data") } + guard case .clientInit = msg.messageType else{ + sendUkey2Alert(type: .badMessageType) + throw NearbyError.ukey2 + } + let clientInit:Securegcm_Ukey2ClientInit + do{ + clientInit=try Securegcm_Ukey2ClientInit(serializedBytes: msg.messageData) + }catch{ + sendUkey2Alert(type: .badMessageData) + throw NearbyError.ukey2 + } + guard clientInit.version==1 else{ + sendUkey2Alert(type: .badVersion) + throw NearbyError.ukey2 + } + guard clientInit.random.count==32 else{ + sendUkey2Alert(type: .badRandom) + throw NearbyError.ukey2 + } + var found=false + for commitment in clientInit.cipherCommitments{ + if case .p256Sha512 = commitment.handshakeCipher{ + found=true + cipherCommitment=commitment.commitment + break + } + } + guard found else{ + sendUkey2Alert(type: .badHandshakeCipher) + throw NearbyError.ukey2 + } + guard clientInit.nextProtocol=="AES_256_CBC-HMAC_SHA256" else{ + sendUkey2Alert(type: .badNextProtocol) + throw NearbyError.ukey2 + } + + let domain=Domain.instance(curve: .EC256r1) + let (pubKey, privKey)=domain.makeKeyPair() + publicKey=pubKey + privateKey=privKey + + var serverInit=Securegcm_Ukey2ServerInit() + serverInit.version=1 + serverInit.random=Data.randomData(length: 32) + serverInit.handshakeCipher = .p256Sha512 + + var pkey=Securemessage_GenericPublicKey() + pkey.type = .ecP256 + pkey.ecP256PublicKey=Securemessage_EcP256PublicKey() + pkey.ecP256PublicKey.x=Data(pubKey.w.x.asSignedBytes()) + pkey.ecP256PublicKey.y=Data(pubKey.w.y.asSignedBytes()) + serverInit.publicKey=try pkey.serializedData() + + var serverInitMsg=Securegcm_Ukey2Message() + serverInitMsg.messageType = .serverInit + serverInitMsg.messageData=try serverInit.serializedData() + let serverInitData=try serverInitMsg.serializedData() + ukeyServerInitMsgData=serverInitData + sendFrameAsync(serverInitData) + currentState = .sentUkeyServerInit + } + + private func processUkey2ClientFinish(_ msg:Securegcm_Ukey2Message, raw:Data) throws{ + guard msg.hasMessageType, msg.hasMessageData else { throw NearbyError.requiredFieldMissing("clientFinish ukey2message.type|data") } + guard case .clientFinish = msg.messageType else { throw NearbyError.ukey2 } + + var sha=SHA512() + sha.update(data: raw) + guard cipherCommitment==Data(sha.finalize()) else { throw NearbyError.ukey2 } + + let clientFinish=try Securegcm_Ukey2ClientFinished(serializedBytes: msg.messageData) + guard clientFinish.hasPublicKey else {throw NearbyError.requiredFieldMissing("ukey2clientFinish.publicKey") } + let clientKey=try Securemessage_GenericPublicKey(serializedBytes: clientFinish.publicKey) + + try finalizeKeyExchange(peerKey: clientKey) + + currentState = .receivedUkeyClientFinish + } + + private func processConnectionResponseFrame(_ frame:Location_Nearby_Connections_OfflineFrame) throws{ + guard frame.hasV1, frame.v1.hasType else { throw NearbyError.requiredFieldMissing("offlineFrame.v1.type") } + if case .connectionResponse = frame.v1.type { + var resp=Location_Nearby_Connections_OfflineFrame() + resp.version = .v1 + resp.v1=Location_Nearby_Connections_V1Frame() + resp.v1.type = .connectionResponse + resp.v1.connectionResponse=Location_Nearby_Connections_ConnectionResponseFrame() + resp.v1.connectionResponse.response = .accept + resp.v1.connectionResponse.status=0 + resp.v1.connectionResponse.osInfo=Location_Nearby_Connections_OsInfo() + resp.v1.connectionResponse.osInfo.type = .apple + sendFrameAsync(try resp.serializedData()) + + encryptionDone=true + + var pairedEncryption=Sharing_Nearby_Frame() + pairedEncryption.version = .v1 + pairedEncryption.v1=Sharing_Nearby_V1Frame() + pairedEncryption.v1.type = .pairedKeyEncryption + pairedEncryption.v1.pairedKeyEncryption=Sharing_Nearby_PairedKeyEncryptionFrame() + // Presumably used for all the phone number stuff that no one needs anyway + pairedEncryption.v1.pairedKeyEncryption.secretIDHash=Data.randomData(length: 6) + pairedEncryption.v1.pairedKeyEncryption.signedData=Data.randomData(length: 72) + try sendTransferSetupFrame(pairedEncryption) + currentState = .sentConnectionResponse + } else { + print("Unhandled offline frame plaintext: \(frame)") + } + } + + private func processPairedKeyEncryptionFrame(_ frame:Sharing_Nearby_Frame) throws{ + guard frame.hasV1, frame.v1.hasPairedKeyEncryption else { throw NearbyError.requiredFieldMissing("shareNearbyFrame.v1.pairedKeyEncryption") } + var pairedResult=Sharing_Nearby_Frame() + pairedResult.version = .v1 + pairedResult.v1=Sharing_Nearby_V1Frame() + pairedResult.v1.type = .pairedKeyResult + pairedResult.v1.pairedKeyResult=Sharing_Nearby_PairedKeyResultFrame() + pairedResult.v1.pairedKeyResult.status = .unable + try sendTransferSetupFrame(pairedResult) + currentState = .sentPairedKeyResult + } + + private func processPairedKeyResultFrame(_ frame:Sharing_Nearby_Frame) throws{ + guard frame.hasV1, frame.v1.hasPairedKeyResult else { throw NearbyError.requiredFieldMissing("shareNearbyFrame.v1.pairedKeyResult") } + currentState = .receivedPairedKeyResult + } + + private func makeFileDestinationURL(_ initialDest:URL) -> URL{ + var dest=initialDest + if FileManager.default.fileExists(atPath: dest.path){ + var counter=1 + var path:String + let ext=dest.pathExtension + let baseUrl=dest.deletingPathExtension() + repeat{ + path="\(baseUrl.path) (\(counter))" + if !ext.isEmpty{ + path+=".\(ext)" + } + counter+=1 + }while FileManager.default.fileExists(atPath: path) + dest=URL(fileURLWithPath: path) + } + return dest + } + + private func processIntroductionFrame(_ frame:Sharing_Nearby_Frame) throws{ + guard frame.hasV1, frame.v1.hasIntroduction else { throw NearbyError.requiredFieldMissing("shareNearbyFrame.v1.introduction") } + currentState = .waitingForUserConsent + if frame.v1.introduction.fileMetadata.count>0 && frame.v1.introduction.textMetadata.isEmpty{ + let downloadsDirectory=(try FileManager.default.url(for: .downloadsDirectory, in: .userDomainMask, appropriateFor: nil, create: true)).resolvingSymlinksInPath() + for file in frame.v1.introduction.fileMetadata{ + let dest=makeFileDestinationURL(downloadsDirectory.appendingPathComponent(file.name)) + let info=InternalFileInfo(meta: FileMetadata(name: file.name, size: file.size, mimeType: file.mimeType), + payloadID: file.payloadID, + destinationURL: dest) + transferredFiles[file.payloadID]=info + } + let metadata=TransferMetadata(files: transferredFiles.map({$0.value.meta}), id: id, pinCode: pinCode) + DispatchQueue.main.async { + self.delegate?.obtainUserConsent(for: metadata, from: self.remoteDeviceInfo!, connection: self) + } + }else if frame.v1.introduction.textMetadata.count==1{ + let meta=frame.v1.introduction.textMetadata[0] + if case .url=meta.type{ + let metadata=TransferMetadata(files: [], id: id, pinCode: pinCode, textDescription: meta.textTitle) + textPayloadID=meta.payloadID + DispatchQueue.main.async { + self.delegate?.obtainUserConsent(for: metadata, from: self.remoteDeviceInfo!, connection: self) + } + }else if case .text=meta.type{ + let downloadsDirectory=(try FileManager.default.url(for: .downloadsDirectory, in: .userDomainMask, appropriateFor: nil, create: true)).resolvingSymlinksInPath() + let dateFormatter=DateFormatter() + dateFormatter.dateFormat="yyyy-MM-dd HH.mm.ss" + let dest=makeFileDestinationURL(downloadsDirectory.appendingPathComponent("\(dateFormatter.string(from: Date())).txt")) + let info=InternalFileInfo(meta: FileMetadata(name: dest.lastPathComponent, size: meta.size, mimeType: "text/plain"), + payloadID: meta.payloadID, + destinationURL: dest) + transferredFiles[meta.payloadID]=info + DispatchQueue.main.async { + self.delegate?.obtainUserConsent(for: TransferMetadata(files: [info.meta], id: self.id, pinCode: self.pinCode), from: self.remoteDeviceInfo!, connection: self) + } + }else{ + rejectTransfer(with: .unsupportedAttachmentType) + } + }else{ + rejectTransfer(with: .unsupportedAttachmentType) + } + } + + func submitUserConsent(accepted:Bool){ + Task { + if accepted{ + self.acceptTransfer() + }else{ + self.rejectTransfer() + } + } + } + + public func cancel(){ + if encryptionDone{ + var cancel=Sharing_Nearby_Frame() + cancel.version = .v1 + cancel.v1=Sharing_Nearby_V1Frame() + cancel.v1.type = .cancel + try? sendTransferSetupFrame(cancel) + } + try? sendDisconnectionAndDisconnect() + } + + private func acceptTransfer(){ + do{ + for (id, file) in transferredFiles{ + FileManager.default.createFile(atPath: file.destinationURL.path, contents: nil) + let handle=try FileHandle(forWritingTo: file.destinationURL) + transferredFiles[id]!.fileHandle=handle + let progress=Progress() + progress.fileURL=file.destinationURL + progress.totalUnitCount=file.meta.size + progress.kind = .file + progress.isPausable=false + progress.publish() + transferredFiles[id]!.progress=progress + transferredFiles[id]!.created=true + } + + var frame=Sharing_Nearby_Frame() + frame.version = .v1 + frame.v1.type = .response + frame.v1.connectionResponse.status = .accept + currentState = .receivingFiles + try sendTransferSetupFrame(frame) + }catch{ + lastError=error + protocolError() + } + } + + private func rejectTransfer(with reason:Sharing_Nearby_ConnectionResponseFrame.Status = .reject){ + var frame=Sharing_Nearby_Frame() + frame.version = .v1 + frame.v1.type = .response + frame.v1.connectionResponse.status = reason + do{ + try sendTransferSetupFrame(frame) + try sendDisconnectionAndDisconnect() + }catch{ + print("Error \(error)") + protocolError() + } + } + + private func deletePartiallyReceivedFiles() throws{ + for (_, file) in transferredFiles{ + guard file.created else { continue } + try FileManager.default.removeItem(at: file.destinationURL) + } + } +} + +public protocol InboundNearbyConnectionDelegate{ + func obtainUserConsent(for transfer:TransferMetadata, from device:RemoteDeviceInfo, connection:InboundNearbyConnection) + func connectionWasTerminated(connection:InboundNearbyConnection, error:Error?) + func incomingTransferProgress(connection:InboundNearbyConnection, id:String, progress:Double) + func transferDidComplete(connection:InboundNearbyConnection) +} diff --git a/airsync-mac/Core/QuickShare/NDNotificationCenterHackery.h b/airsync-mac/Core/QuickShare/NDNotificationCenterHackery.h new file mode 100644 index 00000000..65a4679a --- /dev/null +++ b/airsync-mac/Core/QuickShare/NDNotificationCenterHackery.h @@ -0,0 +1,19 @@ +// +// NDNotificationCenterHackery.h +// NearDrop +// +// Created by Grishka on 10.04.2023. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NDNotificationCenterHackery : NSObject + ++ (void)removeDefaultAction:(UNMutableNotificationContent*) content; + +@end + +NS_ASSUME_NONNULL_END diff --git a/airsync-mac/Core/QuickShare/NDNotificationCenterHackery.m b/airsync-mac/Core/QuickShare/NDNotificationCenterHackery.m new file mode 100644 index 00000000..5142c935 --- /dev/null +++ b/airsync-mac/Core/QuickShare/NDNotificationCenterHackery.m @@ -0,0 +1,42 @@ +// +// NDNotificationCenterHackery.m +// NearDrop +// +// Created by Grishka on 10.04.2023. +// + +#import +#import +#import "NDNotificationCenterHackery.h" + +@interface UNMutableNotificationCategory : UNNotificationCategory +@property(copy) NSString *actionsMenuTitle; +@property(copy) UNNotificationAction *alternateAction; +@property(copy) NSArray *minimalActions; +@property unsigned long long backgroundStyle; +@property(copy) NSArray *actions; +@end + +@interface UNNotificationIcon : NSObject ++ (id)iconForApplicationIdentifier:(id)arg1; ++ (id)iconAtPath:(id)arg1; ++ (id)iconNamed:(id)arg1; +@end + +@interface UNMutableNotificationContent (NDPrivateAPIs) +@property BOOL hasDefaultAction; +@property(copy) NSString *defaultActionTitle; +@property(copy) NSString *header; +@property (assign,nonatomic) BOOL shouldDisplayActionsInline; +@property (assign,nonatomic) BOOL shouldShowSubordinateIcon; +@property (nonatomic,copy) NSString * accessoryImageName; +@property(copy) UNNotificationIcon *icon; +@end + +@implementation NDNotificationCenterHackery + ++ (void)removeDefaultAction:(UNMutableNotificationContent*) content{ + content.hasDefaultAction=false; +} + +@end diff --git a/airsync-mac/Core/QuickShare/NearbyConnection.swift b/airsync-mac/Core/QuickShare/NearbyConnection.swift new file mode 100644 index 00000000..9b231c85 --- /dev/null +++ b/airsync-mac/Core/QuickShare/NearbyConnection.swift @@ -0,0 +1,485 @@ +// +// NearbyConnection.swift +// NearDrop +// +// Created by Grishka on 09.04.2023. +// + +import Foundation +import Network +import CommonCrypto +import CryptoKit +import System +@preconcurrency import SwiftProtobuf + +import SwiftECC +import BigInt + +@MainActor +public class NearbyConnection{ + internal static let SANE_FRAME_LENGTH=5*1024*1024 + private static let dispatchQueue=DispatchQueue(label: "me.grishka.NearDrop.queue", qos: .utility) // FIFO (non-concurrent) queue to avoid those exciting concurrency bugs + + internal let connection:NWConnection + internal var remoteDeviceInfo:RemoteDeviceInfo? + private var payloadBuffers:[Int64:NSMutableData]=[:] + internal var encryptionDone:Bool=false + internal var transferredFiles:[Int64:InternalFileInfo]=[:] + public let id:String + internal var lastError:Error? + private var connectionClosed:Bool=false + + // UKEY2-related state + internal var publicKey:ECPublicKey? + internal var privateKey:ECPrivateKey? + internal var ukeyClientInitMsgData:Data? + internal var ukeyServerInitMsgData:Data? + + // SecureMessage encryption keys + internal var decryptKey:[UInt8]? + internal var encryptKey:[UInt8]? + internal var recvHmacKey:SymmetricKey? + internal var sendHmacKey:SymmetricKey? + + // SecureMessage sequence numbers + private var serverSeq:Int32=0 + private var clientSeq:Int32=0 + + private(set) var pinCode:String? + private(set) var authKey:SymmetricKey? + + init(connection:NWConnection, id:String) { + self.connection=connection + self.id=id + } + + nonisolated deinit {} + + func start(){ + connection.stateUpdateHandler={ [weak self] state in + Task { @MainActor in + guard let self=self else { return } + if case .ready = state { + self.connectionReady() + self.receiveFrameAsync() + } else if case .failed(let err) = state { + self.lastError=err + print("Error opening socket: \(err)") + self.handleConnectionClosure() + } + } + } + //connection.start(queue: .global(qos: .utility)) + connection.start(queue: NearbyConnection.dispatchQueue) + } + + func connectionReady(){} + + internal func handleConnectionClosure(){ + print("Connection closed") + } + + internal func protocolError(){ + disconnect() + } + + internal func processReceivedFrame(frameData:Data){ + fatalError() + } + + internal func processTransferSetupFrame(_ frame:Sharing_Nearby_Frame) throws{ + fatalError() + } + + internal func isServer() -> Bool{ + fatalError() + } + + internal func processFileChunk(frame:Location_Nearby_Connections_PayloadTransferFrame) throws{ + protocolError() + } + + internal func processBytesPayload(payload:Data, id:Int64)throws ->Bool{ + return false + } + + private func receiveFrameAsync(){ + connection.receive(minimumIncompleteLength: 4, maximumLength: 4) { [weak self] content, contentContext, isComplete, error in + Task { @MainActor in + guard let self=self else { return } + if self.connectionClosed{ + return + } + if isComplete{ + self.handleConnectionClosure() + return + } + if !(error==nil){ + self.lastError=error + self.protocolError() + return + } + guard let content=content else { + assertionFailure() + return + } + let frameLength:UInt32=UInt32(content[0]) << 24 | UInt32(content[1]) << 16 | UInt32(content[2]) << 8 | UInt32(content[3]) + guard frameLengthVoid)?=nil){ + if connectionClosed{ + return + } + var lengthPrefixedData=Data(capacity: frame.count+4) + let length:Int=frame.count + lengthPrefixedData.append(contentsOf: [ + UInt8(truncatingIfNeeded: length >> 24), + UInt8(truncatingIfNeeded: length >> 16), + UInt8(truncatingIfNeeded: length >> 8), + UInt8(truncatingIfNeeded: length) + ]) + lengthPrefixedData.append(frame) + connection.send(content: lengthPrefixedData, completion: .contentProcessed({ [weak self] error in + Task { @MainActor in + if let completion=completion{ + completion() + } + } + })) + } + + internal func encryptAndSendOfflineFrame(_ frame:Location_Nearby_Connections_OfflineFrame, completion:(()->Void)?=nil) throws{ + var d2dMsg=Securegcm_DeviceToDeviceMessage() + serverSeq+=1 + d2dMsg.sequenceNumber=serverSeq + d2dMsg.message=try frame.serializedData() + + let serializedMsg=[UInt8](try d2dMsg.serializedData()) + let iv=Data.randomData(length: 16) + var encryptedData=Data(count: serializedMsg.count+16) + var encryptedLength:size_t=0 + encryptedData.withUnsafeMutableBytes({ + let status=CCCrypt( + CCOperation(kCCEncrypt), + CCAlgorithm(kCCAlgorithmAES128), + CCOptions(kCCOptionPKCS7Padding), + encryptKey, kCCKeySizeAES256, + [UInt8](iv), + serializedMsg, serializedMsg.count, + $0.baseAddress, $0.count, + &encryptedLength + ) + guard status==kCCSuccess else { fatalError("CCCrypt error: \(status)") } + }) + + var hb=Securemessage_HeaderAndBody() + hb.body=encryptedData.prefix(encryptedLength) + hb.header=Securemessage_Header() + hb.header.encryptionScheme = .aes256Cbc + hb.header.signatureScheme = .hmacSha256 + hb.header.iv=iv + var md=Securegcm_GcmMetadata() + md.type = .deviceToDeviceMessage + md.version=1 + hb.header.publicMetadata=try md.serializedData() + + var smsg=Securemessage_SecureMessage() + smsg.headerAndBody=try hb.serializedData() + smsg.signature=Data(HMAC.authenticationCode(for: smsg.headerAndBody, using: sendHmacKey!)) + sendFrameAsync(try smsg.serializedData(), completion: completion) + } + + internal func sendTransferSetupFrame(_ frame:Sharing_Nearby_Frame) throws{ + try sendBytesPayload(data: try frame.serializedData(), id: Int64.random(in: Int64.min...Int64.max)) + } + + internal func sendBytesPayload(data:Data, id:Int64) throws{ + var transfer=Location_Nearby_Connections_PayloadTransferFrame() + transfer.packetType = .data + transfer.payloadChunk.offset=0 + transfer.payloadChunk.flags=0 + transfer.payloadChunk.body=data + transfer.payloadHeader.id=id + transfer.payloadHeader.type = .bytes + transfer.payloadHeader.totalSize=Int64(transfer.payloadChunk.body.count) + transfer.payloadHeader.isSensitive=false + + var wrapper=Location_Nearby_Connections_OfflineFrame() + wrapper.version = .v1 + wrapper.v1=Location_Nearby_Connections_V1Frame() + wrapper.v1.type = .payloadTransfer + wrapper.v1.payloadTransfer=transfer + try encryptAndSendOfflineFrame(wrapper) + + transfer.payloadChunk.flags=1 // .lastChunk + transfer.payloadChunk.offset=Int64(transfer.payloadChunk.body.count) + transfer.payloadChunk.clearBody() + wrapper.v1.payloadTransfer=transfer + try encryptAndSendOfflineFrame(wrapper) + } + + internal func decryptAndProcessReceivedSecureMessage(_ smsg:Securemessage_SecureMessage) throws{ + guard smsg.hasSignature, smsg.hasHeaderAndBody else { throw NearbyError.requiredFieldMissing("secureMessage.signature|headerAndBody") } + let hmac=Data(HMAC.authenticationCode(for: smsg.headerAndBody, using: recvHmacKey!)) + guard hmac==smsg.signature else { throw NearbyError.protocolError("hmac!=signature") } + let headerAndBody=try Securemessage_HeaderAndBody(serializedData: smsg.headerAndBody) + var decryptedData=Data(count: headerAndBody.body.count) + + var decryptedLength:Int=0 + decryptedData.withUnsafeMutableBytes({ + let status=CCCrypt( + CCOperation(kCCDecrypt), + CCAlgorithm(kCCAlgorithmAES128), + CCOptions(kCCOptionPKCS7Padding), + decryptKey, kCCKeySizeAES256, + [UInt8](headerAndBody.header.iv), + [UInt8](headerAndBody.body), headerAndBody.body.count, + $0.baseAddress, $0.count, + &decryptedLength + ) + guard status==kCCSuccess else { fatalError("CCCrypt error: \(status)") } + }) + decryptedData=decryptedData.prefix(decryptedLength) + let d2dMsg=try Securegcm_DeviceToDeviceMessage(serializedData: decryptedData) + guard d2dMsg.hasMessage, d2dMsg.hasSequenceNumber else { throw NearbyError.requiredFieldMissing("d2dMessage.message|sequenceNumber") } + clientSeq+=1 + guard d2dMsg.sequenceNumber==clientSeq else { throw NearbyError.protocolError("Wrong sequence number. Expected \(clientSeq), got \(d2dMsg.sequenceNumber)") } + let offlineFrame=try Location_Nearby_Connections_OfflineFrame(serializedData: d2dMsg.message) + + if offlineFrame.hasV1 && offlineFrame.v1.hasType, case .payloadTransfer = offlineFrame.v1.type { + guard offlineFrame.v1.hasPayloadTransfer else { throw NearbyError.requiredFieldMissing("offlineFrame.v1.payloadTransfer") } + let payloadTransfer=offlineFrame.v1.payloadTransfer + let header=payloadTransfer.payloadHeader; + let chunk=payloadTransfer.payloadChunk; + guard header.hasType, header.hasID else { throw NearbyError.requiredFieldMissing("payloadHeader.type|id") } + guard payloadTransfer.hasPayloadChunk, chunk.hasOffset, chunk.hasFlags else { throw NearbyError.requiredFieldMissing("payloadTransfer.payloadChunk|offset|flags") } + if case .bytes = header.type{ + let payloadID=header.id + if header.totalSize>InboundNearbyConnection.SANE_FRAME_LENGTH{ + payloadBuffers.removeValue(forKey: payloadID) + throw NearbyError.protocolError("Payload too large (\(header.totalSize) bytes)") + } + if payloadBuffers[payloadID]==nil { + payloadBuffers[payloadID]=NSMutableData(capacity: Int(header.totalSize)) + } + let buffer=payloadBuffers[payloadID]! + guard chunk.offset==buffer.count else { + payloadBuffers.removeValue(forKey: payloadID) + throw NearbyError.protocolError("Unexpected chunk offset \(chunk.offset), expected \(buffer.count)") + } + if chunk.hasBody { + buffer.append(chunk.body) + } + if (chunk.flags & 1)==1 { + payloadBuffers.removeValue(forKey: payloadID) + if !(try processBytesPayload(payload: Data(buffer), id: payloadID)){ + let innerFrame=try Sharing_Nearby_Frame(serializedData: buffer as Data) + try processTransferSetupFrame(innerFrame) + } + } + }else if case .file = header.type{ + try processFileChunk(frame: payloadTransfer) + } + }else if offlineFrame.hasV1 && offlineFrame.v1.hasType, case .keepAlive = offlineFrame.v1.type{ + #if DEBUG + print("Sent keep-alive") + #endif + sendKeepAlive(ack: true) + }else if offlineFrame.hasV1 && offlineFrame.v1.hasType, case .bandwidthUpgradeNegotiation = offlineFrame.v1.type{ + // Ignore bandwidth upgrade negotiation (not supported yet) + }else{ + print("Unhandled offline frame encrypted: \(offlineFrame)") + } + } + + internal static func pinCodeFromAuthKey(_ key:SymmetricKey) -> String{ + var hash:Int=0 + var multiplier:Int=1 + let keyBytes:[UInt8]=key.withUnsafeBytes({ + return [UInt8]($0) + }) + + for _byte in keyBytes { + let byte=Int(Int8(bitPattern: _byte)) + hash=(hash+byte*multiplier)%9973 + multiplier=(multiplier*31)%9973 + } + + return String(format: "%04d", abs(hash)) + } + + internal static func hkdfExtract(salt:Data, ikm:Data) -> Data{ + return HMAC.authenticationCode(for: ikm, using: SymmetricKey(data: salt)).withUnsafeBytes({return Data(bytes: $0.baseAddress!, count: $0.count)}) + } + + internal static func hkdfExpand(prk:Data, info:Data, length:Int) -> Data{ + var okm=Data() + var t=Data() + var i=0 + while okm.count.authenticationCode(for: toDigest, using: SymmetricKey(data: prk)).withUnsafeBytes({return Data(bytes: $0.baseAddress!, count: $0.count)}) + okm=okm+t + } + return okm.subdata(in: 0.. SymmetricKey{ + if #available(macOS 11.0, *){ + return HKDF.deriveKey(inputKeyMaterial: inputKeyMaterial, salt: salt, info: info, outputByteCount: outputByteCount) + }else{ + return SymmetricKey(data: hkdfExpand(prk: hkdfExtract(salt: salt, ikm: inputKeyMaterial.data()), info: info, length: outputByteCount)) + } + } + + internal func finalizeKeyExchange(peerKey:Securemessage_GenericPublicKey) throws{ + guard peerKey.hasEcP256PublicKey else { throw NearbyError.requiredFieldMissing("peerKey.ecP256PublicKey") } + + let domain=Domain.instance(curve: .EC256r1) + var clientX=peerKey.ecP256PublicKey.x + var clientY=peerKey.ecP256PublicKey.y + if clientX.count>32{ + clientX=clientX.suffix(32) + } + if clientY.count>32{ + clientY=clientY.suffix(32) + } + let key=try ECPublicKey(domain: domain, w: Point(BInt(magnitude: [UInt8](clientX)), BInt(magnitude: [UInt8](clientY)))) + + let dhs=(try privateKey?.domain.multiplyPoint(key.w, privateKey!.s).x.asMagnitudeBytes())! + var sha=SHA256() + sha.update(data: dhs) + let derivedSecretKey=Data(sha.finalize()) + + var ukeyInfo=Data() + ukeyInfo.append(ukeyClientInitMsgData!) + ukeyInfo.append(ukeyServerInitMsgData!) + let authString=NearbyConnection.hkdf(inputKeyMaterial: SymmetricKey(data: derivedSecretKey), salt: "UKEY2 v1 auth".data(using: .utf8)!, info: ukeyInfo, outputByteCount: 32) + let nextSecret=NearbyConnection.hkdf(inputKeyMaterial: SymmetricKey(data: derivedSecretKey), salt: "UKEY2 v1 next".data(using: .utf8)!, info: ukeyInfo, outputByteCount: 32) + + authKey=authString + pinCode=NearbyConnection.pinCodeFromAuthKey(authString) + + let salt:Data=Data([0x82, 0xAA, 0x55, 0xA0, 0xD3, 0x97, 0xF8, 0x83, 0x46, 0xCA, 0x1C, + 0xEE, 0x8D, 0x39, 0x09, 0xB9, 0x5F, 0x13, 0xFA, 0x7D, 0xEB, 0x1D, + 0x4A, 0xB3, 0x83, 0x76, 0xB8, 0x25, 0x6D, 0xA8, 0x55, 0x10]) + + let d2dClientKey=NearbyConnection.hkdf(inputKeyMaterial: nextSecret, salt: salt, info: "client".data(using: .utf8)!, outputByteCount: 32) + let d2dServerKey=NearbyConnection.hkdf(inputKeyMaterial: nextSecret, salt: salt, info: "server".data(using: .utf8)!, outputByteCount: 32) + + sha=SHA256() + sha.update(data: "SecureMessage".data(using: .utf8)!) + let smsgSalt=Data(sha.finalize()) + + let clientKey=NearbyConnection.hkdf(inputKeyMaterial: d2dClientKey, salt: smsgSalt, info: "ENC:2".data(using: .utf8)!, outputByteCount: 32).withUnsafeBytes({return [UInt8]($0)}) + let clientHmacKey=NearbyConnection.hkdf(inputKeyMaterial: d2dClientKey, salt: smsgSalt, info: "SIG:1".data(using: .utf8)!, outputByteCount: 32) + let serverKey=NearbyConnection.hkdf(inputKeyMaterial: d2dServerKey, salt: smsgSalt, info: "ENC:2".data(using: .utf8)!, outputByteCount: 32).withUnsafeBytes({return [UInt8]($0)}) + let serverHmacKey=NearbyConnection.hkdf(inputKeyMaterial: d2dServerKey, salt: smsgSalt, info: "SIG:1".data(using: .utf8)!, outputByteCount: 32) + + if isServer(){ + decryptKey=clientKey + recvHmacKey=clientHmacKey + encryptKey=serverKey + sendHmacKey=serverHmacKey + }else{ + decryptKey=serverKey + recvHmacKey=serverHmacKey + encryptKey=clientKey + sendHmacKey=clientHmacKey + } + } + + internal func disconnect(){ + connection.send(content: nil, isComplete: true, completion: .contentProcessed({ [weak self] error in + Task { @MainActor in + self?.handleConnectionClosure() + } + })) + connectionClosed=true + } + + internal func sendDisconnectionAndDisconnect(){ + var offlineFrame=Location_Nearby_Connections_OfflineFrame() + offlineFrame.version = .v1 + offlineFrame.v1.type = .disconnection + offlineFrame.v1.disconnection=Location_Nearby_Connections_DisconnectionFrame() + + do{ + if encryptionDone{ + try encryptAndSendOfflineFrame(offlineFrame) + }else{ + sendFrameAsync(try offlineFrame.serializedData()) + } + }catch{ + print("[nearby] Error sending disconnection frame: \(error)") + } + disconnect() + } + + internal func sendUkey2Alert(type:Securegcm_Ukey2Alert.AlertType){ + var alert=Securegcm_Ukey2Alert() + alert.type=type + var msg=Securegcm_Ukey2Message() + msg.messageType = .alert + msg.messageData = try! alert.serializedData() + sendFrameAsync(try! msg.serializedData()) + disconnect() + } + + internal func sendKeepAlive(ack:Bool){ + var offlineFrame=Location_Nearby_Connections_OfflineFrame() + offlineFrame.version = .v1 + offlineFrame.v1.type = .keepAlive + offlineFrame.v1.keepAlive.ack=ack + + do{ + if encryptionDone{ + try encryptAndSendOfflineFrame(offlineFrame) + }else{ + sendFrameAsync(try offlineFrame.serializedData()) + } + }catch{ + print("Error sending KEEP_ALIVE: \(error)") + } + } +} + +struct InternalFileInfo{ + let meta:FileMetadata + let payloadID:Int64 + let destinationURL:URL + var bytesTransferred:Int64=0 + var fileHandle:FileHandle? + var progress:Progress? + var created:Bool=false +} diff --git a/airsync-mac/Core/QuickShare/NearbyConnectionManager.swift b/airsync-mac/Core/QuickShare/NearbyConnectionManager.swift new file mode 100644 index 00000000..26ff5f69 --- /dev/null +++ b/airsync-mac/Core/QuickShare/NearbyConnectionManager.swift @@ -0,0 +1,520 @@ +// +// NearbyConnectionManager.swift +// NearDrop +// +// Created by Grishka on 08.04.2023. +// + +import Foundation +import Network +import System +import CryptoKit +import SwiftECC +import BigInt +@preconcurrency import SwiftProtobuf + +public struct RemoteDeviceInfo: Equatable { + public let name:String + public let type:DeviceType + public let qrCodeData:Data? + public var id:String? + + init(name: String, type: DeviceType, id: String? = nil) { + self.name = name + self.type = type + self.id = id + self.qrCodeData = nil + } + + init(info:EndpointInfo, id: String? = nil){ + self.name=info.name! + self.type=info.deviceType + self.qrCodeData=info.qrCodeData + self.id=id + } + + public enum DeviceType:Int32{ + case unknown=0 + case phone + case tablet + case computer + + public static func fromRawValue(value:Int) -> DeviceType{ + switch value { + case 0: + return .unknown + case 1: + return .phone + case 2: + return .tablet + case 3: + return .computer + default: + return .unknown + } + } + } +} + + +public enum NearbyError:Error{ + case protocolError(_ message:String) + case requiredFieldMissing(_ message:String) + case ukey2 + case inputOutput + case canceled(reason:CancellationReason) + + public enum CancellationReason{ + case userRejected, userCanceled, notEnoughSpace, unsupportedType, timedOut + } +} + +public struct TransferMetadata: Equatable { + public let files:[FileMetadata] + public let id:String + public let pinCode:String? + public let textDescription:String? + + init(files: [FileMetadata], id: String, pinCode: String?, textDescription: String?=nil){ + self.files = files + self.id = id + self.pinCode = pinCode + self.textDescription = textDescription + } +} + +public struct FileMetadata: Equatable { + public let name:String + public let size:Int64 + public let mimeType:String +} + +struct FoundServiceInfo{ + let service:NWBrowser.Result + var device:RemoteDeviceInfo? +} + +struct OutgoingTransferInfo{ + let service:NWBrowser.Result + let device:RemoteDeviceInfo + let connection:OutboundNearbyConnection + let delegate:ShareExtensionDelegate +} + +struct EndpointInfo{ + var name:String? + let deviceType:RemoteDeviceInfo.DeviceType + let qrCodeData:Data? + + init(name: String, deviceType: RemoteDeviceInfo.DeviceType){ + self.name = name + self.deviceType = deviceType + self.qrCodeData=nil + } + + init?(data:Data){ + guard data.count>17 else {return nil} + let hasName=(data[0] & 0x10)==0 + let deviceNameLength:Int + let deviceName:String? + if hasName{ + deviceNameLength=Int(data[17]) + guard data.count>=deviceNameLength+18 else {return nil} + guard let _deviceName=String(data: data[18..<(18+deviceNameLength)], encoding: .utf8) else {return nil} + deviceName=_deviceName + }else{ + deviceNameLength=0 + deviceName=nil + } + let rawDeviceType:Int=Int(data[0] & 7) >> 1 + self.name=deviceName + self.deviceType=RemoteDeviceInfo.DeviceType.fromRawValue(value: rawDeviceType) + var offset=1+16 + if hasName{ + offset=offset+1+deviceNameLength + } + var qrCodeData:Data?=nil + while data.count-offset>2{ // read TLV records, if any + let type=data[offset] + let length=Int(data[offset+1]) + offset=offset+2 + if data.count-offset>=length{ + if type==1{ // QR code data + qrCodeData=data.subdata(in: offset..Data{ + // 1 byte: Version(3 bits)|Visibility(1 bit)|Device Type(3 bits)|Reserved(1 bits) + // Device types: unknown=0, phone=1, tablet=2, laptop=3 + var endpointInfo:[UInt8]=[UInt8(deviceType.rawValue << 1)] + // 16 bytes: unknown random bytes + for _ in 0...15{ + endpointInfo.append(UInt8.random(in: 0...255)) + } + // Device name in UTF-8 prefixed with 1-byte length + var nameChars=[UInt8](name!.utf8) + if nameChars.count>255{ + nameChars=[UInt8](nameChars[0..<255]) + } + endpointInfo.append(UInt8(nameChars.count)) + for ch in nameChars{ + endpointInfo.append(UInt8(ch)) + } + return Data(endpointInfo) + } +} + + +public protocol MainAppDelegate{ + func obtainUserConsent(for transfer:TransferMetadata, from device:RemoteDeviceInfo) + func incomingTransfer(id:String, didFinishWith error:Error?) + func incomingTransferProgress(id:String, progress:Double) + func transferDidComplete(id:String) +} + +public protocol ShareExtensionDelegate:AnyObject{ + func addDevice(device:RemoteDeviceInfo) + func removeDevice(id:String) + func startTransferWithQrCode(device:RemoteDeviceInfo) + func connectionWasEstablished(pinCode:String) + func connectionFailed(with error:Error) + func transferAccepted() + func transferProgress(progress:Double) + func transferFinished() +} + +@MainActor +public class NearbyConnectionManager : NSObject, NetServiceDelegate, InboundNearbyConnectionDelegate, OutboundNearbyConnectionDelegate{ + + private var tcpListener:NWListener; + public let endpointID:[UInt8]=generateEndpointID() + private var mdnsService:NetService? + private var activeConnections:[String:InboundNearbyConnection]=[:] + private var foundServices:[String:FoundServiceInfo]=[:] + private var shareExtensionDelegates:[ShareExtensionDelegate]=[] + private var outgoingTransfers:[String:OutgoingTransferInfo]=[:] + public var mainAppDelegate:(any MainAppDelegate)? + private var discoveryRefCount=0 + + private var browser:NWBrowser? + + private var qrCodePublicKey:ECPublicKey? + private var qrCodePrivateKey:ECPrivateKey? + private var qrCodeAdvertisingToken:Data? + private var qrCodeNameEncryptionKey:SymmetricKey? + private var qrCodeData:Data? + + public static let shared=NearbyConnectionManager() + + override init() { + tcpListener=try! NWListener(using: NWParameters(tls: .none)) + super.init() + } + + public func becomeVisible(){ + startTCPListener() + } + + private func startTCPListener(){ + tcpListener.stateUpdateHandler={ [weak self] (state:NWListener.State) in + if case .ready = state { + Task { @MainActor in + self?.initMDNS() + } + } + } + tcpListener.newConnectionHandler={ [weak self] (connection:NWConnection) in + Task { @MainActor in + let id=UUID().uuidString + let conn=InboundNearbyConnection(connection: connection, id: id) + self?.activeConnections[id]=conn + conn.delegate=self + conn.start() + } + } + tcpListener.start(queue: .global(qos: .utility)) + } + + private static func generateEndpointID()->[UInt8]{ + var id:[UInt8]=[] + let alphabet="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".compactMap {UInt8($0.asciiValue!)} + for _ in 0...3{ + id.append(alphabet[Int.random(in: 0.. 0 else { + print("[nearby] Attempted to stop discovery when count is already 0") + return + } + discoveryRefCount-=1 + if discoveryRefCount==0{ + browser?.cancel() + browser=nil + } + } + + public func addShareExtensionDelegate(_ delegate:ShareExtensionDelegate){ + shareExtensionDelegates.append(delegate) + for service in foundServices.values{ + guard let device=service.device else {continue} + delegate.addDevice(device: device) + } + } + + public func removeShareExtensionDelegate(_ delegate:ShareExtensionDelegate){ + shareExtensionDelegates.removeAll(where: {$0===delegate}) + } + + public func cancelOutgoingTransfer(id:String){ + guard let transfer=outgoingTransfers[id] else {return} + transfer.connection.cancel() + } + + private func endpointID(for service:NWBrowser.Result)->String?{ + guard case let NWEndpoint.service(name: serviceName, type: _, domain: _, interface: _)=service.endpoint else {return nil} + guard let nameData=Data.dataFromUrlSafeBase64(serviceName) else {return nil} + guard nameData.count>=10 else {return nil} + let pcp=nameData[0] + guard pcp==0x23 else {return nil} + let endpointID=String(data: nameData.subdata(in: 1..<5), encoding: .ascii)! + let serviceIDHash=nameData.subdata(in: 5..<8) + guard serviceIDHash==Data([0xFC, 0x9F, 0x5E]) else {return nil} + return endpointID + } + + private func maybeAddFoundDevice(service:NWBrowser.Result){ + #if DEBUG + print("found service \(service)") + #endif + for interface in service.interfaces{ + if case .loopback=interface.type{ + #if DEBUG + print("ignoring localhost service") + #endif + return + } + } + guard let endpointID=endpointID(for: service) else {return} + #if DEBUG + print("service name is valid, endpoint ID \(endpointID)") + #endif + var foundService=FoundServiceInfo(service: service) + + guard case let NWBrowser.Result.Metadata.bonjour(txtRecord)=service.metadata else {return} + guard let endpointInfoEncoded=txtRecord.dictionary["n"] else {return} + guard let endpointInfoSerialized=Data.dataFromUrlSafeBase64(endpointInfoEncoded) else {return} + guard var endpointInfo=EndpointInfo(data: endpointInfoSerialized) else {return} + + var deviceInfo:RemoteDeviceInfo? + if let _=endpointInfo.name{ + deviceInfo=addFoundDevice(foundService: &foundService, endpointInfo: endpointInfo, endpointID: endpointID) + } + + if let qrData=endpointInfo.qrCodeData, let _=qrCodeAdvertisingToken{ +#if DEBUG + print("Device has QR data: \(qrData.base64EncodedString()), our advertising token is \(qrCodeAdvertisingToken!.base64EncodedString())") +#endif + if qrData==qrCodeAdvertisingToken!{ + if let deviceInfo=deviceInfo{ + for delegate in shareExtensionDelegates{ + delegate.startTransferWithQrCode(device: deviceInfo) + } + } + }else if qrData.count>28{ + do{ + let box=try AES.GCM.SealedBox(combined: qrData) + let decryptedName=try AES.GCM.open(box, using: qrCodeNameEncryptionKey!, authenticating: qrCodeAdvertisingToken!) + guard let name=String.init(data: decryptedName, encoding: .utf8) else {return} + endpointInfo.name=name + let deviceInfo=addFoundDevice(foundService: &foundService, endpointInfo: endpointInfo, endpointID: endpointID) + for delegate in shareExtensionDelegates{ + delegate.startTransferWithQrCode(device: deviceInfo) + } + }catch{ +#if DEBUG + print("Error decrypting QR code data of an invisible device: \(error)") +#endif + } + } + } + } + + private func addFoundDevice(foundService:inout FoundServiceInfo, endpointInfo:EndpointInfo, endpointID:String) -> RemoteDeviceInfo{ + let deviceInfo=RemoteDeviceInfo(info: endpointInfo, id: endpointID) + foundService.device=deviceInfo + foundServices[endpointID]=foundService + for delegate in shareExtensionDelegates{ + delegate.addDevice(device: deviceInfo) + } + return deviceInfo + } + + private func maybeRemoveFoundDevice(service:NWBrowser.Result){ + guard let endpointID=endpointID(for: service) else {return} + guard let _=foundServices.removeValue(forKey: endpointID) else {return} + for delegate in shareExtensionDelegates { + delegate.removeDevice(id: endpointID) + } + } + + public func generateQrCodeKey() -> String{ + let domain=Domain.instance(curve: .EC256r1) + let (pubKey, privKey)=domain.makeKeyPair() + qrCodePublicKey=pubKey + qrCodePrivateKey=privKey + var keyData=Data() + keyData.append(contentsOf: [0, 0, 2]) + let keyBytes=Data(pubKey.w.x.asSignedBytes()) + // Sometimes, for some keys, there will be a leading zero byte. Strip that, Android really hates it (it breaks the endpoint info) + keyData.append(keyBytes.suffixOfAtMost(numBytes: 32)) + + let ikm=SymmetricKey(data: keyData) + qrCodeAdvertisingToken=NearbyConnection.hkdf(inputKeyMaterial: ikm, salt: Data(), info: "advertisingContext".data(using: .utf8)!, outputByteCount: 16).data() + qrCodeNameEncryptionKey=NearbyConnection.hkdf(inputKeyMaterial: ikm, salt: Data(), info: "encryptionKey".data(using: .utf8)!, outputByteCount: 16) + qrCodeData=keyData + + return keyData.urlSafeBase64EncodedString() + } + + public func clearQrCodeKey(){ + qrCodePublicKey=nil + qrCodePrivateKey=nil + qrCodeAdvertisingToken=nil + qrCodeNameEncryptionKey=nil + qrCodeData=nil + } + + public func startOutgoingTransfer(deviceID:String, delegate:ShareExtensionDelegate, urls:[URL]){ + guard let info=foundServices[deviceID] else {return} + let tcp=NWProtocolTCP.Options.init() + tcp.noDelay=true + let nwconn=NWConnection(to: info.service.endpoint, using: NWParameters(tls: .none, tcp: tcp)) + let conn=OutboundNearbyConnection(connection: nwconn, id: deviceID, urlsToSend: urls) + conn.delegate=self + conn.qrCodePrivateKey=qrCodePrivateKey + let transfer=OutgoingTransferInfo(service: info.service, device: info.device!, connection: conn, delegate: delegate) + outgoingTransfers[deviceID]=transfer + conn.start() + } + + public func outboundConnectionWasEstablished(connection: OutboundNearbyConnection) { + guard let transfer=outgoingTransfers[connection.id] else {return} + DispatchQueue.main.async { + transfer.delegate.connectionWasEstablished(pinCode: connection.pinCode!) + } + } + + public func outboundConnectionTransferAccepted(connection: OutboundNearbyConnection) { + guard let transfer=outgoingTransfers[connection.id] else {return} + DispatchQueue.main.async { + transfer.delegate.transferAccepted() + } + } + + public func outboundConnection(connection: OutboundNearbyConnection, transferProgress: Double) { + guard let transfer=outgoingTransfers[connection.id] else {return} + DispatchQueue.main.async { + transfer.delegate.transferProgress(progress: transferProgress) + } + } + + public func outboundConnection(connection: OutboundNearbyConnection, failedWithError: Error) { + guard let transfer=outgoingTransfers[connection.id] else {return} + DispatchQueue.main.async { + transfer.delegate.connectionFailed(with: failedWithError) + } + outgoingTransfers.removeValue(forKey: connection.id) + } + + public func outboundConnectionTransferFinished(connection: OutboundNearbyConnection) { + guard let transfer=outgoingTransfers[connection.id] else {return} + DispatchQueue.main.async { + transfer.delegate.transferFinished() + } + outgoingTransfers.removeValue(forKey: connection.id) + } +} + diff --git a/airsync-mac/Core/QuickShare/OutboundNearbyConnection.swift b/airsync-mac/Core/QuickShare/OutboundNearbyConnection.swift new file mode 100644 index 00000000..84d05b4b --- /dev/null +++ b/airsync-mac/Core/QuickShare/OutboundNearbyConnection.swift @@ -0,0 +1,459 @@ +// +// OutboundNearbyConnection.swift +// NearbyShare +// +// Created by Grishka on 23.09.2023. +// + +import Foundation +import Network +import CryptoKit +import CommonCrypto +import System +import UniformTypeIdentifiers + +import SwiftECC +import BigInt +@preconcurrency import SwiftProtobuf + +@MainActor +public class OutboundNearbyConnection:NearbyConnection{ + private var currentState:State = .initial + private let urlsToSend:[URL] + private var ukeyClientFinishMsgData:Data? + private var queue:[OutgoingFileTransfer]=[] + private var currentTransfer:OutgoingFileTransfer? + public var delegate:OutboundNearbyConnectionDelegate? + private var totalBytesToSend:Int64=0 + private var totalBytesSent:Int64=0 + private var cancelled:Bool=false + private var textPayloadID:Int64=0 + + public var qrCodePrivateKey:ECPrivateKey? + + enum State{ + case initial, sentUkeyClientInit, sentUkeyClientFinish, sentPairedKeyEncryption, sentPairedKeyResult, sentIntroduction, sendingFiles + } + + init(connection: NWConnection, id: String, urlsToSend:[URL]){ + self.urlsToSend=urlsToSend + super.init(connection: connection, id: id) + if urlsToSend.count==1 && !urlsToSend[0].isFileURL{ + textPayloadID=Int64.random(in: Int64.min...Int64.max) + } + } + + nonisolated deinit { + if let transfer=currentTransfer, let handle=transfer.handle{ + try? handle.close() + } + for transfer in queue{ + if let handle=transfer.handle{ + try? handle.close() + } + } + } + + public func cancel(){ + cancelled=true + if encryptionDone{ + var cancel=Sharing_Nearby_Frame() + cancel.version = .v1 + cancel.v1=Sharing_Nearby_V1Frame() + cancel.v1.type = .cancel + try? sendTransferSetupFrame(cancel) + } + try? sendDisconnectionAndDisconnect() + } + + override func connectionReady() { + super.connectionReady() + do{ + try sendConnectionRequest() + try sendUkey2ClientInit() + }catch{ + lastError=error + protocolError() + } + } + + override func isServer() -> Bool { + return false + } + + override func processReceivedFrame(frameData: Data) { + do{ + #if DEBUG + print("received \(frameData), state is \(currentState)") + #endif + switch currentState { + case .initial: + protocolError() + case .sentUkeyClientInit: + try processUkey2ServerInit(frame: try Securegcm_Ukey2Message(serializedData: frameData), raw: frameData) + case .sentUkeyClientFinish: + try processConnectionResponse(frame: try Location_Nearby_Connections_OfflineFrame(serializedData: frameData)) + default: + let smsg=try Securemessage_SecureMessage(serializedData: frameData) + try decryptAndProcessReceivedSecureMessage(smsg) + } + }catch{ + if case NearbyError.ukey2=error{ + }else if currentState == .sentUkeyClientInit{ + sendUkey2Alert(type: .badMessage) + } + lastError=error + protocolError() + } + } + + override func processTransferSetupFrame(_ frame: Sharing_Nearby_Frame) throws { + if frame.hasV1 && frame.v1.hasType, case .cancel = frame.v1.type { + print("Transfer canceled") + try sendDisconnectionAndDisconnect() + delegate?.outboundConnection(connection: self, failedWithError: NearbyError.canceled(reason: .userCanceled)) + return + } + print(frame) + switch currentState{ + case .sentPairedKeyEncryption: + try processPairedKeyEncryption(frame: frame) + case .sentPairedKeyResult: + try processPairedKeyResult(frame: frame) + case .sentIntroduction: + try processConsent(frame: frame) + case .sendingFiles: + break + default: + assertionFailure("Unexpected state \(currentState)") + } + } + + override func protocolError() { + super.protocolError() + delegate?.outboundConnection(connection: self, failedWithError: lastError!) + } + + private func sendConnectionRequest() throws { + var frame=Location_Nearby_Connections_OfflineFrame() + frame.version = .v1 + frame.v1=Location_Nearby_Connections_V1Frame() + frame.v1.type = .connectionRequest + frame.v1.connectionRequest=Location_Nearby_Connections_ConnectionRequestFrame() + frame.v1.connectionRequest.endpointID=String(bytes: NearbyConnectionManager.shared.endpointID, encoding: .ascii)! + frame.v1.connectionRequest.endpointName=Host.current().localizedName! + let endpointInfo=EndpointInfo(name: Host.current().localizedName!, deviceType: .computer) + frame.v1.connectionRequest.endpointInfo=endpointInfo.serialize() + frame.v1.connectionRequest.mediums=[.wifiLan] + sendFrameAsync(try frame.serializedData()) + } + + private func sendUkey2ClientInit() throws { + let domain=Domain.instance(curve: .EC256r1) + let (pubKey, privKey)=domain.makeKeyPair() + publicKey=pubKey + privateKey=privKey + + var finishFrame=Securegcm_Ukey2Message() + finishFrame.messageType = .clientFinish + var finish=Securegcm_Ukey2ClientFinished() + var pkey=Securemessage_GenericPublicKey() + pkey.type = .ecP256 + pkey.ecP256PublicKey=Securemessage_EcP256PublicKey() + pkey.ecP256PublicKey.x=Data(pubKey.w.x.asSignedBytes()) + pkey.ecP256PublicKey.y=Data(pubKey.w.y.asSignedBytes()) + finish.publicKey=try pkey.serializedData() + finishFrame.messageData=try finish.serializedData() + ukeyClientFinishMsgData=try finishFrame.serializedData() + + var frame=Securegcm_Ukey2Message() + frame.messageType = .clientInit + + var clientInit=Securegcm_Ukey2ClientInit() + clientInit.version=1 + clientInit.random=Data.randomData(length: 32) + clientInit.nextProtocol="AES_256_CBC-HMAC_SHA256" + var sha=SHA512() + sha.update(data: ukeyClientFinishMsgData!) + var commitment=Securegcm_Ukey2ClientInit.CipherCommitment() + commitment.commitment=Data(sha.finalize()) + commitment.handshakeCipher = .p256Sha512 + clientInit.cipherCommitments.append(commitment) + frame.messageData=try clientInit.serializedData() + + ukeyClientInitMsgData=try frame.serializedData() + sendFrameAsync(ukeyClientInitMsgData!) + currentState = .sentUkeyClientInit + } + + private func processUkey2ServerInit(frame:Securegcm_Ukey2Message, raw:Data) throws{ + ukeyServerInitMsgData=raw + guard frame.messageType == .serverInit else{ + sendUkey2Alert(type: .badMessageType) + throw NearbyError.ukey2 + } + let serverInit=try Securegcm_Ukey2ServerInit(serializedData: frame.messageData) + guard serverInit.version==1 else{ + sendUkey2Alert(type: .badVersion) + throw NearbyError.ukey2 + } + guard serverInit.random.count==32 else{ + sendUkey2Alert(type: .badRandom) + throw NearbyError.ukey2 + } + guard serverInit.handshakeCipher == .p256Sha512 else{ + sendUkey2Alert(type: .badHandshakeCipher) + throw NearbyError.ukey2 + } + + let serverKey=try Securemessage_GenericPublicKey(serializedData: serverInit.publicKey) + try finalizeKeyExchange(peerKey: serverKey) + sendFrameAsync(ukeyClientFinishMsgData!) + currentState = .sentUkeyClientFinish + + var resp=Location_Nearby_Connections_OfflineFrame() + resp.version = .v1 + resp.v1=Location_Nearby_Connections_V1Frame() + resp.v1.type = .connectionResponse + resp.v1.connectionResponse=Location_Nearby_Connections_ConnectionResponseFrame() + resp.v1.connectionResponse.response = .accept + resp.v1.connectionResponse.status=0 + resp.v1.connectionResponse.osInfo=Location_Nearby_Connections_OsInfo() + resp.v1.connectionResponse.osInfo.type = .apple + sendFrameAsync(try resp.serializedData()) + + encryptionDone=true + delegate?.outboundConnectionWasEstablished(connection: self) + } + + private func processConnectionResponse(frame:Location_Nearby_Connections_OfflineFrame) throws{ + #if DEBUG + print("connection response: \(frame)") + #endif + guard frame.version == .v1 else {throw NearbyError.protocolError("Unexpected offline frame version \(frame.version)")} + guard frame.v1.type == .connectionResponse else {throw NearbyError.protocolError("Unexpected frame type \(frame.v1.type)")} + guard frame.v1.connectionResponse.response == .accept else {throw NearbyError.protocolError("Connection was rejected by recipient")} + + var pairedEncryption=Sharing_Nearby_Frame() + pairedEncryption.version = .v1 + pairedEncryption.v1=Sharing_Nearby_V1Frame() + pairedEncryption.v1.type = .pairedKeyEncryption + pairedEncryption.v1.pairedKeyEncryption=Sharing_Nearby_PairedKeyEncryptionFrame() + pairedEncryption.v1.pairedKeyEncryption.secretIDHash=Data.randomData(length: 6) + pairedEncryption.v1.pairedKeyEncryption.signedData=Data.randomData(length: 72) + if let qrKey=qrCodePrivateKey{ + let signature=qrKey.sign(msg: authKey!.data()) + var serializedSignature=Data(signature.r) + serializedSignature.append(Data(signature.s)) + pairedEncryption.v1.pairedKeyEncryption.qrCodeHandshakeData=serializedSignature + } + try sendTransferSetupFrame(pairedEncryption) + + currentState = .sentPairedKeyEncryption + } + + private func processPairedKeyEncryption(frame:Sharing_Nearby_Frame) throws{ + guard frame.hasV1, frame.v1.hasPairedKeyEncryption else { throw NearbyError.requiredFieldMissing("sharingNearbyFrame.v1.pairedKeyEncryption") } + var pairedResult=Sharing_Nearby_Frame() + pairedResult.version = .v1 + pairedResult.v1=Sharing_Nearby_V1Frame() + pairedResult.v1.type = .pairedKeyResult + pairedResult.v1.pairedKeyResult=Sharing_Nearby_PairedKeyResultFrame() + pairedResult.v1.pairedKeyResult.status = .unable + try sendTransferSetupFrame(pairedResult) + currentState = .sentPairedKeyResult + } + + private func processPairedKeyResult(frame:Sharing_Nearby_Frame) throws{ + guard frame.hasV1, frame.v1.hasPairedKeyResult else { throw NearbyError.requiredFieldMissing("sharingNearbyFrame.v1.pairedKeyResult") } + + var introduction=Sharing_Nearby_Frame() + introduction.version = .v1 + introduction.v1.type = .introduction + if urlsToSend.count==1 && !urlsToSend[0].isFileURL{ + var meta=Sharing_Nearby_TextMetadata() + meta.type = .url + meta.textTitle=urlsToSend[0].host ?? "URL" + meta.size=Int64(urlsToSend[0].absoluteString.utf8.count) + meta.payloadID=textPayloadID + introduction.v1.introduction.textMetadata.append(meta) + }else{ + for url in urlsToSend{ + guard url.isFileURL else {continue} + var meta=Sharing_Nearby_FileMetadata() + meta.name=OutboundNearbyConnection.sanitizeFileName(name: url.lastPathComponent) + let attrs=try FileManager.default.attributesOfItem(atPath: url.path) + meta.size=(attrs[FileAttributeKey.size] as! NSNumber).int64Value + let typeID=try? url.resourceValues(forKeys: [.typeIdentifierKey]).typeIdentifier + meta.mimeType="application/octet-stream" + if let typeID=typeID{ + if #available(macOS 11.0, *){ + let type=UTType(typeID) + if let type=type, let mimeType=type.preferredMIMEType{ + meta.mimeType=mimeType + } + }else{ + if let mimeType=UTTypeCopyPreferredTagWithClass(typeID as CFString, kUTTagClassMIMEType){ + meta.mimeType=(mimeType.takeRetainedValue() as NSString) as String + } + } + } + if meta.mimeType.starts(with: "image/"){ + meta.type = .image + }else if meta.mimeType.starts(with: "video/"){ + meta.type = .video + }else if(meta.mimeType.starts(with: "audio/")){ + meta.type = .audio + }else if(url.pathExtension.lowercased()=="apk"){ + meta.type = .androidApp + }else{ + meta.type = .unknown + } + meta.payloadID=Int64.random(in: Int64.min...Int64.max) + queue.append(OutgoingFileTransfer(url: url, payloadID: meta.payloadID, handle: try FileHandle(forReadingFrom: url), totalBytes: meta.size, currentOffset: 0)) + introduction.v1.introduction.fileMetadata.append(meta) + totalBytesToSend+=meta.size + } + } + #if DEBUG + print("sent introduction: \(introduction)") + #endif + try sendTransferSetupFrame(introduction) + + currentState = .sentIntroduction + } + + private func processConsent(frame:Sharing_Nearby_Frame) throws{ + guard frame.version == .v1, frame.v1.type == .response else {throw NearbyError.requiredFieldMissing("sharingNearbyFrame.v1.type==response")} + switch frame.v1.connectionResponse.status{ + case .accept: + currentState = .sendingFiles + delegate?.outboundConnectionTransferAccepted(connection: self) + if urlsToSend.count==1 && !urlsToSend[0].isFileURL{ + try sendURL() + }else{ + try sendNextFileChunk() + } + case .reject, .unknown: + delegate?.outboundConnection(connection: self, failedWithError: NearbyError.canceled(reason: .userRejected)) + try sendDisconnectionAndDisconnect() + case .notEnoughSpace: + delegate?.outboundConnection(connection: self, failedWithError: NearbyError.canceled(reason: .notEnoughSpace)) + try sendDisconnectionAndDisconnect() + case .timedOut: + delegate?.outboundConnection(connection: self, failedWithError: NearbyError.canceled(reason: .timedOut)) + try sendDisconnectionAndDisconnect() + case .unsupportedAttachmentType: + delegate?.outboundConnection(connection: self, failedWithError: NearbyError.canceled(reason: .unsupportedType)) + try sendDisconnectionAndDisconnect() + } + } + + private func sendURL() throws{ + try sendBytesPayload(data: Data(urlsToSend[0].absoluteString.utf8), id: textPayloadID) + delegate?.outboundConnectionTransferFinished(connection: self) + try sendDisconnectionAndDisconnect() + } + + private func sendNextFileChunk() throws{ + if cancelled{ + return + } + if currentTransfer==nil || currentTransfer?.currentOffset==currentTransfer?.totalBytes{ + if currentTransfer != nil && currentTransfer?.handle != nil{ + try currentTransfer?.handle?.close() + } + if queue.isEmpty{ + #if DEBUG + print("Disconnecting because all files have been transferred") + #endif + try sendDisconnectionAndDisconnect() + delegate?.outboundConnectionTransferFinished(connection: self) + return + } + currentTransfer=queue.removeFirst() + } + + let fileBuffer:Data + if #available(macOS 10.15.4, *) { + guard let _fileBuffer=try currentTransfer!.handle!.read(upToCount: 512*1024) else{ + throw NearbyError.inputOutput + } + fileBuffer=_fileBuffer + } else { + fileBuffer=currentTransfer!.handle!.readData(ofLength: 512*1024) + } + + var transfer=Location_Nearby_Connections_PayloadTransferFrame() + transfer.packetType = .data + transfer.payloadChunk.offset=currentTransfer!.currentOffset + transfer.payloadChunk.flags=0 + transfer.payloadChunk.body=fileBuffer + transfer.payloadHeader.id=currentTransfer!.payloadID + transfer.payloadHeader.type = .file + transfer.payloadHeader.totalSize=Int64(currentTransfer!.totalBytes) + transfer.payloadHeader.isSensitive=false + currentTransfer!.currentOffset+=Int64(fileBuffer.count) + + var wrapper=Location_Nearby_Connections_OfflineFrame() + wrapper.version = .v1 + wrapper.v1=Location_Nearby_Connections_V1Frame() + wrapper.v1.type = .payloadTransfer + wrapper.v1.payloadTransfer=transfer + try encryptAndSendOfflineFrame(wrapper, completion: { + do{ + try self.sendNextFileChunk() + }catch{ + self.lastError=error + self.protocolError() + } + }) + #if DEBUG + print("sent file chunk, current transfer: \(String(describing: currentTransfer))") + #endif + totalBytesSent+=Int64(fileBuffer.count) + delegate?.outboundConnection(connection: self, transferProgress: Double(totalBytesSent)/Double(totalBytesToSend)) + + if currentTransfer!.currentOffset==currentTransfer!.totalBytes{ + // Signal end of file (yes, all this for one bit) + var transfer=Location_Nearby_Connections_PayloadTransferFrame() + transfer.packetType = .data + transfer.payloadChunk.offset=currentTransfer!.currentOffset + transfer.payloadChunk.flags=1 // <- this one here + transfer.payloadHeader.id=currentTransfer!.payloadID + transfer.payloadHeader.type = .file + transfer.payloadHeader.totalSize=Int64(currentTransfer!.totalBytes) + transfer.payloadHeader.isSensitive=false + + var wrapper=Location_Nearby_Connections_OfflineFrame() + wrapper.version = .v1 + wrapper.v1=Location_Nearby_Connections_V1Frame() + wrapper.v1.type = .payloadTransfer + wrapper.v1.payloadTransfer=transfer + try encryptAndSendOfflineFrame(wrapper) + #if DEBUG + print("sent EOF, current transfer: \(String(describing: currentTransfer))") + #endif + } + } + + private static func sanitizeFileName(name:String)->String{ + return name.replacingOccurrences(of: "[\\/\\\\?%\\*:\\|\"<>=]", with: "_", options: .regularExpression) + } +} + +fileprivate struct OutgoingFileTransfer{ + let url:URL + let payloadID:Int64 + let handle:FileHandle? + let totalBytes:Int64 + var currentOffset:Int64 +} + +public protocol OutboundNearbyConnectionDelegate{ + func outboundConnectionWasEstablished(connection:OutboundNearbyConnection) + func outboundConnection(connection:OutboundNearbyConnection, transferProgress:Double) + func outboundConnectionTransferAccepted(connection:OutboundNearbyConnection) + func outboundConnection(connection:OutboundNearbyConnection, failedWithError:Error) + func outboundConnectionTransferFinished(connection:OutboundNearbyConnection) +} diff --git a/airsync-mac/Core/QuickShare/Protobuf/device_to_device_messages.pb.swift b/airsync-mac/Core/QuickShare/Protobuf/device_to_device_messages.pb.swift new file mode 100644 index 00000000..f978a9dc --- /dev/null +++ b/airsync-mac/Core/QuickShare/Protobuf/device_to_device_messages.pb.swift @@ -0,0 +1,540 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: device_to_device_messages.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +@preconcurrency import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// Type of curve +enum Securegcm_Curve: SwiftProtobuf.Enum { + typealias RawValue = Int + case ed25519 // = 1 + + init() { + self = .ed25519 + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .ed25519 + default: return nil + } + } + + var rawValue: Int { + switch self { + case .ed25519: return 1 + } + } + +} + +#if swift(>=4.2) + +extension Securegcm_Curve: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Used by protocols between devices +struct Securegcm_DeviceToDeviceMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// the payload of the message + var message: Data { + get {return _message ?? Data()} + set {_message = newValue} + } + /// Returns true if `message` has been explicitly set. + var hasMessage: Bool {return self._message != nil} + /// Clears the value of `message`. Subsequent reads from it will return its default value. + mutating func clearMessage() {self._message = nil} + + /// the sequence number of the message - must be increasing. + var sequenceNumber: Int32 { + get {return _sequenceNumber ?? 0} + set {_sequenceNumber = newValue} + } + /// Returns true if `sequenceNumber` has been explicitly set. + var hasSequenceNumber: Bool {return self._sequenceNumber != nil} + /// Clears the value of `sequenceNumber`. Subsequent reads from it will return its default value. + mutating func clearSequenceNumber() {self._sequenceNumber = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _message: Data? = nil + fileprivate var _sequenceNumber: Int32? = nil +} + +/// sent as the first message from initiator to responder +/// in an unauthenticated Diffie-Hellman Key Exchange +struct Securegcm_InitiatorHello { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The session public key to send to the responder + var publicDhKey: Securemessage_GenericPublicKey { + get {return _publicDhKey ?? Securemessage_GenericPublicKey()} + set {_publicDhKey = newValue} + } + /// Returns true if `publicDhKey` has been explicitly set. + var hasPublicDhKey: Bool {return self._publicDhKey != nil} + /// Clears the value of `publicDhKey`. Subsequent reads from it will return its default value. + mutating func clearPublicDhKey() {self._publicDhKey = nil} + + /// The protocol version + var protocolVersion: Int32 { + get {return _protocolVersion ?? 0} + set {_protocolVersion = newValue} + } + /// Returns true if `protocolVersion` has been explicitly set. + var hasProtocolVersion: Bool {return self._protocolVersion != nil} + /// Clears the value of `protocolVersion`. Subsequent reads from it will return its default value. + mutating func clearProtocolVersion() {self._protocolVersion = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _publicDhKey: Securemessage_GenericPublicKey? = nil + fileprivate var _protocolVersion: Int32? = nil +} + +/// sent inside the header of the first message from the responder to the +/// initiator in an unauthenticated Diffie-Hellman Key Exchange +struct Securegcm_ResponderHello { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The session public key to send to the initiator + var publicDhKey: Securemessage_GenericPublicKey { + get {return _publicDhKey ?? Securemessage_GenericPublicKey()} + set {_publicDhKey = newValue} + } + /// Returns true if `publicDhKey` has been explicitly set. + var hasPublicDhKey: Bool {return self._publicDhKey != nil} + /// Clears the value of `publicDhKey`. Subsequent reads from it will return its default value. + mutating func clearPublicDhKey() {self._publicDhKey = nil} + + /// The protocol version + var protocolVersion: Int32 { + get {return _protocolVersion ?? 0} + set {_protocolVersion = newValue} + } + /// Returns true if `protocolVersion` has been explicitly set. + var hasProtocolVersion: Bool {return self._protocolVersion != nil} + /// Clears the value of `protocolVersion`. Subsequent reads from it will return its default value. + mutating func clearProtocolVersion() {self._protocolVersion = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _publicDhKey: Securemessage_GenericPublicKey? = nil + fileprivate var _protocolVersion: Int32? = nil +} + +/// A convenience proto for encoding curve points in affine representation +struct Securegcm_EcPoint { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var curve: Securegcm_Curve { + get {return _curve ?? .ed25519} + set {_curve = newValue} + } + /// Returns true if `curve` has been explicitly set. + var hasCurve: Bool {return self._curve != nil} + /// Clears the value of `curve`. Subsequent reads from it will return its default value. + mutating func clearCurve() {self._curve = nil} + + /// x and y are encoded in big-endian two's complement + /// client MUST verify (x,y) is a valid point on the specified curve + var x: Data { + get {return _x ?? Data()} + set {_x = newValue} + } + /// Returns true if `x` has been explicitly set. + var hasX: Bool {return self._x != nil} + /// Clears the value of `x`. Subsequent reads from it will return its default value. + mutating func clearX() {self._x = nil} + + var y: Data { + get {return _y ?? Data()} + set {_y = newValue} + } + /// Returns true if `y` has been explicitly set. + var hasY: Bool {return self._y != nil} + /// Clears the value of `y`. Subsequent reads from it will return its default value. + mutating func clearY() {self._y = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _curve: Securegcm_Curve? = nil + fileprivate var _x: Data? = nil + fileprivate var _y: Data? = nil +} + +struct Securegcm_SpakeHandshakeMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Each flow in the protocol bumps this counter + var flowNumber: Int32 { + get {return _flowNumber ?? 0} + set {_flowNumber = newValue} + } + /// Returns true if `flowNumber` has been explicitly set. + var hasFlowNumber: Bool {return self._flowNumber != nil} + /// Clears the value of `flowNumber`. Subsequent reads from it will return its default value. + mutating func clearFlowNumber() {self._flowNumber = nil} + + /// Some (but not all) SPAKE flows send a point on an elliptic curve + var ecPoint: Securegcm_EcPoint { + get {return _ecPoint ?? Securegcm_EcPoint()} + set {_ecPoint = newValue} + } + /// Returns true if `ecPoint` has been explicitly set. + var hasEcPoint: Bool {return self._ecPoint != nil} + /// Clears the value of `ecPoint`. Subsequent reads from it will return its default value. + mutating func clearEcPoint() {self._ecPoint = nil} + + /// Some (but not all) SPAKE flows send a hash value + var hashValue_p: Data { + get {return _hashValue_p ?? Data()} + set {_hashValue_p = newValue} + } + /// Returns true if `hashValue_p` has been explicitly set. + var hasHashValue_p: Bool {return self._hashValue_p != nil} + /// Clears the value of `hashValue_p`. Subsequent reads from it will return its default value. + mutating func clearHashValue_p() {self._hashValue_p = nil} + + /// The last flow of a SPAKE protocol can send an optional payload, + /// since the key exchange is already complete on the sender's side. + var payload: Data { + get {return _payload ?? Data()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + mutating func clearPayload() {self._payload = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _flowNumber: Int32? = nil + fileprivate var _ecPoint: Securegcm_EcPoint? = nil + fileprivate var _hashValue_p: Data? = nil + fileprivate var _payload: Data? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Securegcm_Curve: @unchecked Sendable {} +extension Securegcm_DeviceToDeviceMessage: @unchecked Sendable {} +extension Securegcm_InitiatorHello: @unchecked Sendable {} +extension Securegcm_ResponderHello: @unchecked Sendable {} +extension Securegcm_EcPoint: @unchecked Sendable {} +extension Securegcm_SpakeHandshakeMessage: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "securegcm" + +extension Securegcm_Curve: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "ED_25519"), + ] +} + +extension Securegcm_DeviceToDeviceMessage: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DeviceToDeviceMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "message"), + 2: .standard(proto: "sequence_number"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._message) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._sequenceNumber) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._message { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._sequenceNumber { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_DeviceToDeviceMessage, rhs: Securegcm_DeviceToDeviceMessage) -> Bool { + if lhs._message != rhs._message {return false} + if lhs._sequenceNumber != rhs._sequenceNumber {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_InitiatorHello: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".InitiatorHello" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "public_dh_key"), + 2: .standard(proto: "protocol_version"), + ] + + public var isInitialized: Bool { + if let v = self._publicDhKey, !v.isInitialized {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._publicDhKey) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._protocolVersion) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._publicDhKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._protocolVersion { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_InitiatorHello, rhs: Securegcm_InitiatorHello) -> Bool { + if lhs._publicDhKey != rhs._publicDhKey {return false} + if lhs._protocolVersion != rhs._protocolVersion {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_ResponderHello: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResponderHello" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "public_dh_key"), + 2: .standard(proto: "protocol_version"), + ] + + public var isInitialized: Bool { + if let v = self._publicDhKey, !v.isInitialized {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._publicDhKey) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._protocolVersion) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._publicDhKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._protocolVersion { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_ResponderHello, rhs: Securegcm_ResponderHello) -> Bool { + if lhs._publicDhKey != rhs._publicDhKey {return false} + if lhs._protocolVersion != rhs._protocolVersion {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_EcPoint: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EcPoint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "curve"), + 2: .same(proto: "x"), + 3: .same(proto: "y"), + ] + + public var isInitialized: Bool { + if self._curve == nil {return false} + if self._x == nil {return false} + if self._y == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._curve) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._x) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._y) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._curve { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._x { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try { if let v = self._y { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_EcPoint, rhs: Securegcm_EcPoint) -> Bool { + if lhs._curve != rhs._curve {return false} + if lhs._x != rhs._x {return false} + if lhs._y != rhs._y {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_SpakeHandshakeMessage: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SpakeHandshakeMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "flow_number"), + 2: .standard(proto: "ec_point"), + 3: .standard(proto: "hash_value"), + 4: .same(proto: "payload"), + ] + + public var isInitialized: Bool { + if let v = self._ecPoint, !v.isInitialized {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._flowNumber) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._ecPoint) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._hashValue_p) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self._payload) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._flowNumber { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._ecPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = self._hashValue_p { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = self._payload { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_SpakeHandshakeMessage, rhs: Securegcm_SpakeHandshakeMessage) -> Bool { + if lhs._flowNumber != rhs._flowNumber {return false} + if lhs._ecPoint != rhs._ecPoint {return false} + if lhs._hashValue_p != rhs._hashValue_p {return false} + if lhs._payload != rhs._payload {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/airsync-mac/Core/QuickShare/Protobuf/offline_wire_formats.pb.swift b/airsync-mac/Core/QuickShare/Protobuf/offline_wire_formats.pb.swift new file mode 100644 index 00000000..023f2fc0 --- /dev/null +++ b/airsync-mac/Core/QuickShare/Protobuf/offline_wire_formats.pb.swift @@ -0,0 +1,5546 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: offline_wire_formats.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +@preconcurrency import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +enum Location_Nearby_Connections_EndpointType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownEndpoint // = 0 + case connectionsEndpoint // = 1 + case presenceEndpoint // = 2 + + init() { + self = .unknownEndpoint + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownEndpoint + case 1: self = .connectionsEndpoint + case 2: self = .presenceEndpoint + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownEndpoint: return 0 + case .connectionsEndpoint: return 1 + case .presenceEndpoint: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_EndpointType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_OfflineFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var version: Location_Nearby_Connections_OfflineFrame.Version { + get {return _version ?? .unknownVersion} + set {_version = newValue} + } + /// Returns true if `version` has been explicitly set. + var hasVersion: Bool {return self._version != nil} + /// Clears the value of `version`. Subsequent reads from it will return its default value. + mutating func clearVersion() {self._version = nil} + + /// Right now there's only 1 version, but if there are more, exactly one of + /// the following fields will be set. + var v1: Location_Nearby_Connections_V1Frame { + get {return _v1 ?? Location_Nearby_Connections_V1Frame()} + set {_v1 = newValue} + } + /// Returns true if `v1` has been explicitly set. + var hasV1: Bool {return self._v1 != nil} + /// Clears the value of `v1`. Subsequent reads from it will return its default value. + mutating func clearV1() {self._v1 = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Version: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownVersion // = 0 + case v1 // = 1 + + init() { + self = .unknownVersion + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownVersion + case 1: self = .v1 + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownVersion: return 0 + case .v1: return 1 + } + } + + } + + init() {} + + fileprivate var _version: Location_Nearby_Connections_OfflineFrame.Version? = nil + fileprivate var _v1: Location_Nearby_Connections_V1Frame? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_OfflineFrame.Version: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_V1Frame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: Location_Nearby_Connections_V1Frame.FrameType { + get {return _storage._type ?? .unknownFrameType} + set {_uniqueStorage()._type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return _storage._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {_uniqueStorage()._type = nil} + + /// Exactly one of the following fields will be set. + var connectionRequest: Location_Nearby_Connections_ConnectionRequestFrame { + get {return _storage._connectionRequest ?? Location_Nearby_Connections_ConnectionRequestFrame()} + set {_uniqueStorage()._connectionRequest = newValue} + } + /// Returns true if `connectionRequest` has been explicitly set. + var hasConnectionRequest: Bool {return _storage._connectionRequest != nil} + /// Clears the value of `connectionRequest`. Subsequent reads from it will return its default value. + mutating func clearConnectionRequest() {_uniqueStorage()._connectionRequest = nil} + + var connectionResponse: Location_Nearby_Connections_ConnectionResponseFrame { + get {return _storage._connectionResponse ?? Location_Nearby_Connections_ConnectionResponseFrame()} + set {_uniqueStorage()._connectionResponse = newValue} + } + /// Returns true if `connectionResponse` has been explicitly set. + var hasConnectionResponse: Bool {return _storage._connectionResponse != nil} + /// Clears the value of `connectionResponse`. Subsequent reads from it will return its default value. + mutating func clearConnectionResponse() {_uniqueStorage()._connectionResponse = nil} + + var payloadTransfer: Location_Nearby_Connections_PayloadTransferFrame { + get {return _storage._payloadTransfer ?? Location_Nearby_Connections_PayloadTransferFrame()} + set {_uniqueStorage()._payloadTransfer = newValue} + } + /// Returns true if `payloadTransfer` has been explicitly set. + var hasPayloadTransfer: Bool {return _storage._payloadTransfer != nil} + /// Clears the value of `payloadTransfer`. Subsequent reads from it will return its default value. + mutating func clearPayloadTransfer() {_uniqueStorage()._payloadTransfer = nil} + + var bandwidthUpgradeNegotiation: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame { + get {return _storage._bandwidthUpgradeNegotiation ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame()} + set {_uniqueStorage()._bandwidthUpgradeNegotiation = newValue} + } + /// Returns true if `bandwidthUpgradeNegotiation` has been explicitly set. + var hasBandwidthUpgradeNegotiation: Bool {return _storage._bandwidthUpgradeNegotiation != nil} + /// Clears the value of `bandwidthUpgradeNegotiation`. Subsequent reads from it will return its default value. + mutating func clearBandwidthUpgradeNegotiation() {_uniqueStorage()._bandwidthUpgradeNegotiation = nil} + + var keepAlive: Location_Nearby_Connections_KeepAliveFrame { + get {return _storage._keepAlive ?? Location_Nearby_Connections_KeepAliveFrame()} + set {_uniqueStorage()._keepAlive = newValue} + } + /// Returns true if `keepAlive` has been explicitly set. + var hasKeepAlive: Bool {return _storage._keepAlive != nil} + /// Clears the value of `keepAlive`. Subsequent reads from it will return its default value. + mutating func clearKeepAlive() {_uniqueStorage()._keepAlive = nil} + + var disconnection: Location_Nearby_Connections_DisconnectionFrame { + get {return _storage._disconnection ?? Location_Nearby_Connections_DisconnectionFrame()} + set {_uniqueStorage()._disconnection = newValue} + } + /// Returns true if `disconnection` has been explicitly set. + var hasDisconnection: Bool {return _storage._disconnection != nil} + /// Clears the value of `disconnection`. Subsequent reads from it will return its default value. + mutating func clearDisconnection() {_uniqueStorage()._disconnection = nil} + + var pairedKeyEncryption: Location_Nearby_Connections_PairedKeyEncryptionFrame { + get {return _storage._pairedKeyEncryption ?? Location_Nearby_Connections_PairedKeyEncryptionFrame()} + set {_uniqueStorage()._pairedKeyEncryption = newValue} + } + /// Returns true if `pairedKeyEncryption` has been explicitly set. + var hasPairedKeyEncryption: Bool {return _storage._pairedKeyEncryption != nil} + /// Clears the value of `pairedKeyEncryption`. Subsequent reads from it will return its default value. + mutating func clearPairedKeyEncryption() {_uniqueStorage()._pairedKeyEncryption = nil} + + var authenticationMessage: Location_Nearby_Connections_AuthenticationMessageFrame { + get {return _storage._authenticationMessage ?? Location_Nearby_Connections_AuthenticationMessageFrame()} + set {_uniqueStorage()._authenticationMessage = newValue} + } + /// Returns true if `authenticationMessage` has been explicitly set. + var hasAuthenticationMessage: Bool {return _storage._authenticationMessage != nil} + /// Clears the value of `authenticationMessage`. Subsequent reads from it will return its default value. + mutating func clearAuthenticationMessage() {_uniqueStorage()._authenticationMessage = nil} + + var authenticationResult: Location_Nearby_Connections_AuthenticationResultFrame { + get {return _storage._authenticationResult ?? Location_Nearby_Connections_AuthenticationResultFrame()} + set {_uniqueStorage()._authenticationResult = newValue} + } + /// Returns true if `authenticationResult` has been explicitly set. + var hasAuthenticationResult: Bool {return _storage._authenticationResult != nil} + /// Clears the value of `authenticationResult`. Subsequent reads from it will return its default value. + mutating func clearAuthenticationResult() {_uniqueStorage()._authenticationResult = nil} + + var autoResume: Location_Nearby_Connections_AutoResumeFrame { + get {return _storage._autoResume ?? Location_Nearby_Connections_AutoResumeFrame()} + set {_uniqueStorage()._autoResume = newValue} + } + /// Returns true if `autoResume` has been explicitly set. + var hasAutoResume: Bool {return _storage._autoResume != nil} + /// Clears the value of `autoResume`. Subsequent reads from it will return its default value. + mutating func clearAutoResume() {_uniqueStorage()._autoResume = nil} + + var autoReconnect: Location_Nearby_Connections_AutoReconnectFrame { + get {return _storage._autoReconnect ?? Location_Nearby_Connections_AutoReconnectFrame()} + set {_uniqueStorage()._autoReconnect = newValue} + } + /// Returns true if `autoReconnect` has been explicitly set. + var hasAutoReconnect: Bool {return _storage._autoReconnect != nil} + /// Clears the value of `autoReconnect`. Subsequent reads from it will return its default value. + mutating func clearAutoReconnect() {_uniqueStorage()._autoReconnect = nil} + + var bandwidthUpgradeRetry: Location_Nearby_Connections_BandwidthUpgradeRetryFrame { + get {return _storage._bandwidthUpgradeRetry ?? Location_Nearby_Connections_BandwidthUpgradeRetryFrame()} + set {_uniqueStorage()._bandwidthUpgradeRetry = newValue} + } + /// Returns true if `bandwidthUpgradeRetry` has been explicitly set. + var hasBandwidthUpgradeRetry: Bool {return _storage._bandwidthUpgradeRetry != nil} + /// Clears the value of `bandwidthUpgradeRetry`. Subsequent reads from it will return its default value. + mutating func clearBandwidthUpgradeRetry() {_uniqueStorage()._bandwidthUpgradeRetry = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum FrameType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownFrameType // = 0 + case connectionRequest // = 1 + case connectionResponse // = 2 + case payloadTransfer // = 3 + case bandwidthUpgradeNegotiation // = 4 + case keepAlive // = 5 + case disconnection // = 6 + case pairedKeyEncryption // = 7 + case authenticationMessage // = 8 + case authenticationResult // = 9 + case autoResume // = 10 + case autoReconnect // = 11 + case bandwidthUpgradeRetry // = 12 + + init() { + self = .unknownFrameType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownFrameType + case 1: self = .connectionRequest + case 2: self = .connectionResponse + case 3: self = .payloadTransfer + case 4: self = .bandwidthUpgradeNegotiation + case 5: self = .keepAlive + case 6: self = .disconnection + case 7: self = .pairedKeyEncryption + case 8: self = .authenticationMessage + case 9: self = .authenticationResult + case 10: self = .autoResume + case 11: self = .autoReconnect + case 12: self = .bandwidthUpgradeRetry + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownFrameType: return 0 + case .connectionRequest: return 1 + case .connectionResponse: return 2 + case .payloadTransfer: return 3 + case .bandwidthUpgradeNegotiation: return 4 + case .keepAlive: return 5 + case .disconnection: return 6 + case .pairedKeyEncryption: return 7 + case .authenticationMessage: return 8 + case .authenticationResult: return 9 + case .autoResume: return 10 + case .autoReconnect: return 11 + case .bandwidthUpgradeRetry: return 12 + } + } + + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_V1Frame.FrameType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_ConnectionRequestFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var endpointID: String { + get {return _storage._endpointID ?? String()} + set {_uniqueStorage()._endpointID = newValue} + } + /// Returns true if `endpointID` has been explicitly set. + var hasEndpointID: Bool {return _storage._endpointID != nil} + /// Clears the value of `endpointID`. Subsequent reads from it will return its default value. + mutating func clearEndpointID() {_uniqueStorage()._endpointID = nil} + + var endpointName: String { + get {return _storage._endpointName ?? String()} + set {_uniqueStorage()._endpointName = newValue} + } + /// Returns true if `endpointName` has been explicitly set. + var hasEndpointName: Bool {return _storage._endpointName != nil} + /// Clears the value of `endpointName`. Subsequent reads from it will return its default value. + mutating func clearEndpointName() {_uniqueStorage()._endpointName = nil} + + var handshakeData: Data { + get {return _storage._handshakeData ?? Data()} + set {_uniqueStorage()._handshakeData = newValue} + } + /// Returns true if `handshakeData` has been explicitly set. + var hasHandshakeData: Bool {return _storage._handshakeData != nil} + /// Clears the value of `handshakeData`. Subsequent reads from it will return its default value. + mutating func clearHandshakeData() {_uniqueStorage()._handshakeData = nil} + + /// A random number generated for each outgoing connection that is presently + /// used to act as a tiebreaker when 2 devices connect to each other + /// simultaneously; this can also be used for other initialization-scoped + /// things in the future. + var nonce: Int32 { + get {return _storage._nonce ?? 0} + set {_uniqueStorage()._nonce = newValue} + } + /// Returns true if `nonce` has been explicitly set. + var hasNonce: Bool {return _storage._nonce != nil} + /// Clears the value of `nonce`. Subsequent reads from it will return its default value. + mutating func clearNonce() {_uniqueStorage()._nonce = nil} + + /// The mediums this device supports upgrading to. This list should be filtered + /// by both the strategy and this device's individual limitations. + var mediums: [Location_Nearby_Connections_ConnectionRequestFrame.Medium] { + get {return _storage._mediums} + set {_uniqueStorage()._mediums = newValue} + } + + var endpointInfo: Data { + get {return _storage._endpointInfo ?? Data()} + set {_uniqueStorage()._endpointInfo = newValue} + } + /// Returns true if `endpointInfo` has been explicitly set. + var hasEndpointInfo: Bool {return _storage._endpointInfo != nil} + /// Clears the value of `endpointInfo`. Subsequent reads from it will return its default value. + mutating func clearEndpointInfo() {_uniqueStorage()._endpointInfo = nil} + + var mediumMetadata: Location_Nearby_Connections_MediumMetadata { + get {return _storage._mediumMetadata ?? Location_Nearby_Connections_MediumMetadata()} + set {_uniqueStorage()._mediumMetadata = newValue} + } + /// Returns true if `mediumMetadata` has been explicitly set. + var hasMediumMetadata: Bool {return _storage._mediumMetadata != nil} + /// Clears the value of `mediumMetadata`. Subsequent reads from it will return its default value. + mutating func clearMediumMetadata() {_uniqueStorage()._mediumMetadata = nil} + + var keepAliveIntervalMillis: Int32 { + get {return _storage._keepAliveIntervalMillis ?? 0} + set {_uniqueStorage()._keepAliveIntervalMillis = newValue} + } + /// Returns true if `keepAliveIntervalMillis` has been explicitly set. + var hasKeepAliveIntervalMillis: Bool {return _storage._keepAliveIntervalMillis != nil} + /// Clears the value of `keepAliveIntervalMillis`. Subsequent reads from it will return its default value. + mutating func clearKeepAliveIntervalMillis() {_uniqueStorage()._keepAliveIntervalMillis = nil} + + var keepAliveTimeoutMillis: Int32 { + get {return _storage._keepAliveTimeoutMillis ?? 0} + set {_uniqueStorage()._keepAliveTimeoutMillis = newValue} + } + /// Returns true if `keepAliveTimeoutMillis` has been explicitly set. + var hasKeepAliveTimeoutMillis: Bool {return _storage._keepAliveTimeoutMillis != nil} + /// Clears the value of `keepAliveTimeoutMillis`. Subsequent reads from it will return its default value. + mutating func clearKeepAliveTimeoutMillis() {_uniqueStorage()._keepAliveTimeoutMillis = nil} + + /// The type of {@link Device} object. + var deviceType: Int32 { + get {return _storage._deviceType ?? 0} + set {_uniqueStorage()._deviceType = newValue} + } + /// Returns true if `deviceType` has been explicitly set. + var hasDeviceType: Bool {return _storage._deviceType != nil} + /// Clears the value of `deviceType`. Subsequent reads from it will return its default value. + mutating func clearDeviceType() {_uniqueStorage()._deviceType = nil} + + /// The bytes of serialized {@link Device} object. + var deviceInfo: Data { + get {return _storage._deviceInfo ?? Data()} + set {_uniqueStorage()._deviceInfo = newValue} + } + /// Returns true if `deviceInfo` has been explicitly set. + var hasDeviceInfo: Bool {return _storage._deviceInfo != nil} + /// Clears the value of `deviceInfo`. Subsequent reads from it will return its default value. + mutating func clearDeviceInfo() {_uniqueStorage()._deviceInfo = nil} + + /// Represents the {@link Device} that invokes the request. + var device: OneOf_Device? { + get {return _storage._device} + set {_uniqueStorage()._device = newValue} + } + + var connectionsDevice: Location_Nearby_Connections_ConnectionsDevice { + get { + if case .connectionsDevice(let v)? = _storage._device {return v} + return Location_Nearby_Connections_ConnectionsDevice() + } + set {_uniqueStorage()._device = .connectionsDevice(newValue)} + } + + var presenceDevice: Location_Nearby_Connections_PresenceDevice { + get { + if case .presenceDevice(let v)? = _storage._device {return v} + return Location_Nearby_Connections_PresenceDevice() + } + set {_uniqueStorage()._device = .presenceDevice(newValue)} + } + + var connectionMode: Location_Nearby_Connections_ConnectionRequestFrame.ConnectionMode { + get {return _storage._connectionMode ?? .legacy} + set {_uniqueStorage()._connectionMode = newValue} + } + /// Returns true if `connectionMode` has been explicitly set. + var hasConnectionMode: Bool {return _storage._connectionMode != nil} + /// Clears the value of `connectionMode`. Subsequent reads from it will return its default value. + mutating func clearConnectionMode() {_uniqueStorage()._connectionMode = nil} + + var locationHint: Location_Nearby_Connections_LocationHint { + get {return _storage._locationHint ?? Location_Nearby_Connections_LocationHint()} + set {_uniqueStorage()._locationHint = newValue} + } + /// Returns true if `locationHint` has been explicitly set. + var hasLocationHint: Bool {return _storage._locationHint != nil} + /// Clears the value of `locationHint`. Subsequent reads from it will return its default value. + mutating func clearLocationHint() {_uniqueStorage()._locationHint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Represents the {@link Device} that invokes the request. + enum OneOf_Device: Equatable { + case connectionsDevice(Location_Nearby_Connections_ConnectionsDevice) + case presenceDevice(Location_Nearby_Connections_PresenceDevice) + + #if !swift(>=4.1) + static func ==(lhs: Location_Nearby_Connections_ConnectionRequestFrame.OneOf_Device, rhs: Location_Nearby_Connections_ConnectionRequestFrame.OneOf_Device) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.connectionsDevice, .connectionsDevice): return { + guard case .connectionsDevice(let l) = lhs, case .connectionsDevice(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.presenceDevice, .presenceDevice): return { + guard case .presenceDevice(let l) = lhs, case .presenceDevice(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + /// Should always match cs/symbol:location.nearby.proto.connections.Medium + /// LINT.IfChange + enum Medium: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownMedium // = 0 + case mdns // = 1 + case bluetooth // = 2 + case wifiHotspot // = 3 + case ble // = 4 + case wifiLan // = 5 + case wifiAware // = 6 + case nfc // = 7 + case wifiDirect // = 8 + case webRtc // = 9 + case bleL2Cap // = 10 + case usb // = 11 + case webRtcNonCellular // = 12 + case awdl // = 13 + + init() { + self = .unknownMedium + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownMedium + case 1: self = .mdns + case 2: self = .bluetooth + case 3: self = .wifiHotspot + case 4: self = .ble + case 5: self = .wifiLan + case 6: self = .wifiAware + case 7: self = .nfc + case 8: self = .wifiDirect + case 9: self = .webRtc + case 10: self = .bleL2Cap + case 11: self = .usb + case 12: self = .webRtcNonCellular + case 13: self = .awdl + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownMedium: return 0 + case .mdns: return 1 + case .bluetooth: return 2 + case .wifiHotspot: return 3 + case .ble: return 4 + case .wifiLan: return 5 + case .wifiAware: return 6 + case .nfc: return 7 + case .wifiDirect: return 8 + case .webRtc: return 9 + case .bleL2Cap: return 10 + case .usb: return 11 + case .webRtcNonCellular: return 12 + case .awdl: return 13 + } + } + + } + + /// LINT.IfChange + enum ConnectionMode: SwiftProtobuf.Enum { + typealias RawValue = Int + case legacy // = 0 + case instant // = 1 + + init() { + self = .legacy + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .legacy + case 1: self = .instant + default: return nil + } + } + + var rawValue: Int { + switch self { + case .legacy: return 0 + case .instant: return 1 + } + } + + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_ConnectionRequestFrame.Medium: CaseIterable { + // Support synthesized by the compiler. +} + +extension Location_Nearby_Connections_ConnectionRequestFrame.ConnectionMode: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// This doesn't need to send back endpoint_id and endpoint_name (like +/// the ConnectionRequestFrame does) because those have already been +/// transmitted out-of-band, at the time this endpoint was discovered. +struct Location_Nearby_Connections_ConnectionResponseFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// One of: + /// + /// - ConnectionsStatusCodes.STATUS_OK + /// - ConnectionsStatusCodes.STATUS_CONNECTION_REJECTED. + var status: Int32 { + get {return _status ?? 0} + set {_status = newValue} + } + /// Returns true if `status` has been explicitly set. + var hasStatus: Bool {return self._status != nil} + /// Clears the value of `status`. Subsequent reads from it will return its default value. + mutating func clearStatus() {self._status = nil} + + var handshakeData: Data { + get {return _handshakeData ?? Data()} + set {_handshakeData = newValue} + } + /// Returns true if `handshakeData` has been explicitly set. + var hasHandshakeData: Bool {return self._handshakeData != nil} + /// Clears the value of `handshakeData`. Subsequent reads from it will return its default value. + mutating func clearHandshakeData() {self._handshakeData = nil} + + var response: Location_Nearby_Connections_ConnectionResponseFrame.ResponseStatus { + get {return _response ?? .unknownResponseStatus} + set {_response = newValue} + } + /// Returns true if `response` has been explicitly set. + var hasResponse: Bool {return self._response != nil} + /// Clears the value of `response`. Subsequent reads from it will return its default value. + mutating func clearResponse() {self._response = nil} + + var osInfo: Location_Nearby_Connections_OsInfo { + get {return _osInfo ?? Location_Nearby_Connections_OsInfo()} + set {_osInfo = newValue} + } + /// Returns true if `osInfo` has been explicitly set. + var hasOsInfo: Bool {return self._osInfo != nil} + /// Clears the value of `osInfo`. Subsequent reads from it will return its default value. + mutating func clearOsInfo() {self._osInfo = nil} + + /// A bitmask value to indicate which medium supports Multiplex transmission + /// feature. Each supporting medium could utilize one bit starting from the + /// least significant bit in this field. eq. BT utilizes the LSB bit which 0x01 + /// means bt supports multiplex while 0x00 means not. Refer to ClientProxy.java + /// for the bit usages. + var multiplexSocketBitmask: Int32 { + get {return _multiplexSocketBitmask ?? 0} + set {_multiplexSocketBitmask = newValue} + } + /// Returns true if `multiplexSocketBitmask` has been explicitly set. + var hasMultiplexSocketBitmask: Bool {return self._multiplexSocketBitmask != nil} + /// Clears the value of `multiplexSocketBitmask`. Subsequent reads from it will return its default value. + mutating func clearMultiplexSocketBitmask() {self._multiplexSocketBitmask = nil} + + var nearbyConnectionsVersion: Int32 { + get {return _nearbyConnectionsVersion ?? 0} + set {_nearbyConnectionsVersion = newValue} + } + /// Returns true if `nearbyConnectionsVersion` has been explicitly set. + var hasNearbyConnectionsVersion: Bool {return self._nearbyConnectionsVersion != nil} + /// Clears the value of `nearbyConnectionsVersion`. Subsequent reads from it will return its default value. + mutating func clearNearbyConnectionsVersion() {self._nearbyConnectionsVersion = nil} + + var safeToDisconnectVersion: Int32 { + get {return _safeToDisconnectVersion ?? 0} + set {_safeToDisconnectVersion = newValue} + } + /// Returns true if `safeToDisconnectVersion` has been explicitly set. + var hasSafeToDisconnectVersion: Bool {return self._safeToDisconnectVersion != nil} + /// Clears the value of `safeToDisconnectVersion`. Subsequent reads from it will return its default value. + mutating func clearSafeToDisconnectVersion() {self._safeToDisconnectVersion = nil} + + var locationHint: Location_Nearby_Connections_LocationHint { + get {return _locationHint ?? Location_Nearby_Connections_LocationHint()} + set {_locationHint = newValue} + } + /// Returns true if `locationHint` has been explicitly set. + var hasLocationHint: Bool {return self._locationHint != nil} + /// Clears the value of `locationHint`. Subsequent reads from it will return its default value. + mutating func clearLocationHint() {self._locationHint = nil} + + var keepAliveTimeoutMillis: Int32 { + get {return _keepAliveTimeoutMillis ?? 0} + set {_keepAliveTimeoutMillis = newValue} + } + /// Returns true if `keepAliveTimeoutMillis` has been explicitly set. + var hasKeepAliveTimeoutMillis: Bool {return self._keepAliveTimeoutMillis != nil} + /// Clears the value of `keepAliveTimeoutMillis`. Subsequent reads from it will return its default value. + mutating func clearKeepAliveTimeoutMillis() {self._keepAliveTimeoutMillis = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Used to replace the status integer parameter with a meaningful enum item. + /// Map ConnectionsStatusCodes.STATUS_OK to ACCEPT and + /// ConnectionsStatusCodes.STATUS_CONNECTION_REJECTED to REJECT. + /// Flag: connection_replace_status_with_response_connectionResponseFrame + enum ResponseStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownResponseStatus // = 0 + case accept // = 1 + case reject // = 2 + + init() { + self = .unknownResponseStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownResponseStatus + case 1: self = .accept + case 2: self = .reject + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownResponseStatus: return 0 + case .accept: return 1 + case .reject: return 2 + } + } + + } + + init() {} + + fileprivate var _status: Int32? = nil + fileprivate var _handshakeData: Data? = nil + fileprivate var _response: Location_Nearby_Connections_ConnectionResponseFrame.ResponseStatus? = nil + fileprivate var _osInfo: Location_Nearby_Connections_OsInfo? = nil + fileprivate var _multiplexSocketBitmask: Int32? = nil + fileprivate var _nearbyConnectionsVersion: Int32? = nil + fileprivate var _safeToDisconnectVersion: Int32? = nil + fileprivate var _locationHint: Location_Nearby_Connections_LocationHint? = nil + fileprivate var _keepAliveTimeoutMillis: Int32? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_ConnectionResponseFrame.ResponseStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_PayloadTransferFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var packetType: Location_Nearby_Connections_PayloadTransferFrame.PacketType { + get {return _packetType ?? .unknownPacketType} + set {_packetType = newValue} + } + /// Returns true if `packetType` has been explicitly set. + var hasPacketType: Bool {return self._packetType != nil} + /// Clears the value of `packetType`. Subsequent reads from it will return its default value. + mutating func clearPacketType() {self._packetType = nil} + + var payloadHeader: Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader { + get {return _payloadHeader ?? Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader()} + set {_payloadHeader = newValue} + } + /// Returns true if `payloadHeader` has been explicitly set. + var hasPayloadHeader: Bool {return self._payloadHeader != nil} + /// Clears the value of `payloadHeader`. Subsequent reads from it will return its default value. + mutating func clearPayloadHeader() {self._payloadHeader = nil} + + /// Exactly one of the following fields will be set, depending on the type. + var payloadChunk: Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk { + get {return _payloadChunk ?? Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk()} + set {_payloadChunk = newValue} + } + /// Returns true if `payloadChunk` has been explicitly set. + var hasPayloadChunk: Bool {return self._payloadChunk != nil} + /// Clears the value of `payloadChunk`. Subsequent reads from it will return its default value. + mutating func clearPayloadChunk() {self._payloadChunk = nil} + + var controlMessage: Location_Nearby_Connections_PayloadTransferFrame.ControlMessage { + get {return _controlMessage ?? Location_Nearby_Connections_PayloadTransferFrame.ControlMessage()} + set {_controlMessage = newValue} + } + /// Returns true if `controlMessage` has been explicitly set. + var hasControlMessage: Bool {return self._controlMessage != nil} + /// Clears the value of `controlMessage`. Subsequent reads from it will return its default value. + mutating func clearControlMessage() {self._controlMessage = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum PacketType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownPacketType // = 0 + case data // = 1 + case control // = 2 + case payloadAck // = 3 + + init() { + self = .unknownPacketType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownPacketType + case 1: self = .data + case 2: self = .control + case 3: self = .payloadAck + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownPacketType: return 0 + case .data: return 1 + case .control: return 2 + case .payloadAck: return 3 + } + } + + } + + struct PayloadHeader { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: Int64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var type: Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader.PayloadType { + get {return _type ?? .unknownPayloadType} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var totalSize: Int64 { + get {return _totalSize ?? 0} + set {_totalSize = newValue} + } + /// Returns true if `totalSize` has been explicitly set. + var hasTotalSize: Bool {return self._totalSize != nil} + /// Clears the value of `totalSize`. Subsequent reads from it will return its default value. + mutating func clearTotalSize() {self._totalSize = nil} + + var isSensitive: Bool { + get {return _isSensitive ?? false} + set {_isSensitive = newValue} + } + /// Returns true if `isSensitive` has been explicitly set. + var hasIsSensitive: Bool {return self._isSensitive != nil} + /// Clears the value of `isSensitive`. Subsequent reads from it will return its default value. + mutating func clearIsSensitive() {self._isSensitive = nil} + + var fileName: String { + get {return _fileName ?? String()} + set {_fileName = newValue} + } + /// Returns true if `fileName` has been explicitly set. + var hasFileName: Bool {return self._fileName != nil} + /// Clears the value of `fileName`. Subsequent reads from it will return its default value. + mutating func clearFileName() {self._fileName = nil} + + var parentFolder: String { + get {return _parentFolder ?? String()} + set {_parentFolder = newValue} + } + /// Returns true if `parentFolder` has been explicitly set. + var hasParentFolder: Bool {return self._parentFolder != nil} + /// Clears the value of `parentFolder`. Subsequent reads from it will return its default value. + mutating func clearParentFolder() {self._parentFolder = nil} + + /// Time since the epoch in milliseconds. + var lastModifiedTimestampMillis: Int64 { + get {return _lastModifiedTimestampMillis ?? 0} + set {_lastModifiedTimestampMillis = newValue} + } + /// Returns true if `lastModifiedTimestampMillis` has been explicitly set. + var hasLastModifiedTimestampMillis: Bool {return self._lastModifiedTimestampMillis != nil} + /// Clears the value of `lastModifiedTimestampMillis`. Subsequent reads from it will return its default value. + mutating func clearLastModifiedTimestampMillis() {self._lastModifiedTimestampMillis = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum PayloadType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownPayloadType // = 0 + case bytes // = 1 + case file // = 2 + case stream // = 3 + + init() { + self = .unknownPayloadType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownPayloadType + case 1: self = .bytes + case 2: self = .file + case 3: self = .stream + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownPayloadType: return 0 + case .bytes: return 1 + case .file: return 2 + case .stream: return 3 + } + } + + } + + init() {} + + fileprivate var _id: Int64? = nil + fileprivate var _type: Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader.PayloadType? = nil + fileprivate var _totalSize: Int64? = nil + fileprivate var _isSensitive: Bool? = nil + fileprivate var _fileName: String? = nil + fileprivate var _parentFolder: String? = nil + fileprivate var _lastModifiedTimestampMillis: Int64? = nil + } + + /// Accompanies DATA packets. + struct PayloadChunk { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var flags: Int32 { + get {return _flags ?? 0} + set {_flags = newValue} + } + /// Returns true if `flags` has been explicitly set. + var hasFlags: Bool {return self._flags != nil} + /// Clears the value of `flags`. Subsequent reads from it will return its default value. + mutating func clearFlags() {self._flags = nil} + + var offset: Int64 { + get {return _offset ?? 0} + set {_offset = newValue} + } + /// Returns true if `offset` has been explicitly set. + var hasOffset: Bool {return self._offset != nil} + /// Clears the value of `offset`. Subsequent reads from it will return its default value. + mutating func clearOffset() {self._offset = nil} + + var body: Data { + get {return _body ?? Data()} + set {_body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return self._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {self._body = nil} + + var index: Int32 { + get {return _index ?? 0} + set {_index = newValue} + } + /// Returns true if `index` has been explicitly set. + var hasIndex: Bool {return self._index != nil} + /// Clears the value of `index`. Subsequent reads from it will return its default value. + mutating func clearIndex() {self._index = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Flags: SwiftProtobuf.Enum { + typealias RawValue = Int + case lastChunk // = 1 + + init() { + self = .lastChunk + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .lastChunk + default: return nil + } + } + + var rawValue: Int { + switch self { + case .lastChunk: return 1 + } + } + + } + + init() {} + + fileprivate var _flags: Int32? = nil + fileprivate var _offset: Int64? = nil + fileprivate var _body: Data? = nil + fileprivate var _index: Int32? = nil + } + + /// Accompanies CONTROL packets. + struct ControlMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var event: Location_Nearby_Connections_PayloadTransferFrame.ControlMessage.EventType { + get {return _event ?? .unknownEventType} + set {_event = newValue} + } + /// Returns true if `event` has been explicitly set. + var hasEvent: Bool {return self._event != nil} + /// Clears the value of `event`. Subsequent reads from it will return its default value. + mutating func clearEvent() {self._event = nil} + + var offset: Int64 { + get {return _offset ?? 0} + set {_offset = newValue} + } + /// Returns true if `offset` has been explicitly set. + var hasOffset: Bool {return self._offset != nil} + /// Clears the value of `offset`. Subsequent reads from it will return its default value. + mutating func clearOffset() {self._offset = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum EventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownEventType // = 0 + case payloadError // = 1 + case payloadCanceled // = 2 + + /// Use PacketType.PAYLOAD_ACK instead + case payloadReceivedAck // = 3 + + init() { + self = .unknownEventType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownEventType + case 1: self = .payloadError + case 2: self = .payloadCanceled + case 3: self = .payloadReceivedAck + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownEventType: return 0 + case .payloadError: return 1 + case .payloadCanceled: return 2 + case .payloadReceivedAck: return 3 + } + } + + } + + init() {} + + fileprivate var _event: Location_Nearby_Connections_PayloadTransferFrame.ControlMessage.EventType? = nil + fileprivate var _offset: Int64? = nil + } + + init() {} + + fileprivate var _packetType: Location_Nearby_Connections_PayloadTransferFrame.PacketType? = nil + fileprivate var _payloadHeader: Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader? = nil + fileprivate var _payloadChunk: Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk? = nil + fileprivate var _controlMessage: Location_Nearby_Connections_PayloadTransferFrame.ControlMessage? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_PayloadTransferFrame.PacketType: CaseIterable { + // Support synthesized by the compiler. +} + +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader.PayloadType: CaseIterable { + // Support synthesized by the compiler. +} + +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk.Flags: CaseIterable { + // Support synthesized by the compiler. +} + +extension Location_Nearby_Connections_PayloadTransferFrame.ControlMessage.EventType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var eventType: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.EventType { + get {return _eventType ?? .unknownEventType} + set {_eventType = newValue} + } + /// Returns true if `eventType` has been explicitly set. + var hasEventType: Bool {return self._eventType != nil} + /// Clears the value of `eventType`. Subsequent reads from it will return its default value. + mutating func clearEventType() {self._eventType = nil} + + /// Exactly one of the following fields will be set. + var upgradePathInfo: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo { + get {return _upgradePathInfo ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo()} + set {_upgradePathInfo = newValue} + } + /// Returns true if `upgradePathInfo` has been explicitly set. + var hasUpgradePathInfo: Bool {return self._upgradePathInfo != nil} + /// Clears the value of `upgradePathInfo`. Subsequent reads from it will return its default value. + mutating func clearUpgradePathInfo() {self._upgradePathInfo = nil} + + var clientIntroduction: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroduction { + get {return _clientIntroduction ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroduction()} + set {_clientIntroduction = newValue} + } + /// Returns true if `clientIntroduction` has been explicitly set. + var hasClientIntroduction: Bool {return self._clientIntroduction != nil} + /// Clears the value of `clientIntroduction`. Subsequent reads from it will return its default value. + mutating func clearClientIntroduction() {self._clientIntroduction = nil} + + var clientIntroductionAck: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroductionAck { + get {return _clientIntroductionAck ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroductionAck()} + set {_clientIntroductionAck = newValue} + } + /// Returns true if `clientIntroductionAck` has been explicitly set. + var hasClientIntroductionAck: Bool {return self._clientIntroductionAck != nil} + /// Clears the value of `clientIntroductionAck`. Subsequent reads from it will return its default value. + mutating func clearClientIntroductionAck() {self._clientIntroductionAck = nil} + + var safeToClosePriorChannel: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel { + get {return _safeToClosePriorChannel ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel()} + set {_safeToClosePriorChannel = newValue} + } + /// Returns true if `safeToClosePriorChannel` has been explicitly set. + var hasSafeToClosePriorChannel: Bool {return self._safeToClosePriorChannel != nil} + /// Clears the value of `safeToClosePriorChannel`. Subsequent reads from it will return its default value. + mutating func clearSafeToClosePriorChannel() {self._safeToClosePriorChannel = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum EventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownEventType // = 0 + case upgradePathAvailable // = 1 + case lastWriteToPriorChannel // = 2 + case safeToClosePriorChannel // = 3 + case clientIntroduction // = 4 + case upgradeFailure // = 5 + case clientIntroductionAck // = 6 + + /// The event type that requires the remote device to send the available + /// upgrade path. + case upgradePathRequest // = 7 + + init() { + self = .unknownEventType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownEventType + case 1: self = .upgradePathAvailable + case 2: self = .lastWriteToPriorChannel + case 3: self = .safeToClosePriorChannel + case 4: self = .clientIntroduction + case 5: self = .upgradeFailure + case 6: self = .clientIntroductionAck + case 7: self = .upgradePathRequest + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownEventType: return 0 + case .upgradePathAvailable: return 1 + case .lastWriteToPriorChannel: return 2 + case .safeToClosePriorChannel: return 3 + case .clientIntroduction: return 4 + case .upgradeFailure: return 5 + case .clientIntroductionAck: return 6 + case .upgradePathRequest: return 7 + } + } + + } + + /// Accompanies UPGRADE_PATH_AVAILABLE and UPGRADE_FAILURE events. + struct UpgradePathInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var medium: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.Medium { + get {return _storage._medium ?? .unknownMedium} + set {_uniqueStorage()._medium = newValue} + } + /// Returns true if `medium` has been explicitly set. + var hasMedium: Bool {return _storage._medium != nil} + /// Clears the value of `medium`. Subsequent reads from it will return its default value. + mutating func clearMedium() {_uniqueStorage()._medium = nil} + + /// Exactly one of the following fields will be set. + var wifiHotspotCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiHotspotCredentials { + get {return _storage._wifiHotspotCredentials ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiHotspotCredentials()} + set {_uniqueStorage()._wifiHotspotCredentials = newValue} + } + /// Returns true if `wifiHotspotCredentials` has been explicitly set. + var hasWifiHotspotCredentials: Bool {return _storage._wifiHotspotCredentials != nil} + /// Clears the value of `wifiHotspotCredentials`. Subsequent reads from it will return its default value. + mutating func clearWifiHotspotCredentials() {_uniqueStorage()._wifiHotspotCredentials = nil} + + var wifiLanSocket: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiLanSocket { + get {return _storage._wifiLanSocket ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiLanSocket()} + set {_uniqueStorage()._wifiLanSocket = newValue} + } + /// Returns true if `wifiLanSocket` has been explicitly set. + var hasWifiLanSocket: Bool {return _storage._wifiLanSocket != nil} + /// Clears the value of `wifiLanSocket`. Subsequent reads from it will return its default value. + mutating func clearWifiLanSocket() {_uniqueStorage()._wifiLanSocket = nil} + + var bluetoothCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.BluetoothCredentials { + get {return _storage._bluetoothCredentials ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.BluetoothCredentials()} + set {_uniqueStorage()._bluetoothCredentials = newValue} + } + /// Returns true if `bluetoothCredentials` has been explicitly set. + var hasBluetoothCredentials: Bool {return _storage._bluetoothCredentials != nil} + /// Clears the value of `bluetoothCredentials`. Subsequent reads from it will return its default value. + mutating func clearBluetoothCredentials() {_uniqueStorage()._bluetoothCredentials = nil} + + var wifiAwareCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiAwareCredentials { + get {return _storage._wifiAwareCredentials ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiAwareCredentials()} + set {_uniqueStorage()._wifiAwareCredentials = newValue} + } + /// Returns true if `wifiAwareCredentials` has been explicitly set. + var hasWifiAwareCredentials: Bool {return _storage._wifiAwareCredentials != nil} + /// Clears the value of `wifiAwareCredentials`. Subsequent reads from it will return its default value. + mutating func clearWifiAwareCredentials() {_uniqueStorage()._wifiAwareCredentials = nil} + + var wifiDirectCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiDirectCredentials { + get {return _storage._wifiDirectCredentials ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiDirectCredentials()} + set {_uniqueStorage()._wifiDirectCredentials = newValue} + } + /// Returns true if `wifiDirectCredentials` has been explicitly set. + var hasWifiDirectCredentials: Bool {return _storage._wifiDirectCredentials != nil} + /// Clears the value of `wifiDirectCredentials`. Subsequent reads from it will return its default value. + mutating func clearWifiDirectCredentials() {_uniqueStorage()._wifiDirectCredentials = nil} + + var webRtcCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WebRtcCredentials { + get {return _storage._webRtcCredentials ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WebRtcCredentials()} + set {_uniqueStorage()._webRtcCredentials = newValue} + } + /// Returns true if `webRtcCredentials` has been explicitly set. + var hasWebRtcCredentials: Bool {return _storage._webRtcCredentials != nil} + /// Clears the value of `webRtcCredentials`. Subsequent reads from it will return its default value. + mutating func clearWebRtcCredentials() {_uniqueStorage()._webRtcCredentials = nil} + + var awdlCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.AwdlCredentials { + get {return _storage._awdlCredentials ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.AwdlCredentials()} + set {_uniqueStorage()._awdlCredentials = newValue} + } + /// Returns true if `awdlCredentials` has been explicitly set. + var hasAwdlCredentials: Bool {return _storage._awdlCredentials != nil} + /// Clears the value of `awdlCredentials`. Subsequent reads from it will return its default value. + mutating func clearAwdlCredentials() {_uniqueStorage()._awdlCredentials = nil} + + /// Disable Encryption for this upgrade medium to improve throughput. + var supportsDisablingEncryption: Bool { + get {return _storage._supportsDisablingEncryption ?? false} + set {_uniqueStorage()._supportsDisablingEncryption = newValue} + } + /// Returns true if `supportsDisablingEncryption` has been explicitly set. + var hasSupportsDisablingEncryption: Bool {return _storage._supportsDisablingEncryption != nil} + /// Clears the value of `supportsDisablingEncryption`. Subsequent reads from it will return its default value. + mutating func clearSupportsDisablingEncryption() {_uniqueStorage()._supportsDisablingEncryption = nil} + + /// An ack will be sent after the CLIENT_INTRODUCTION frame. + var supportsClientIntroductionAck: Bool { + get {return _storage._supportsClientIntroductionAck ?? false} + set {_uniqueStorage()._supportsClientIntroductionAck = newValue} + } + /// Returns true if `supportsClientIntroductionAck` has been explicitly set. + var hasSupportsClientIntroductionAck: Bool {return _storage._supportsClientIntroductionAck != nil} + /// Clears the value of `supportsClientIntroductionAck`. Subsequent reads from it will return its default value. + mutating func clearSupportsClientIntroductionAck() {_uniqueStorage()._supportsClientIntroductionAck = nil} + + var upgradePathRequest: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.UpgradePathRequest { + get {return _storage._upgradePathRequest ?? Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.UpgradePathRequest()} + set {_uniqueStorage()._upgradePathRequest = newValue} + } + /// Returns true if `upgradePathRequest` has been explicitly set. + var hasUpgradePathRequest: Bool {return _storage._upgradePathRequest != nil} + /// Clears the value of `upgradePathRequest`. Subsequent reads from it will return its default value. + mutating func clearUpgradePathRequest() {_uniqueStorage()._upgradePathRequest = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Should always match cs/symbol:location.nearby.proto.connections.Medium + enum Medium: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownMedium // = 0 + case mdns // = 1 + case bluetooth // = 2 + case wifiHotspot // = 3 + case ble // = 4 + case wifiLan // = 5 + case wifiAware // = 6 + case nfc // = 7 + case wifiDirect // = 8 + case webRtc // = 9 + + /// 10 is reserved. + case usb // = 11 + case webRtcNonCellular // = 12 + case awdl // = 13 + + init() { + self = .unknownMedium + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownMedium + case 1: self = .mdns + case 2: self = .bluetooth + case 3: self = .wifiHotspot + case 4: self = .ble + case 5: self = .wifiLan + case 6: self = .wifiAware + case 7: self = .nfc + case 8: self = .wifiDirect + case 9: self = .webRtc + case 11: self = .usb + case 12: self = .webRtcNonCellular + case 13: self = .awdl + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownMedium: return 0 + case .mdns: return 1 + case .bluetooth: return 2 + case .wifiHotspot: return 3 + case .ble: return 4 + case .wifiLan: return 5 + case .wifiAware: return 6 + case .nfc: return 7 + case .wifiDirect: return 8 + case .webRtc: return 9 + case .usb: return 11 + case .webRtcNonCellular: return 12 + case .awdl: return 13 + } + } + + } + + /// Accompanies Medium.WIFI_HOTSPOT. + struct WifiHotspotCredentials { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var ssid: String { + get {return _ssid ?? String()} + set {_ssid = newValue} + } + /// Returns true if `ssid` has been explicitly set. + var hasSsid: Bool {return self._ssid != nil} + /// Clears the value of `ssid`. Subsequent reads from it will return its default value. + mutating func clearSsid() {self._ssid = nil} + + var password: String { + get {return _password ?? String()} + set {_password = newValue} + } + /// Returns true if `password` has been explicitly set. + var hasPassword: Bool {return self._password != nil} + /// Clears the value of `password`. Subsequent reads from it will return its default value. + mutating func clearPassword() {self._password = nil} + + var port: Int32 { + get {return _port ?? 0} + set {_port = newValue} + } + /// Returns true if `port` has been explicitly set. + var hasPort: Bool {return self._port != nil} + /// Clears the value of `port`. Subsequent reads from it will return its default value. + mutating func clearPort() {self._port = nil} + + var gateway: String { + get {return _gateway ?? "0.0.0.0"} + set {_gateway = newValue} + } + /// Returns true if `gateway` has been explicitly set. + var hasGateway: Bool {return self._gateway != nil} + /// Clears the value of `gateway`. Subsequent reads from it will return its default value. + mutating func clearGateway() {self._gateway = nil} + + /// This field can be a band or frequency + var frequency: Int32 { + get {return _frequency ?? -1} + set {_frequency = newValue} + } + /// Returns true if `frequency` has been explicitly set. + var hasFrequency: Bool {return self._frequency != nil} + /// Clears the value of `frequency`. Subsequent reads from it will return its default value. + mutating func clearFrequency() {self._frequency = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _ssid: String? = nil + fileprivate var _password: String? = nil + fileprivate var _port: Int32? = nil + fileprivate var _gateway: String? = nil + fileprivate var _frequency: Int32? = nil + } + + /// Accompanies Medium.WIFI_LAN. + struct WifiLanSocket { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var ipAddress: Data { + get {return _ipAddress ?? Data()} + set {_ipAddress = newValue} + } + /// Returns true if `ipAddress` has been explicitly set. + var hasIpAddress: Bool {return self._ipAddress != nil} + /// Clears the value of `ipAddress`. Subsequent reads from it will return its default value. + mutating func clearIpAddress() {self._ipAddress = nil} + + var wifiPort: Int32 { + get {return _wifiPort ?? 0} + set {_wifiPort = newValue} + } + /// Returns true if `wifiPort` has been explicitly set. + var hasWifiPort: Bool {return self._wifiPort != nil} + /// Clears the value of `wifiPort`. Subsequent reads from it will return its default value. + mutating func clearWifiPort() {self._wifiPort = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _ipAddress: Data? = nil + fileprivate var _wifiPort: Int32? = nil + } + + /// Accompanies Medium.BLUETOOTH. + struct BluetoothCredentials { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var serviceName: String { + get {return _serviceName ?? String()} + set {_serviceName = newValue} + } + /// Returns true if `serviceName` has been explicitly set. + var hasServiceName: Bool {return self._serviceName != nil} + /// Clears the value of `serviceName`. Subsequent reads from it will return its default value. + mutating func clearServiceName() {self._serviceName = nil} + + var macAddress: String { + get {return _macAddress ?? String()} + set {_macAddress = newValue} + } + /// Returns true if `macAddress` has been explicitly set. + var hasMacAddress: Bool {return self._macAddress != nil} + /// Clears the value of `macAddress`. Subsequent reads from it will return its default value. + mutating func clearMacAddress() {self._macAddress = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _serviceName: String? = nil + fileprivate var _macAddress: String? = nil + } + + /// Accompanies Medium.WIFI_AWARE. + struct WifiAwareCredentials { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var serviceID: String { + get {return _serviceID ?? String()} + set {_serviceID = newValue} + } + /// Returns true if `serviceID` has been explicitly set. + var hasServiceID: Bool {return self._serviceID != nil} + /// Clears the value of `serviceID`. Subsequent reads from it will return its default value. + mutating func clearServiceID() {self._serviceID = nil} + + var serviceInfo: Data { + get {return _serviceInfo ?? Data()} + set {_serviceInfo = newValue} + } + /// Returns true if `serviceInfo` has been explicitly set. + var hasServiceInfo: Bool {return self._serviceInfo != nil} + /// Clears the value of `serviceInfo`. Subsequent reads from it will return its default value. + mutating func clearServiceInfo() {self._serviceInfo = nil} + + var password: String { + get {return _password ?? String()} + set {_password = newValue} + } + /// Returns true if `password` has been explicitly set. + var hasPassword: Bool {return self._password != nil} + /// Clears the value of `password`. Subsequent reads from it will return its default value. + mutating func clearPassword() {self._password = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _serviceID: String? = nil + fileprivate var _serviceInfo: Data? = nil + fileprivate var _password: String? = nil + } + + /// Accompanies Medium.WIFI_DIRECT. + struct WifiDirectCredentials { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var ssid: String { + get {return _ssid ?? String()} + set {_ssid = newValue} + } + /// Returns true if `ssid` has been explicitly set. + var hasSsid: Bool {return self._ssid != nil} + /// Clears the value of `ssid`. Subsequent reads from it will return its default value. + mutating func clearSsid() {self._ssid = nil} + + var password: String { + get {return _password ?? String()} + set {_password = newValue} + } + /// Returns true if `password` has been explicitly set. + var hasPassword: Bool {return self._password != nil} + /// Clears the value of `password`. Subsequent reads from it will return its default value. + mutating func clearPassword() {self._password = nil} + + var port: Int32 { + get {return _port ?? 0} + set {_port = newValue} + } + /// Returns true if `port` has been explicitly set. + var hasPort: Bool {return self._port != nil} + /// Clears the value of `port`. Subsequent reads from it will return its default value. + mutating func clearPort() {self._port = nil} + + var frequency: Int32 { + get {return _frequency ?? 0} + set {_frequency = newValue} + } + /// Returns true if `frequency` has been explicitly set. + var hasFrequency: Bool {return self._frequency != nil} + /// Clears the value of `frequency`. Subsequent reads from it will return its default value. + mutating func clearFrequency() {self._frequency = nil} + + var gateway: String { + get {return _gateway ?? "0.0.0.0"} + set {_gateway = newValue} + } + /// Returns true if `gateway` has been explicitly set. + var hasGateway: Bool {return self._gateway != nil} + /// Clears the value of `gateway`. Subsequent reads from it will return its default value. + mutating func clearGateway() {self._gateway = nil} + + /// IPv6 link-local address, network order (128bits). + /// The GO should listen on both IPv4 and IPv6 addresses. + /// https://en.wikipedia.org/wiki/Link-local_address#IPv6 + var ipV6Address: Data { + get {return _ipV6Address ?? Data()} + set {_ipV6Address = newValue} + } + /// Returns true if `ipV6Address` has been explicitly set. + var hasIpV6Address: Bool {return self._ipV6Address != nil} + /// Clears the value of `ipV6Address`. Subsequent reads from it will return its default value. + mutating func clearIpV6Address() {self._ipV6Address = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _ssid: String? = nil + fileprivate var _password: String? = nil + fileprivate var _port: Int32? = nil + fileprivate var _frequency: Int32? = nil + fileprivate var _gateway: String? = nil + fileprivate var _ipV6Address: Data? = nil + } + + /// Accompanies Medium.WEB_RTC + struct WebRtcCredentials { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var peerID: String { + get {return _peerID ?? String()} + set {_peerID = newValue} + } + /// Returns true if `peerID` has been explicitly set. + var hasPeerID: Bool {return self._peerID != nil} + /// Clears the value of `peerID`. Subsequent reads from it will return its default value. + mutating func clearPeerID() {self._peerID = nil} + + var locationHint: Location_Nearby_Connections_LocationHint { + get {return _locationHint ?? Location_Nearby_Connections_LocationHint()} + set {_locationHint = newValue} + } + /// Returns true if `locationHint` has been explicitly set. + var hasLocationHint: Bool {return self._locationHint != nil} + /// Clears the value of `locationHint`. Subsequent reads from it will return its default value. + mutating func clearLocationHint() {self._locationHint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _peerID: String? = nil + fileprivate var _locationHint: Location_Nearby_Connections_LocationHint? = nil + } + + /// Accompanies Medium.AWDL. + struct AwdlCredentials { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var serviceName: String { + get {return _serviceName ?? String()} + set {_serviceName = newValue} + } + /// Returns true if `serviceName` has been explicitly set. + var hasServiceName: Bool {return self._serviceName != nil} + /// Clears the value of `serviceName`. Subsequent reads from it will return its default value. + mutating func clearServiceName() {self._serviceName = nil} + + var serviceType: String { + get {return _serviceType ?? String()} + set {_serviceType = newValue} + } + /// Returns true if `serviceType` has been explicitly set. + var hasServiceType: Bool {return self._serviceType != nil} + /// Clears the value of `serviceType`. Subsequent reads from it will return its default value. + mutating func clearServiceType() {self._serviceType = nil} + + var password: String { + get {return _password ?? String()} + set {_password = newValue} + } + /// Returns true if `password` has been explicitly set. + var hasPassword: Bool {return self._password != nil} + /// Clears the value of `password`. Subsequent reads from it will return its default value. + mutating func clearPassword() {self._password = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _serviceName: String? = nil + fileprivate var _serviceType: String? = nil + fileprivate var _password: String? = nil + } + + struct UpgradePathRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Supported mediums on the advertiser device. + var mediums: [Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.Medium] = [] + + var mediumMetaData: Location_Nearby_Connections_MediumMetadata { + get {return _mediumMetaData ?? Location_Nearby_Connections_MediumMetadata()} + set {_mediumMetaData = newValue} + } + /// Returns true if `mediumMetaData` has been explicitly set. + var hasMediumMetaData: Bool {return self._mediumMetaData != nil} + /// Clears the value of `mediumMetaData`. Subsequent reads from it will return its default value. + mutating func clearMediumMetaData() {self._mediumMetaData = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _mediumMetaData: Location_Nearby_Connections_MediumMetadata? = nil + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance + } + + /// Accompanies SAFE_TO_CLOSE_PRIOR_CHANNEL events. + struct SafeToClosePriorChannel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var staFrequency: Int32 { + get {return _staFrequency ?? 0} + set {_staFrequency = newValue} + } + /// Returns true if `staFrequency` has been explicitly set. + var hasStaFrequency: Bool {return self._staFrequency != nil} + /// Clears the value of `staFrequency`. Subsequent reads from it will return its default value. + mutating func clearStaFrequency() {self._staFrequency = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _staFrequency: Int32? = nil + } + + /// Accompanies CLIENT_INTRODUCTION events. + struct ClientIntroduction { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var endpointID: String { + get {return _endpointID ?? String()} + set {_endpointID = newValue} + } + /// Returns true if `endpointID` has been explicitly set. + var hasEndpointID: Bool {return self._endpointID != nil} + /// Clears the value of `endpointID`. Subsequent reads from it will return its default value. + mutating func clearEndpointID() {self._endpointID = nil} + + var supportsDisablingEncryption: Bool { + get {return _supportsDisablingEncryption ?? false} + set {_supportsDisablingEncryption = newValue} + } + /// Returns true if `supportsDisablingEncryption` has been explicitly set. + var hasSupportsDisablingEncryption: Bool {return self._supportsDisablingEncryption != nil} + /// Clears the value of `supportsDisablingEncryption`. Subsequent reads from it will return its default value. + mutating func clearSupportsDisablingEncryption() {self._supportsDisablingEncryption = nil} + + var lastEndpointID: String { + get {return _lastEndpointID ?? String()} + set {_lastEndpointID = newValue} + } + /// Returns true if `lastEndpointID` has been explicitly set. + var hasLastEndpointID: Bool {return self._lastEndpointID != nil} + /// Clears the value of `lastEndpointID`. Subsequent reads from it will return its default value. + mutating func clearLastEndpointID() {self._lastEndpointID = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _endpointID: String? = nil + fileprivate var _supportsDisablingEncryption: Bool? = nil + fileprivate var _lastEndpointID: String? = nil + } + + /// Accompanies CLIENT_INTRODUCTION_ACK events. + struct ClientIntroductionAck { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + init() {} + + fileprivate var _eventType: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.EventType? = nil + fileprivate var _upgradePathInfo: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo? = nil + fileprivate var _clientIntroduction: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroduction? = nil + fileprivate var _clientIntroductionAck: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroductionAck? = nil + fileprivate var _safeToClosePriorChannel: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.EventType: CaseIterable { + // Support synthesized by the compiler. +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.Medium: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_BandwidthUpgradeRetryFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The mediums this device supports upgrading to. This list should be filtered + /// by both the strategy and this device's individual limitations. + var supportedMedium: [Location_Nearby_Connections_BandwidthUpgradeRetryFrame.Medium] = [] + + /// If true, expect the remote endpoint to send back the latest + /// supported_medium. + var isRequest: Bool { + get {return _isRequest ?? false} + set {_isRequest = newValue} + } + /// Returns true if `isRequest` has been explicitly set. + var hasIsRequest: Bool {return self._isRequest != nil} + /// Clears the value of `isRequest`. Subsequent reads from it will return its default value. + mutating func clearIsRequest() {self._isRequest = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Should always match cs/symbol:location.nearby.proto.connections.Medium + /// LINT.IfChange + enum Medium: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownMedium // = 0 + + /// 1 is reserved. + case bluetooth // = 2 + case wifiHotspot // = 3 + case ble // = 4 + case wifiLan // = 5 + case wifiAware // = 6 + case nfc // = 7 + case wifiDirect // = 8 + case webRtc // = 9 + case bleL2Cap // = 10 + case usb // = 11 + case webRtcNonCellular // = 12 + case awdl // = 13 + + init() { + self = .unknownMedium + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownMedium + case 2: self = .bluetooth + case 3: self = .wifiHotspot + case 4: self = .ble + case 5: self = .wifiLan + case 6: self = .wifiAware + case 7: self = .nfc + case 8: self = .wifiDirect + case 9: self = .webRtc + case 10: self = .bleL2Cap + case 11: self = .usb + case 12: self = .webRtcNonCellular + case 13: self = .awdl + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownMedium: return 0 + case .bluetooth: return 2 + case .wifiHotspot: return 3 + case .ble: return 4 + case .wifiLan: return 5 + case .wifiAware: return 6 + case .nfc: return 7 + case .wifiDirect: return 8 + case .webRtc: return 9 + case .bleL2Cap: return 10 + case .usb: return 11 + case .webRtcNonCellular: return 12 + case .awdl: return 13 + } + } + + } + + init() {} + + fileprivate var _isRequest: Bool? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_BandwidthUpgradeRetryFrame.Medium: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_KeepAliveFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// And ack will be sent after receiving KEEP_ALIVE frame. + var ack: Bool { + get {return _ack ?? false} + set {_ack = newValue} + } + /// Returns true if `ack` has been explicitly set. + var hasAck: Bool {return self._ack != nil} + /// Clears the value of `ack`. Subsequent reads from it will return its default value. + mutating func clearAck() {self._ack = nil} + + /// The sequence number + var seqNum: UInt32 { + get {return _seqNum ?? 0} + set {_seqNum = newValue} + } + /// Returns true if `seqNum` has been explicitly set. + var hasSeqNum: Bool {return self._seqNum != nil} + /// Clears the value of `seqNum`. Subsequent reads from it will return its default value. + mutating func clearSeqNum() {self._seqNum = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _ack: Bool? = nil + fileprivate var _seqNum: UInt32? = nil +} + +/// Informs the remote side to immediately severe the socket connection. +/// Used in bandwidth upgrades to get around a race condition, but may be used +/// in other situations to trigger a faster disconnection event than waiting for +/// socket closed on the remote side. +struct Location_Nearby_Connections_DisconnectionFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Apply safe-to-disconnect protocol if true. + var requestSafeToDisconnect: Bool { + get {return _requestSafeToDisconnect ?? false} + set {_requestSafeToDisconnect = newValue} + } + /// Returns true if `requestSafeToDisconnect` has been explicitly set. + var hasRequestSafeToDisconnect: Bool {return self._requestSafeToDisconnect != nil} + /// Clears the value of `requestSafeToDisconnect`. Subsequent reads from it will return its default value. + mutating func clearRequestSafeToDisconnect() {self._requestSafeToDisconnect = nil} + + /// Ack of receiving Disconnection frame will be sent to the sender + /// frame. + var ackSafeToDisconnect: Bool { + get {return _ackSafeToDisconnect ?? false} + set {_ackSafeToDisconnect = newValue} + } + /// Returns true if `ackSafeToDisconnect` has been explicitly set. + var hasAckSafeToDisconnect: Bool {return self._ackSafeToDisconnect != nil} + /// Clears the value of `ackSafeToDisconnect`. Subsequent reads from it will return its default value. + mutating func clearAckSafeToDisconnect() {self._ackSafeToDisconnect = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _requestSafeToDisconnect: Bool? = nil + fileprivate var _ackSafeToDisconnect: Bool? = nil +} + +/// A paired key encryption packet sent between devices, contains signed data. +struct Location_Nearby_Connections_PairedKeyEncryptionFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The encrypted data (raw authentication token for the established + /// connection) in byte array format. + var signedData: Data { + get {return _signedData ?? Data()} + set {_signedData = newValue} + } + /// Returns true if `signedData` has been explicitly set. + var hasSignedData: Bool {return self._signedData != nil} + /// Clears the value of `signedData`. Subsequent reads from it will return its default value. + mutating func clearSignedData() {self._signedData = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _signedData: Data? = nil +} + +/// Nearby Connections authentication frame, contains the bytes format of a +/// DeviceProvider's authentication message. +struct Location_Nearby_Connections_AuthenticationMessageFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// An auth message generated by DeviceProvider. + /// To be sent to the remote device for verification during connection setups. + var authMessage: Data { + get {return _authMessage ?? Data()} + set {_authMessage = newValue} + } + /// Returns true if `authMessage` has been explicitly set. + var hasAuthMessage: Bool {return self._authMessage != nil} + /// Clears the value of `authMessage`. Subsequent reads from it will return its default value. + mutating func clearAuthMessage() {self._authMessage = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _authMessage: Data? = nil +} + +/// Nearby Connections authentication result frame. +struct Location_Nearby_Connections_AuthenticationResultFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The authentication result. Non null if this frame is used to exchange + /// authentication result. + var result: Int32 { + get {return _result ?? 0} + set {_result = newValue} + } + /// Returns true if `result` has been explicitly set. + var hasResult: Bool {return self._result != nil} + /// Clears the value of `result`. Subsequent reads from it will return its default value. + mutating func clearResult() {self._result = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _result: Int32? = nil +} + +struct Location_Nearby_Connections_AutoResumeFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var eventType: Location_Nearby_Connections_AutoResumeFrame.EventType { + get {return _eventType ?? .unknownAutoResumeEventType} + set {_eventType = newValue} + } + /// Returns true if `eventType` has been explicitly set. + var hasEventType: Bool {return self._eventType != nil} + /// Clears the value of `eventType`. Subsequent reads from it will return its default value. + mutating func clearEventType() {self._eventType = nil} + + var pendingPayloadID: Int64 { + get {return _pendingPayloadID ?? 0} + set {_pendingPayloadID = newValue} + } + /// Returns true if `pendingPayloadID` has been explicitly set. + var hasPendingPayloadID: Bool {return self._pendingPayloadID != nil} + /// Clears the value of `pendingPayloadID`. Subsequent reads from it will return its default value. + mutating func clearPendingPayloadID() {self._pendingPayloadID = nil} + + var nextPayloadChunkIndex: Int32 { + get {return _nextPayloadChunkIndex ?? 0} + set {_nextPayloadChunkIndex = newValue} + } + /// Returns true if `nextPayloadChunkIndex` has been explicitly set. + var hasNextPayloadChunkIndex: Bool {return self._nextPayloadChunkIndex != nil} + /// Clears the value of `nextPayloadChunkIndex`. Subsequent reads from it will return its default value. + mutating func clearNextPayloadChunkIndex() {self._nextPayloadChunkIndex = nil} + + var version: Int32 { + get {return _version ?? 0} + set {_version = newValue} + } + /// Returns true if `version` has been explicitly set. + var hasVersion: Bool {return self._version != nil} + /// Clears the value of `version`. Subsequent reads from it will return its default value. + mutating func clearVersion() {self._version = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum EventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownAutoResumeEventType // = 0 + case payloadResumeTransferStart // = 1 + case payloadResumeTransferAck // = 2 + + init() { + self = .unknownAutoResumeEventType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownAutoResumeEventType + case 1: self = .payloadResumeTransferStart + case 2: self = .payloadResumeTransferAck + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownAutoResumeEventType: return 0 + case .payloadResumeTransferStart: return 1 + case .payloadResumeTransferAck: return 2 + } + } + + } + + init() {} + + fileprivate var _eventType: Location_Nearby_Connections_AutoResumeFrame.EventType? = nil + fileprivate var _pendingPayloadID: Int64? = nil + fileprivate var _nextPayloadChunkIndex: Int32? = nil + fileprivate var _version: Int32? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_AutoResumeFrame.EventType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_AutoReconnectFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var endpointID: String { + get {return _endpointID ?? String()} + set {_endpointID = newValue} + } + /// Returns true if `endpointID` has been explicitly set. + var hasEndpointID: Bool {return self._endpointID != nil} + /// Clears the value of `endpointID`. Subsequent reads from it will return its default value. + mutating func clearEndpointID() {self._endpointID = nil} + + var eventType: Location_Nearby_Connections_AutoReconnectFrame.EventType { + get {return _eventType ?? .unknownEventType} + set {_eventType = newValue} + } + /// Returns true if `eventType` has been explicitly set. + var hasEventType: Bool {return self._eventType != nil} + /// Clears the value of `eventType`. Subsequent reads from it will return its default value. + mutating func clearEventType() {self._eventType = nil} + + var lastEndpointID: String { + get {return _lastEndpointID ?? String()} + set {_lastEndpointID = newValue} + } + /// Returns true if `lastEndpointID` has been explicitly set. + var hasLastEndpointID: Bool {return self._lastEndpointID != nil} + /// Clears the value of `lastEndpointID`. Subsequent reads from it will return its default value. + mutating func clearLastEndpointID() {self._lastEndpointID = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum EventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownEventType // = 0 + case clientIntroduction // = 1 + case clientIntroductionAck // = 2 + + init() { + self = .unknownEventType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownEventType + case 1: self = .clientIntroduction + case 2: self = .clientIntroductionAck + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownEventType: return 0 + case .clientIntroduction: return 1 + case .clientIntroductionAck: return 2 + } + } + + } + + init() {} + + fileprivate var _endpointID: String? = nil + fileprivate var _eventType: Location_Nearby_Connections_AutoReconnectFrame.EventType? = nil + fileprivate var _lastEndpointID: String? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_AutoReconnectFrame.EventType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_MediumMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// True if local device supports 5GHz. + var supports5Ghz: Bool { + get {return _storage._supports5Ghz ?? false} + set {_uniqueStorage()._supports5Ghz = newValue} + } + /// Returns true if `supports5Ghz` has been explicitly set. + var hasSupports5Ghz: Bool {return _storage._supports5Ghz != nil} + /// Clears the value of `supports5Ghz`. Subsequent reads from it will return its default value. + mutating func clearSupports5Ghz() {_uniqueStorage()._supports5Ghz = nil} + + /// WiFi LAN BSSID, in the form of a six-byte MAC address: XX:XX:XX:XX:XX:XX + var bssid: String { + get {return _storage._bssid ?? String()} + set {_uniqueStorage()._bssid = newValue} + } + /// Returns true if `bssid` has been explicitly set. + var hasBssid: Bool {return _storage._bssid != nil} + /// Clears the value of `bssid`. Subsequent reads from it will return its default value. + mutating func clearBssid() {_uniqueStorage()._bssid = nil} + + /// IP address, in network byte order: the highest order byte of the address is + /// in byte[0]. + var ipAddress: Data { + get {return _storage._ipAddress ?? Data()} + set {_uniqueStorage()._ipAddress = newValue} + } + /// Returns true if `ipAddress` has been explicitly set. + var hasIpAddress: Bool {return _storage._ipAddress != nil} + /// Clears the value of `ipAddress`. Subsequent reads from it will return its default value. + mutating func clearIpAddress() {_uniqueStorage()._ipAddress = nil} + + /// True if local device supports 6GHz. + var supports6Ghz: Bool { + get {return _storage._supports6Ghz ?? false} + set {_uniqueStorage()._supports6Ghz = newValue} + } + /// Returns true if `supports6Ghz` has been explicitly set. + var hasSupports6Ghz: Bool {return _storage._supports6Ghz != nil} + /// Clears the value of `supports6Ghz`. Subsequent reads from it will return its default value. + mutating func clearSupports6Ghz() {_uniqueStorage()._supports6Ghz = nil} + + /// True if local device has mobile radio. + var mobileRadio: Bool { + get {return _storage._mobileRadio ?? false} + set {_uniqueStorage()._mobileRadio = newValue} + } + /// Returns true if `mobileRadio` has been explicitly set. + var hasMobileRadio: Bool {return _storage._mobileRadio != nil} + /// Clears the value of `mobileRadio`. Subsequent reads from it will return its default value. + mutating func clearMobileRadio() {_uniqueStorage()._mobileRadio = nil} + + /// The frequency of the WiFi LAN AP(in MHz). Or -1 is not associated with an + /// AP over WiFi, -2 represents the active network uses an Ethernet transport. + var apFrequency: Int32 { + get {return _storage._apFrequency ?? -1} + set {_uniqueStorage()._apFrequency = newValue} + } + /// Returns true if `apFrequency` has been explicitly set. + var hasApFrequency: Bool {return _storage._apFrequency != nil} + /// Clears the value of `apFrequency`. Subsequent reads from it will return its default value. + mutating func clearApFrequency() {_uniqueStorage()._apFrequency = nil} + + /// Available channels on the local device. + var availableChannels: Location_Nearby_Connections_AvailableChannels { + get {return _storage._availableChannels ?? Location_Nearby_Connections_AvailableChannels()} + set {_uniqueStorage()._availableChannels = newValue} + } + /// Returns true if `availableChannels` has been explicitly set. + var hasAvailableChannels: Bool {return _storage._availableChannels != nil} + /// Clears the value of `availableChannels`. Subsequent reads from it will return its default value. + mutating func clearAvailableChannels() {_uniqueStorage()._availableChannels = nil} + + /// Usable WiFi Direct client channels on the local device. + var wifiDirectCliUsableChannels: Location_Nearby_Connections_WifiDirectCliUsableChannels { + get {return _storage._wifiDirectCliUsableChannels ?? Location_Nearby_Connections_WifiDirectCliUsableChannels()} + set {_uniqueStorage()._wifiDirectCliUsableChannels = newValue} + } + /// Returns true if `wifiDirectCliUsableChannels` has been explicitly set. + var hasWifiDirectCliUsableChannels: Bool {return _storage._wifiDirectCliUsableChannels != nil} + /// Clears the value of `wifiDirectCliUsableChannels`. Subsequent reads from it will return its default value. + mutating func clearWifiDirectCliUsableChannels() {_uniqueStorage()._wifiDirectCliUsableChannels = nil} + + /// Usable WiFi LAN channels on the local device. + var wifiLanUsableChannels: Location_Nearby_Connections_WifiLanUsableChannels { + get {return _storage._wifiLanUsableChannels ?? Location_Nearby_Connections_WifiLanUsableChannels()} + set {_uniqueStorage()._wifiLanUsableChannels = newValue} + } + /// Returns true if `wifiLanUsableChannels` has been explicitly set. + var hasWifiLanUsableChannels: Bool {return _storage._wifiLanUsableChannels != nil} + /// Clears the value of `wifiLanUsableChannels`. Subsequent reads from it will return its default value. + mutating func clearWifiLanUsableChannels() {_uniqueStorage()._wifiLanUsableChannels = nil} + + /// Usable WiFi Aware channels on the local device. + var wifiAwareUsableChannels: Location_Nearby_Connections_WifiAwareUsableChannels { + get {return _storage._wifiAwareUsableChannels ?? Location_Nearby_Connections_WifiAwareUsableChannels()} + set {_uniqueStorage()._wifiAwareUsableChannels = newValue} + } + /// Returns true if `wifiAwareUsableChannels` has been explicitly set. + var hasWifiAwareUsableChannels: Bool {return _storage._wifiAwareUsableChannels != nil} + /// Clears the value of `wifiAwareUsableChannels`. Subsequent reads from it will return its default value. + mutating func clearWifiAwareUsableChannels() {_uniqueStorage()._wifiAwareUsableChannels = nil} + + /// Usable WiFi Hotspot STA channels on the local device. + var wifiHotspotStaUsableChannels: Location_Nearby_Connections_WifiHotspotStaUsableChannels { + get {return _storage._wifiHotspotStaUsableChannels ?? Location_Nearby_Connections_WifiHotspotStaUsableChannels()} + set {_uniqueStorage()._wifiHotspotStaUsableChannels = newValue} + } + /// Returns true if `wifiHotspotStaUsableChannels` has been explicitly set. + var hasWifiHotspotStaUsableChannels: Bool {return _storage._wifiHotspotStaUsableChannels != nil} + /// Clears the value of `wifiHotspotStaUsableChannels`. Subsequent reads from it will return its default value. + mutating func clearWifiHotspotStaUsableChannels() {_uniqueStorage()._wifiHotspotStaUsableChannels = nil} + + /// The supported medium roles. + var mediumRole: Location_Nearby_Connections_MediumRole { + get {return _storage._mediumRole ?? Location_Nearby_Connections_MediumRole()} + set {_uniqueStorage()._mediumRole = newValue} + } + /// Returns true if `mediumRole` has been explicitly set. + var hasMediumRole: Bool {return _storage._mediumRole != nil} + /// Clears the value of `mediumRole`. Subsequent reads from it will return its default value. + mutating func clearMediumRole() {_uniqueStorage()._mediumRole = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +/// Available channels on the local device. +struct Location_Nearby_Connections_AvailableChannels { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channels: [Int32] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Usable WiFi Direct client channels on the local device. +struct Location_Nearby_Connections_WifiDirectCliUsableChannels { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channels: [Int32] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Usable WiFi LAN channels on the local device. +struct Location_Nearby_Connections_WifiLanUsableChannels { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channels: [Int32] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Usable WiFi Aware channels on the local device. +struct Location_Nearby_Connections_WifiAwareUsableChannels { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channels: [Int32] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Usable WiFi Hotspot STA channels on the local device. +struct Location_Nearby_Connections_WifiHotspotStaUsableChannels { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channels: [Int32] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// The medium roles. +struct Location_Nearby_Connections_MediumRole { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var supportWifiDirectGroupOwner: Bool { + get {return _supportWifiDirectGroupOwner ?? false} + set {_supportWifiDirectGroupOwner = newValue} + } + /// Returns true if `supportWifiDirectGroupOwner` has been explicitly set. + var hasSupportWifiDirectGroupOwner: Bool {return self._supportWifiDirectGroupOwner != nil} + /// Clears the value of `supportWifiDirectGroupOwner`. Subsequent reads from it will return its default value. + mutating func clearSupportWifiDirectGroupOwner() {self._supportWifiDirectGroupOwner = nil} + + var supportWifiDirectGroupClient: Bool { + get {return _supportWifiDirectGroupClient ?? false} + set {_supportWifiDirectGroupClient = newValue} + } + /// Returns true if `supportWifiDirectGroupClient` has been explicitly set. + var hasSupportWifiDirectGroupClient: Bool {return self._supportWifiDirectGroupClient != nil} + /// Clears the value of `supportWifiDirectGroupClient`. Subsequent reads from it will return its default value. + mutating func clearSupportWifiDirectGroupClient() {self._supportWifiDirectGroupClient = nil} + + var supportWifiHotspotHost: Bool { + get {return _supportWifiHotspotHost ?? false} + set {_supportWifiHotspotHost = newValue} + } + /// Returns true if `supportWifiHotspotHost` has been explicitly set. + var hasSupportWifiHotspotHost: Bool {return self._supportWifiHotspotHost != nil} + /// Clears the value of `supportWifiHotspotHost`. Subsequent reads from it will return its default value. + mutating func clearSupportWifiHotspotHost() {self._supportWifiHotspotHost = nil} + + var supportWifiHotspotClient: Bool { + get {return _supportWifiHotspotClient ?? false} + set {_supportWifiHotspotClient = newValue} + } + /// Returns true if `supportWifiHotspotClient` has been explicitly set. + var hasSupportWifiHotspotClient: Bool {return self._supportWifiHotspotClient != nil} + /// Clears the value of `supportWifiHotspotClient`. Subsequent reads from it will return its default value. + mutating func clearSupportWifiHotspotClient() {self._supportWifiHotspotClient = nil} + + var supportWifiAwarePublisher: Bool { + get {return _supportWifiAwarePublisher ?? false} + set {_supportWifiAwarePublisher = newValue} + } + /// Returns true if `supportWifiAwarePublisher` has been explicitly set. + var hasSupportWifiAwarePublisher: Bool {return self._supportWifiAwarePublisher != nil} + /// Clears the value of `supportWifiAwarePublisher`. Subsequent reads from it will return its default value. + mutating func clearSupportWifiAwarePublisher() {self._supportWifiAwarePublisher = nil} + + var supportWifiAwareSubscriber: Bool { + get {return _supportWifiAwareSubscriber ?? false} + set {_supportWifiAwareSubscriber = newValue} + } + /// Returns true if `supportWifiAwareSubscriber` has been explicitly set. + var hasSupportWifiAwareSubscriber: Bool {return self._supportWifiAwareSubscriber != nil} + /// Clears the value of `supportWifiAwareSubscriber`. Subsequent reads from it will return its default value. + mutating func clearSupportWifiAwareSubscriber() {self._supportWifiAwareSubscriber = nil} + + var supportAwdlPublisher: Bool { + get {return _supportAwdlPublisher ?? false} + set {_supportAwdlPublisher = newValue} + } + /// Returns true if `supportAwdlPublisher` has been explicitly set. + var hasSupportAwdlPublisher: Bool {return self._supportAwdlPublisher != nil} + /// Clears the value of `supportAwdlPublisher`. Subsequent reads from it will return its default value. + mutating func clearSupportAwdlPublisher() {self._supportAwdlPublisher = nil} + + var supportAwdlSubscriber: Bool { + get {return _supportAwdlSubscriber ?? false} + set {_supportAwdlSubscriber = newValue} + } + /// Returns true if `supportAwdlSubscriber` has been explicitly set. + var hasSupportAwdlSubscriber: Bool {return self._supportAwdlSubscriber != nil} + /// Clears the value of `supportAwdlSubscriber`. Subsequent reads from it will return its default value. + mutating func clearSupportAwdlSubscriber() {self._supportAwdlSubscriber = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _supportWifiDirectGroupOwner: Bool? = nil + fileprivate var _supportWifiDirectGroupClient: Bool? = nil + fileprivate var _supportWifiHotspotHost: Bool? = nil + fileprivate var _supportWifiHotspotClient: Bool? = nil + fileprivate var _supportWifiAwarePublisher: Bool? = nil + fileprivate var _supportWifiAwareSubscriber: Bool? = nil + fileprivate var _supportAwdlPublisher: Bool? = nil + fileprivate var _supportAwdlSubscriber: Bool? = nil +} + +/// LocationHint is used to specify a location as well as format. +struct Location_Nearby_Connections_LocationHint { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Location is the location, provided in the format specified by format. + var location: String { + get {return _location ?? String()} + set {_location = newValue} + } + /// Returns true if `location` has been explicitly set. + var hasLocation: Bool {return self._location != nil} + /// Clears the value of `location`. Subsequent reads from it will return its default value. + mutating func clearLocation() {self._location = nil} + + /// the format of location. + var format: Location_Nearby_Connections_LocationStandard.Format { + get {return _format ?? .unknown} + set {_format = newValue} + } + /// Returns true if `format` has been explicitly set. + var hasFormat: Bool {return self._format != nil} + /// Clears the value of `format`. Subsequent reads from it will return its default value. + mutating func clearFormat() {self._format = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _location: String? = nil + fileprivate var _format: Location_Nearby_Connections_LocationStandard.Format? = nil +} + +struct Location_Nearby_Connections_LocationStandard { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Format: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + + /// E164 country codes: + /// https://en.wikipedia.org/wiki/List_of_country_calling_codes + /// e.g. +1 for USA + case e164Calling // = 1 + + /// ISO 3166-1 alpha-2 country codes: + /// https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 + case iso31661Alpha2 // = 2 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .e164Calling + case 2: self = .iso31661Alpha2 + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .e164Calling: return 1 + case .iso31661Alpha2: return 2 + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_LocationStandard.Format: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Device capability for OS information. +struct Location_Nearby_Connections_OsInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: Location_Nearby_Connections_OsInfo.OsType { + get {return _type ?? .unknownOsType} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OsType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownOsType // = 0 + case android // = 1 + case chromeOs // = 2 + case windows // = 3 + case apple // = 4 + + /// g3 test environment + case linux // = 100 + + init() { + self = .unknownOsType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownOsType + case 1: self = .android + case 2: self = .chromeOs + case 3: self = .windows + case 4: self = .apple + case 100: self = .linux + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownOsType: return 0 + case .android: return 1 + case .chromeOs: return 2 + case .windows: return 3 + case .apple: return 4 + case .linux: return 100 + } + } + + } + + init() {} + + fileprivate var _type: Location_Nearby_Connections_OsInfo.OsType? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_OsInfo.OsType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Location_Nearby_Connections_ConnectionsDevice { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var endpointID: String { + get {return _endpointID ?? String()} + set {_endpointID = newValue} + } + /// Returns true if `endpointID` has been explicitly set. + var hasEndpointID: Bool {return self._endpointID != nil} + /// Clears the value of `endpointID`. Subsequent reads from it will return its default value. + mutating func clearEndpointID() {self._endpointID = nil} + + var endpointType: Location_Nearby_Connections_EndpointType { + get {return _endpointType ?? .unknownEndpoint} + set {_endpointType = newValue} + } + /// Returns true if `endpointType` has been explicitly set. + var hasEndpointType: Bool {return self._endpointType != nil} + /// Clears the value of `endpointType`. Subsequent reads from it will return its default value. + mutating func clearEndpointType() {self._endpointType = nil} + + /// Data Elements. + var connectivityInfoList: Data { + get {return _connectivityInfoList ?? Data()} + set {_connectivityInfoList = newValue} + } + /// Returns true if `connectivityInfoList` has been explicitly set. + var hasConnectivityInfoList: Bool {return self._connectivityInfoList != nil} + /// Clears the value of `connectivityInfoList`. Subsequent reads from it will return its default value. + mutating func clearConnectivityInfoList() {self._connectivityInfoList = nil} + + var endpointInfo: Data { + get {return _endpointInfo ?? Data()} + set {_endpointInfo = newValue} + } + /// Returns true if `endpointInfo` has been explicitly set. + var hasEndpointInfo: Bool {return self._endpointInfo != nil} + /// Clears the value of `endpointInfo`. Subsequent reads from it will return its default value. + mutating func clearEndpointInfo() {self._endpointInfo = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _endpointID: String? = nil + fileprivate var _endpointType: Location_Nearby_Connections_EndpointType? = nil + fileprivate var _connectivityInfoList: Data? = nil + fileprivate var _endpointInfo: Data? = nil +} + +struct Location_Nearby_Connections_PresenceDevice { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var endpointID: String { + get {return _endpointID ?? String()} + set {_endpointID = newValue} + } + /// Returns true if `endpointID` has been explicitly set. + var hasEndpointID: Bool {return self._endpointID != nil} + /// Clears the value of `endpointID`. Subsequent reads from it will return its default value. + mutating func clearEndpointID() {self._endpointID = nil} + + var endpointType: Location_Nearby_Connections_EndpointType { + get {return _endpointType ?? .unknownEndpoint} + set {_endpointType = newValue} + } + /// Returns true if `endpointType` has been explicitly set. + var hasEndpointType: Bool {return self._endpointType != nil} + /// Clears the value of `endpointType`. Subsequent reads from it will return its default value. + mutating func clearEndpointType() {self._endpointType = nil} + + /// Data Elements. + var connectivityInfoList: Data { + get {return _connectivityInfoList ?? Data()} + set {_connectivityInfoList = newValue} + } + /// Returns true if `connectivityInfoList` has been explicitly set. + var hasConnectivityInfoList: Bool {return self._connectivityInfoList != nil} + /// Clears the value of `connectivityInfoList`. Subsequent reads from it will return its default value. + mutating func clearConnectivityInfoList() {self._connectivityInfoList = nil} + + var deviceID: Int64 { + get {return _deviceID ?? 0} + set {_deviceID = newValue} + } + /// Returns true if `deviceID` has been explicitly set. + var hasDeviceID: Bool {return self._deviceID != nil} + /// Clears the value of `deviceID`. Subsequent reads from it will return its default value. + mutating func clearDeviceID() {self._deviceID = nil} + + var deviceName: String { + get {return _deviceName ?? String()} + set {_deviceName = newValue} + } + /// Returns true if `deviceName` has been explicitly set. + var hasDeviceName: Bool {return self._deviceName != nil} + /// Clears the value of `deviceName`. Subsequent reads from it will return its default value. + mutating func clearDeviceName() {self._deviceName = nil} + + var deviceType: Location_Nearby_Connections_PresenceDevice.DeviceType { + get {return _deviceType ?? .unknown} + set {_deviceType = newValue} + } + /// Returns true if `deviceType` has been explicitly set. + var hasDeviceType: Bool {return self._deviceType != nil} + /// Clears the value of `deviceType`. Subsequent reads from it will return its default value. + mutating func clearDeviceType() {self._deviceType = nil} + + var deviceImageURL: String { + get {return _deviceImageURL ?? String()} + set {_deviceImageURL = newValue} + } + /// Returns true if `deviceImageURL` has been explicitly set. + var hasDeviceImageURL: Bool {return self._deviceImageURL != nil} + /// Clears the value of `deviceImageURL`. Subsequent reads from it will return its default value. + mutating func clearDeviceImageURL() {self._deviceImageURL = nil} + + var discoveryMedium: [Location_Nearby_Connections_ConnectionRequestFrame.Medium] = [] + + var actions: [Int32] = [] + + var identityType: [Int64] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum DeviceType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case phone // = 1 + case tablet // = 2 + case display // = 3 + case laptop // = 4 + case tv // = 5 + case watch // = 6 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .phone + case 2: self = .tablet + case 3: self = .display + case 4: self = .laptop + case 5: self = .tv + case 6: self = .watch + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .phone: return 1 + case .tablet: return 2 + case .display: return 3 + case .laptop: return 4 + case .tv: return 5 + case .watch: return 6 + } + } + + } + + init() {} + + fileprivate var _endpointID: String? = nil + fileprivate var _endpointType: Location_Nearby_Connections_EndpointType? = nil + fileprivate var _connectivityInfoList: Data? = nil + fileprivate var _deviceID: Int64? = nil + fileprivate var _deviceName: String? = nil + fileprivate var _deviceType: Location_Nearby_Connections_PresenceDevice.DeviceType? = nil + fileprivate var _deviceImageURL: String? = nil +} + +#if swift(>=4.2) + +extension Location_Nearby_Connections_PresenceDevice.DeviceType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +#if swift(>=5.5) && canImport(_Concurrency) +extension Location_Nearby_Connections_EndpointType: @unchecked Sendable {} +extension Location_Nearby_Connections_OfflineFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_OfflineFrame.Version: @unchecked Sendable {} +extension Location_Nearby_Connections_V1Frame: @unchecked Sendable {} +extension Location_Nearby_Connections_V1Frame.FrameType: @unchecked Sendable {} +extension Location_Nearby_Connections_ConnectionRequestFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_ConnectionRequestFrame.OneOf_Device: @unchecked Sendable {} +extension Location_Nearby_Connections_ConnectionRequestFrame.Medium: @unchecked Sendable {} +extension Location_Nearby_Connections_ConnectionRequestFrame.ConnectionMode: @unchecked Sendable {} +extension Location_Nearby_Connections_ConnectionResponseFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_ConnectionResponseFrame.ResponseStatus: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame.PacketType: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader.PayloadType: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk.Flags: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame.ControlMessage: @unchecked Sendable {} +extension Location_Nearby_Connections_PayloadTransferFrame.ControlMessage.EventType: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.EventType: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.Medium: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiHotspotCredentials: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiLanSocket: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.BluetoothCredentials: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiAwareCredentials: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiDirectCredentials: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WebRtcCredentials: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.AwdlCredentials: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.UpgradePathRequest: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroduction: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroductionAck: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeRetryFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_BandwidthUpgradeRetryFrame.Medium: @unchecked Sendable {} +extension Location_Nearby_Connections_KeepAliveFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_DisconnectionFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_PairedKeyEncryptionFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_AuthenticationMessageFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_AuthenticationResultFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_AutoResumeFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_AutoResumeFrame.EventType: @unchecked Sendable {} +extension Location_Nearby_Connections_AutoReconnectFrame: @unchecked Sendable {} +extension Location_Nearby_Connections_AutoReconnectFrame.EventType: @unchecked Sendable {} +extension Location_Nearby_Connections_MediumMetadata: @unchecked Sendable {} +extension Location_Nearby_Connections_AvailableChannels: @unchecked Sendable {} +extension Location_Nearby_Connections_WifiDirectCliUsableChannels: @unchecked Sendable {} +extension Location_Nearby_Connections_WifiLanUsableChannels: @unchecked Sendable {} +extension Location_Nearby_Connections_WifiAwareUsableChannels: @unchecked Sendable {} +extension Location_Nearby_Connections_WifiHotspotStaUsableChannels: @unchecked Sendable {} +extension Location_Nearby_Connections_MediumRole: @unchecked Sendable {} +extension Location_Nearby_Connections_LocationHint: @unchecked Sendable {} +extension Location_Nearby_Connections_LocationStandard: @unchecked Sendable {} +extension Location_Nearby_Connections_LocationStandard.Format: @unchecked Sendable {} +extension Location_Nearby_Connections_OsInfo: @unchecked Sendable {} +extension Location_Nearby_Connections_OsInfo.OsType: @unchecked Sendable {} +extension Location_Nearby_Connections_ConnectionsDevice: @unchecked Sendable {} +extension Location_Nearby_Connections_PresenceDevice: @unchecked Sendable {} +extension Location_Nearby_Connections_PresenceDevice.DeviceType: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "location.nearby.connections" + +extension Location_Nearby_Connections_EndpointType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_ENDPOINT"), + 1: .same(proto: "CONNECTIONS_ENDPOINT"), + 2: .same(proto: "PRESENCE_ENDPOINT"), + ] +} + +extension Location_Nearby_Connections_OfflineFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OfflineFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "version"), + 2: .same(proto: "v1"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._version) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._v1) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._version { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._v1 { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_OfflineFrame, rhs: Location_Nearby_Connections_OfflineFrame) -> Bool { + if lhs._version != rhs._version {return false} + if lhs._v1 != rhs._v1 {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_OfflineFrame.Version: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_VERSION"), + 1: .same(proto: "V1"), + ] +} + +extension Location_Nearby_Connections_V1Frame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".V1Frame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .standard(proto: "connection_request"), + 3: .standard(proto: "connection_response"), + 4: .standard(proto: "payload_transfer"), + 5: .standard(proto: "bandwidth_upgrade_negotiation"), + 6: .standard(proto: "keep_alive"), + 7: .same(proto: "disconnection"), + 8: .standard(proto: "paired_key_encryption"), + 9: .standard(proto: "authentication_message"), + 10: .standard(proto: "authentication_result"), + 11: .standard(proto: "auto_resume"), + 12: .standard(proto: "auto_reconnect"), + 13: .standard(proto: "bandwidth_upgrade_retry"), + ] + + fileprivate class _StorageClass { + var _type: Location_Nearby_Connections_V1Frame.FrameType? = nil + var _connectionRequest: Location_Nearby_Connections_ConnectionRequestFrame? = nil + var _connectionResponse: Location_Nearby_Connections_ConnectionResponseFrame? = nil + var _payloadTransfer: Location_Nearby_Connections_PayloadTransferFrame? = nil + var _bandwidthUpgradeNegotiation: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame? = nil + var _keepAlive: Location_Nearby_Connections_KeepAliveFrame? = nil + var _disconnection: Location_Nearby_Connections_DisconnectionFrame? = nil + var _pairedKeyEncryption: Location_Nearby_Connections_PairedKeyEncryptionFrame? = nil + var _authenticationMessage: Location_Nearby_Connections_AuthenticationMessageFrame? = nil + var _authenticationResult: Location_Nearby_Connections_AuthenticationResultFrame? = nil + var _autoResume: Location_Nearby_Connections_AutoResumeFrame? = nil + var _autoReconnect: Location_Nearby_Connections_AutoReconnectFrame? = nil + var _bandwidthUpgradeRetry: Location_Nearby_Connections_BandwidthUpgradeRetryFrame? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _type = source._type + _connectionRequest = source._connectionRequest + _connectionResponse = source._connectionResponse + _payloadTransfer = source._payloadTransfer + _bandwidthUpgradeNegotiation = source._bandwidthUpgradeNegotiation + _keepAlive = source._keepAlive + _disconnection = source._disconnection + _pairedKeyEncryption = source._pairedKeyEncryption + _authenticationMessage = source._authenticationMessage + _authenticationResult = source._authenticationResult + _autoResume = source._autoResume + _autoReconnect = source._autoReconnect + _bandwidthUpgradeRetry = source._bandwidthUpgradeRetry + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &_storage._type) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._connectionRequest) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._connectionResponse) }() + case 4: try { try decoder.decodeSingularMessageField(value: &_storage._payloadTransfer) }() + case 5: try { try decoder.decodeSingularMessageField(value: &_storage._bandwidthUpgradeNegotiation) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._keepAlive) }() + case 7: try { try decoder.decodeSingularMessageField(value: &_storage._disconnection) }() + case 8: try { try decoder.decodeSingularMessageField(value: &_storage._pairedKeyEncryption) }() + case 9: try { try decoder.decodeSingularMessageField(value: &_storage._authenticationMessage) }() + case 10: try { try decoder.decodeSingularMessageField(value: &_storage._authenticationResult) }() + case 11: try { try decoder.decodeSingularMessageField(value: &_storage._autoResume) }() + case 12: try { try decoder.decodeSingularMessageField(value: &_storage._autoReconnect) }() + case 13: try { try decoder.decodeSingularMessageField(value: &_storage._bandwidthUpgradeRetry) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = _storage._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._connectionRequest { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._connectionResponse { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = _storage._payloadTransfer { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try { if let v = _storage._bandwidthUpgradeNegotiation { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } }() + try { if let v = _storage._keepAlive { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._disconnection { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try { if let v = _storage._pairedKeyEncryption { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._authenticationMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() + try { if let v = _storage._authenticationResult { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } }() + try { if let v = _storage._autoResume { + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + } }() + try { if let v = _storage._autoReconnect { + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + } }() + try { if let v = _storage._bandwidthUpgradeRetry { + try visitor.visitSingularMessageField(value: v, fieldNumber: 13) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_V1Frame, rhs: Location_Nearby_Connections_V1Frame) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._type != rhs_storage._type {return false} + if _storage._connectionRequest != rhs_storage._connectionRequest {return false} + if _storage._connectionResponse != rhs_storage._connectionResponse {return false} + if _storage._payloadTransfer != rhs_storage._payloadTransfer {return false} + if _storage._bandwidthUpgradeNegotiation != rhs_storage._bandwidthUpgradeNegotiation {return false} + if _storage._keepAlive != rhs_storage._keepAlive {return false} + if _storage._disconnection != rhs_storage._disconnection {return false} + if _storage._pairedKeyEncryption != rhs_storage._pairedKeyEncryption {return false} + if _storage._authenticationMessage != rhs_storage._authenticationMessage {return false} + if _storage._authenticationResult != rhs_storage._authenticationResult {return false} + if _storage._autoResume != rhs_storage._autoResume {return false} + if _storage._autoReconnect != rhs_storage._autoReconnect {return false} + if _storage._bandwidthUpgradeRetry != rhs_storage._bandwidthUpgradeRetry {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_V1Frame.FrameType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_FRAME_TYPE"), + 1: .same(proto: "CONNECTION_REQUEST"), + 2: .same(proto: "CONNECTION_RESPONSE"), + 3: .same(proto: "PAYLOAD_TRANSFER"), + 4: .same(proto: "BANDWIDTH_UPGRADE_NEGOTIATION"), + 5: .same(proto: "KEEP_ALIVE"), + 6: .same(proto: "DISCONNECTION"), + 7: .same(proto: "PAIRED_KEY_ENCRYPTION"), + 8: .same(proto: "AUTHENTICATION_MESSAGE"), + 9: .same(proto: "AUTHENTICATION_RESULT"), + 10: .same(proto: "AUTO_RESUME"), + 11: .same(proto: "AUTO_RECONNECT"), + 12: .same(proto: "BANDWIDTH_UPGRADE_RETRY"), + ] +} + +extension Location_Nearby_Connections_ConnectionRequestFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConnectionRequestFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "endpoint_id"), + 2: .standard(proto: "endpoint_name"), + 3: .standard(proto: "handshake_data"), + 4: .same(proto: "nonce"), + 5: .same(proto: "mediums"), + 6: .standard(proto: "endpoint_info"), + 7: .standard(proto: "medium_metadata"), + 8: .standard(proto: "keep_alive_interval_millis"), + 9: .standard(proto: "keep_alive_timeout_millis"), + 10: .standard(proto: "device_type"), + 11: .standard(proto: "device_info"), + 12: .standard(proto: "connections_device"), + 13: .standard(proto: "presence_device"), + 14: .standard(proto: "connection_mode"), + 15: .standard(proto: "location_hint"), + ] + + fileprivate class _StorageClass { + var _endpointID: String? = nil + var _endpointName: String? = nil + var _handshakeData: Data? = nil + var _nonce: Int32? = nil + var _mediums: [Location_Nearby_Connections_ConnectionRequestFrame.Medium] = [] + var _endpointInfo: Data? = nil + var _mediumMetadata: Location_Nearby_Connections_MediumMetadata? = nil + var _keepAliveIntervalMillis: Int32? = nil + var _keepAliveTimeoutMillis: Int32? = nil + var _deviceType: Int32? = nil + var _deviceInfo: Data? = nil + var _device: Location_Nearby_Connections_ConnectionRequestFrame.OneOf_Device? + var _connectionMode: Location_Nearby_Connections_ConnectionRequestFrame.ConnectionMode? = nil + var _locationHint: Location_Nearby_Connections_LocationHint? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _endpointID = source._endpointID + _endpointName = source._endpointName + _handshakeData = source._handshakeData + _nonce = source._nonce + _mediums = source._mediums + _endpointInfo = source._endpointInfo + _mediumMetadata = source._mediumMetadata + _keepAliveIntervalMillis = source._keepAliveIntervalMillis + _keepAliveTimeoutMillis = source._keepAliveTimeoutMillis + _deviceType = source._deviceType + _deviceInfo = source._deviceInfo + _device = source._device + _connectionMode = source._connectionMode + _locationHint = source._locationHint + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &_storage._endpointID) }() + case 2: try { try decoder.decodeSingularStringField(value: &_storage._endpointName) }() + case 3: try { try decoder.decodeSingularBytesField(value: &_storage._handshakeData) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &_storage._nonce) }() + case 5: try { try decoder.decodeRepeatedEnumField(value: &_storage._mediums) }() + case 6: try { try decoder.decodeSingularBytesField(value: &_storage._endpointInfo) }() + case 7: try { try decoder.decodeSingularMessageField(value: &_storage._mediumMetadata) }() + case 8: try { try decoder.decodeSingularInt32Field(value: &_storage._keepAliveIntervalMillis) }() + case 9: try { try decoder.decodeSingularInt32Field(value: &_storage._keepAliveTimeoutMillis) }() + case 10: try { try decoder.decodeSingularInt32Field(value: &_storage._deviceType) }() + case 11: try { try decoder.decodeSingularBytesField(value: &_storage._deviceInfo) }() + case 12: try { + var v: Location_Nearby_Connections_ConnectionsDevice? + var hadOneofValue = false + if let current = _storage._device { + hadOneofValue = true + if case .connectionsDevice(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._device = .connectionsDevice(v) + } + }() + case 13: try { + var v: Location_Nearby_Connections_PresenceDevice? + var hadOneofValue = false + if let current = _storage._device { + hadOneofValue = true + if case .presenceDevice(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._device = .presenceDevice(v) + } + }() + case 14: try { try decoder.decodeSingularEnumField(value: &_storage._connectionMode) }() + case 15: try { try decoder.decodeSingularMessageField(value: &_storage._locationHint) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = _storage._endpointID { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._endpointName { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._handshakeData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = _storage._nonce { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 4) + } }() + if !_storage._mediums.isEmpty { + try visitor.visitRepeatedEnumField(value: _storage._mediums, fieldNumber: 5) + } + try { if let v = _storage._endpointInfo { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._mediumMetadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try { if let v = _storage._keepAliveIntervalMillis { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._keepAliveTimeoutMillis { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 9) + } }() + try { if let v = _storage._deviceType { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 10) + } }() + try { if let v = _storage._deviceInfo { + try visitor.visitSingularBytesField(value: v, fieldNumber: 11) + } }() + switch _storage._device { + case .connectionsDevice?: try { + guard case .connectionsDevice(let v)? = _storage._device else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + }() + case .presenceDevice?: try { + guard case .presenceDevice(let v)? = _storage._device else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 13) + }() + case nil: break + } + try { if let v = _storage._connectionMode { + try visitor.visitSingularEnumField(value: v, fieldNumber: 14) + } }() + try { if let v = _storage._locationHint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 15) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_ConnectionRequestFrame, rhs: Location_Nearby_Connections_ConnectionRequestFrame) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._endpointID != rhs_storage._endpointID {return false} + if _storage._endpointName != rhs_storage._endpointName {return false} + if _storage._handshakeData != rhs_storage._handshakeData {return false} + if _storage._nonce != rhs_storage._nonce {return false} + if _storage._mediums != rhs_storage._mediums {return false} + if _storage._endpointInfo != rhs_storage._endpointInfo {return false} + if _storage._mediumMetadata != rhs_storage._mediumMetadata {return false} + if _storage._keepAliveIntervalMillis != rhs_storage._keepAliveIntervalMillis {return false} + if _storage._keepAliveTimeoutMillis != rhs_storage._keepAliveTimeoutMillis {return false} + if _storage._deviceType != rhs_storage._deviceType {return false} + if _storage._deviceInfo != rhs_storage._deviceInfo {return false} + if _storage._device != rhs_storage._device {return false} + if _storage._connectionMode != rhs_storage._connectionMode {return false} + if _storage._locationHint != rhs_storage._locationHint {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_ConnectionRequestFrame.Medium: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_MEDIUM"), + 1: .same(proto: "MDNS"), + 2: .same(proto: "BLUETOOTH"), + 3: .same(proto: "WIFI_HOTSPOT"), + 4: .same(proto: "BLE"), + 5: .same(proto: "WIFI_LAN"), + 6: .same(proto: "WIFI_AWARE"), + 7: .same(proto: "NFC"), + 8: .same(proto: "WIFI_DIRECT"), + 9: .same(proto: "WEB_RTC"), + 10: .same(proto: "BLE_L2CAP"), + 11: .same(proto: "USB"), + 12: .same(proto: "WEB_RTC_NON_CELLULAR"), + 13: .same(proto: "AWDL"), + ] +} + +extension Location_Nearby_Connections_ConnectionRequestFrame.ConnectionMode: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "LEGACY"), + 1: .same(proto: "INSTANT"), + ] +} + +extension Location_Nearby_Connections_ConnectionResponseFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConnectionResponseFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "status"), + 2: .standard(proto: "handshake_data"), + 3: .same(proto: "response"), + 4: .standard(proto: "os_info"), + 5: .standard(proto: "multiplex_socket_bitmask"), + 6: .standard(proto: "nearby_connections_version"), + 7: .standard(proto: "safe_to_disconnect_version"), + 8: .standard(proto: "location_hint"), + 9: .standard(proto: "keep_alive_timeout_millis"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._status) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._handshakeData) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self._response) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._osInfo) }() + case 5: try { try decoder.decodeSingularInt32Field(value: &self._multiplexSocketBitmask) }() + case 6: try { try decoder.decodeSingularInt32Field(value: &self._nearbyConnectionsVersion) }() + case 7: try { try decoder.decodeSingularInt32Field(value: &self._safeToDisconnectVersion) }() + case 8: try { try decoder.decodeSingularMessageField(value: &self._locationHint) }() + case 9: try { try decoder.decodeSingularInt32Field(value: &self._keepAliveTimeoutMillis) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._status { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._handshakeData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try { if let v = self._response { + try visitor.visitSingularEnumField(value: v, fieldNumber: 3) + } }() + try { if let v = self._osInfo { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try { if let v = self._multiplexSocketBitmask { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 5) + } }() + try { if let v = self._nearbyConnectionsVersion { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 6) + } }() + try { if let v = self._safeToDisconnectVersion { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 7) + } }() + try { if let v = self._locationHint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try { if let v = self._keepAliveTimeoutMillis { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 9) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_ConnectionResponseFrame, rhs: Location_Nearby_Connections_ConnectionResponseFrame) -> Bool { + if lhs._status != rhs._status {return false} + if lhs._handshakeData != rhs._handshakeData {return false} + if lhs._response != rhs._response {return false} + if lhs._osInfo != rhs._osInfo {return false} + if lhs._multiplexSocketBitmask != rhs._multiplexSocketBitmask {return false} + if lhs._nearbyConnectionsVersion != rhs._nearbyConnectionsVersion {return false} + if lhs._safeToDisconnectVersion != rhs._safeToDisconnectVersion {return false} + if lhs._locationHint != rhs._locationHint {return false} + if lhs._keepAliveTimeoutMillis != rhs._keepAliveTimeoutMillis {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_ConnectionResponseFrame.ResponseStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_RESPONSE_STATUS"), + 1: .same(proto: "ACCEPT"), + 2: .same(proto: "REJECT"), + ] +} + +extension Location_Nearby_Connections_PayloadTransferFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PayloadTransferFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "packet_type"), + 2: .standard(proto: "payload_header"), + 3: .standard(proto: "payload_chunk"), + 4: .standard(proto: "control_message"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._packetType) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._payloadHeader) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._payloadChunk) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._controlMessage) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._packetType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._payloadHeader { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = self._payloadChunk { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = self._controlMessage { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_PayloadTransferFrame, rhs: Location_Nearby_Connections_PayloadTransferFrame) -> Bool { + if lhs._packetType != rhs._packetType {return false} + if lhs._payloadHeader != rhs._payloadHeader {return false} + if lhs._payloadChunk != rhs._payloadChunk {return false} + if lhs._controlMessage != rhs._controlMessage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_PayloadTransferFrame.PacketType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_PACKET_TYPE"), + 1: .same(proto: "DATA"), + 2: .same(proto: "CONTROL"), + 3: .same(proto: "PAYLOAD_ACK"), + ] +} + +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_PayloadTransferFrame.protoMessageName + ".PayloadHeader" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "type"), + 3: .standard(proto: "total_size"), + 4: .standard(proto: "is_sensitive"), + 5: .standard(proto: "file_name"), + 6: .standard(proto: "parent_folder"), + 7: .standard(proto: "last_modified_timestamp_millis"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt64Field(value: &self._id) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._type) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &self._totalSize) }() + case 4: try { try decoder.decodeSingularBoolField(value: &self._isSensitive) }() + case 5: try { try decoder.decodeSingularStringField(value: &self._fileName) }() + case 6: try { try decoder.decodeSingularStringField(value: &self._parentFolder) }() + case 7: try { try decoder.decodeSingularInt64Field(value: &self._lastModifiedTimestampMillis) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._id { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try { if let v = self._totalSize { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 3) + } }() + try { if let v = self._isSensitive { + try visitor.visitSingularBoolField(value: v, fieldNumber: 4) + } }() + try { if let v = self._fileName { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } }() + try { if let v = self._parentFolder { + try visitor.visitSingularStringField(value: v, fieldNumber: 6) + } }() + try { if let v = self._lastModifiedTimestampMillis { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 7) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader, rhs: Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._type != rhs._type {return false} + if lhs._totalSize != rhs._totalSize {return false} + if lhs._isSensitive != rhs._isSensitive {return false} + if lhs._fileName != rhs._fileName {return false} + if lhs._parentFolder != rhs._parentFolder {return false} + if lhs._lastModifiedTimestampMillis != rhs._lastModifiedTimestampMillis {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadHeader.PayloadType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_PAYLOAD_TYPE"), + 1: .same(proto: "BYTES"), + 2: .same(proto: "FILE"), + 3: .same(proto: "STREAM"), + ] +} + +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_PayloadTransferFrame.protoMessageName + ".PayloadChunk" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "flags"), + 2: .same(proto: "offset"), + 3: .same(proto: "body"), + 4: .same(proto: "index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._flags) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self._offset) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._body) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &self._index) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._flags { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._offset { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 2) + } }() + try { if let v = self._body { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = self._index { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk, rhs: Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk) -> Bool { + if lhs._flags != rhs._flags {return false} + if lhs._offset != rhs._offset {return false} + if lhs._body != rhs._body {return false} + if lhs._index != rhs._index {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_PayloadTransferFrame.PayloadChunk.Flags: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "LAST_CHUNK"), + ] +} + +extension Location_Nearby_Connections_PayloadTransferFrame.ControlMessage: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_PayloadTransferFrame.protoMessageName + ".ControlMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "event"), + 2: .same(proto: "offset"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._event) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self._offset) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._event { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._offset { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_PayloadTransferFrame.ControlMessage, rhs: Location_Nearby_Connections_PayloadTransferFrame.ControlMessage) -> Bool { + if lhs._event != rhs._event {return false} + if lhs._offset != rhs._offset {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_PayloadTransferFrame.ControlMessage.EventType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_EVENT_TYPE"), + 1: .same(proto: "PAYLOAD_ERROR"), + 2: .same(proto: "PAYLOAD_CANCELED"), + 3: .same(proto: "PAYLOAD_RECEIVED_ACK"), + ] +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BandwidthUpgradeNegotiationFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "event_type"), + 2: .standard(proto: "upgrade_path_info"), + 3: .standard(proto: "client_introduction"), + 4: .standard(proto: "client_introduction_ack"), + 5: .standard(proto: "safe_to_close_prior_channel"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._eventType) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._upgradePathInfo) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._clientIntroduction) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._clientIntroductionAck) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._safeToClosePriorChannel) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._eventType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._upgradePathInfo { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = self._clientIntroduction { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = self._clientIntroductionAck { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try { if let v = self._safeToClosePriorChannel { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame) -> Bool { + if lhs._eventType != rhs._eventType {return false} + if lhs._upgradePathInfo != rhs._upgradePathInfo {return false} + if lhs._clientIntroduction != rhs._clientIntroduction {return false} + if lhs._clientIntroductionAck != rhs._clientIntroductionAck {return false} + if lhs._safeToClosePriorChannel != rhs._safeToClosePriorChannel {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.EventType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_EVENT_TYPE"), + 1: .same(proto: "UPGRADE_PATH_AVAILABLE"), + 2: .same(proto: "LAST_WRITE_TO_PRIOR_CHANNEL"), + 3: .same(proto: "SAFE_TO_CLOSE_PRIOR_CHANNEL"), + 4: .same(proto: "CLIENT_INTRODUCTION"), + 5: .same(proto: "UPGRADE_FAILURE"), + 6: .same(proto: "CLIENT_INTRODUCTION_ACK"), + 7: .same(proto: "UPGRADE_PATH_REQUEST"), + ] +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.protoMessageName + ".UpgradePathInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "medium"), + 2: .standard(proto: "wifi_hotspot_credentials"), + 3: .standard(proto: "wifi_lan_socket"), + 4: .standard(proto: "bluetooth_credentials"), + 5: .standard(proto: "wifi_aware_credentials"), + 6: .standard(proto: "wifi_direct_credentials"), + 8: .standard(proto: "web_rtc_credentials"), + 11: .standard(proto: "awdl_credentials"), + 7: .standard(proto: "supports_disabling_encryption"), + 9: .standard(proto: "supports_client_introduction_ack"), + 10: .standard(proto: "upgrade_path_request"), + ] + + fileprivate class _StorageClass { + var _medium: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.Medium? = nil + var _wifiHotspotCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiHotspotCredentials? = nil + var _wifiLanSocket: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiLanSocket? = nil + var _bluetoothCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.BluetoothCredentials? = nil + var _wifiAwareCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiAwareCredentials? = nil + var _wifiDirectCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiDirectCredentials? = nil + var _webRtcCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WebRtcCredentials? = nil + var _awdlCredentials: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.AwdlCredentials? = nil + var _supportsDisablingEncryption: Bool? = nil + var _supportsClientIntroductionAck: Bool? = nil + var _upgradePathRequest: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.UpgradePathRequest? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _medium = source._medium + _wifiHotspotCredentials = source._wifiHotspotCredentials + _wifiLanSocket = source._wifiLanSocket + _bluetoothCredentials = source._bluetoothCredentials + _wifiAwareCredentials = source._wifiAwareCredentials + _wifiDirectCredentials = source._wifiDirectCredentials + _webRtcCredentials = source._webRtcCredentials + _awdlCredentials = source._awdlCredentials + _supportsDisablingEncryption = source._supportsDisablingEncryption + _supportsClientIntroductionAck = source._supportsClientIntroductionAck + _upgradePathRequest = source._upgradePathRequest + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &_storage._medium) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._wifiHotspotCredentials) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._wifiLanSocket) }() + case 4: try { try decoder.decodeSingularMessageField(value: &_storage._bluetoothCredentials) }() + case 5: try { try decoder.decodeSingularMessageField(value: &_storage._wifiAwareCredentials) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._wifiDirectCredentials) }() + case 7: try { try decoder.decodeSingularBoolField(value: &_storage._supportsDisablingEncryption) }() + case 8: try { try decoder.decodeSingularMessageField(value: &_storage._webRtcCredentials) }() + case 9: try { try decoder.decodeSingularBoolField(value: &_storage._supportsClientIntroductionAck) }() + case 10: try { try decoder.decodeSingularMessageField(value: &_storage._upgradePathRequest) }() + case 11: try { try decoder.decodeSingularMessageField(value: &_storage._awdlCredentials) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = _storage._medium { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._wifiHotspotCredentials { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._wifiLanSocket { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = _storage._bluetoothCredentials { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try { if let v = _storage._wifiAwareCredentials { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } }() + try { if let v = _storage._wifiDirectCredentials { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._supportsDisablingEncryption { + try visitor.visitSingularBoolField(value: v, fieldNumber: 7) + } }() + try { if let v = _storage._webRtcCredentials { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._supportsClientIntroductionAck { + try visitor.visitSingularBoolField(value: v, fieldNumber: 9) + } }() + try { if let v = _storage._upgradePathRequest { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } }() + try { if let v = _storage._awdlCredentials { + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._medium != rhs_storage._medium {return false} + if _storage._wifiHotspotCredentials != rhs_storage._wifiHotspotCredentials {return false} + if _storage._wifiLanSocket != rhs_storage._wifiLanSocket {return false} + if _storage._bluetoothCredentials != rhs_storage._bluetoothCredentials {return false} + if _storage._wifiAwareCredentials != rhs_storage._wifiAwareCredentials {return false} + if _storage._wifiDirectCredentials != rhs_storage._wifiDirectCredentials {return false} + if _storage._webRtcCredentials != rhs_storage._webRtcCredentials {return false} + if _storage._awdlCredentials != rhs_storage._awdlCredentials {return false} + if _storage._supportsDisablingEncryption != rhs_storage._supportsDisablingEncryption {return false} + if _storage._supportsClientIntroductionAck != rhs_storage._supportsClientIntroductionAck {return false} + if _storage._upgradePathRequest != rhs_storage._upgradePathRequest {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.Medium: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_MEDIUM"), + 1: .same(proto: "MDNS"), + 2: .same(proto: "BLUETOOTH"), + 3: .same(proto: "WIFI_HOTSPOT"), + 4: .same(proto: "BLE"), + 5: .same(proto: "WIFI_LAN"), + 6: .same(proto: "WIFI_AWARE"), + 7: .same(proto: "NFC"), + 8: .same(proto: "WIFI_DIRECT"), + 9: .same(proto: "WEB_RTC"), + 11: .same(proto: "USB"), + 12: .same(proto: "WEB_RTC_NON_CELLULAR"), + 13: .same(proto: "AWDL"), + ] +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiHotspotCredentials: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".WifiHotspotCredentials" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "ssid"), + 2: .same(proto: "password"), + 3: .same(proto: "port"), + 4: .same(proto: "gateway"), + 5: .same(proto: "frequency"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._ssid) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._password) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self._port) }() + case 4: try { try decoder.decodeSingularStringField(value: &self._gateway) }() + case 5: try { try decoder.decodeSingularInt32Field(value: &self._frequency) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._ssid { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._password { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = self._port { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) + } }() + try { if let v = self._gateway { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } }() + try { if let v = self._frequency { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 5) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiHotspotCredentials, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiHotspotCredentials) -> Bool { + if lhs._ssid != rhs._ssid {return false} + if lhs._password != rhs._password {return false} + if lhs._port != rhs._port {return false} + if lhs._gateway != rhs._gateway {return false} + if lhs._frequency != rhs._frequency {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiLanSocket: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".WifiLanSocket" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "ip_address"), + 2: .standard(proto: "wifi_port"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._ipAddress) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._wifiPort) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._ipAddress { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._wifiPort { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiLanSocket, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiLanSocket) -> Bool { + if lhs._ipAddress != rhs._ipAddress {return false} + if lhs._wifiPort != rhs._wifiPort {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.BluetoothCredentials: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".BluetoothCredentials" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "service_name"), + 2: .standard(proto: "mac_address"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._serviceName) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._macAddress) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._serviceName { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._macAddress { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.BluetoothCredentials, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.BluetoothCredentials) -> Bool { + if lhs._serviceName != rhs._serviceName {return false} + if lhs._macAddress != rhs._macAddress {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiAwareCredentials: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".WifiAwareCredentials" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "service_id"), + 2: .standard(proto: "service_info"), + 3: .same(proto: "password"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._serviceID) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._serviceInfo) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._password) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._serviceID { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._serviceInfo { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try { if let v = self._password { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiAwareCredentials, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiAwareCredentials) -> Bool { + if lhs._serviceID != rhs._serviceID {return false} + if lhs._serviceInfo != rhs._serviceInfo {return false} + if lhs._password != rhs._password {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiDirectCredentials: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".WifiDirectCredentials" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "ssid"), + 2: .same(proto: "password"), + 3: .same(proto: "port"), + 4: .same(proto: "frequency"), + 5: .same(proto: "gateway"), + 6: .standard(proto: "ip_v6_address"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._ssid) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._password) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self._port) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &self._frequency) }() + case 5: try { try decoder.decodeSingularStringField(value: &self._gateway) }() + case 6: try { try decoder.decodeSingularBytesField(value: &self._ipV6Address) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._ssid { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._password { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = self._port { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) + } }() + try { if let v = self._frequency { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 4) + } }() + try { if let v = self._gateway { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } }() + try { if let v = self._ipV6Address { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiDirectCredentials, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WifiDirectCredentials) -> Bool { + if lhs._ssid != rhs._ssid {return false} + if lhs._password != rhs._password {return false} + if lhs._port != rhs._port {return false} + if lhs._frequency != rhs._frequency {return false} + if lhs._gateway != rhs._gateway {return false} + if lhs._ipV6Address != rhs._ipV6Address {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WebRtcCredentials: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".WebRtcCredentials" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "peer_id"), + 2: .standard(proto: "location_hint"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._peerID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._locationHint) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._peerID { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._locationHint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WebRtcCredentials, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.WebRtcCredentials) -> Bool { + if lhs._peerID != rhs._peerID {return false} + if lhs._locationHint != rhs._locationHint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.AwdlCredentials: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".AwdlCredentials" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "service_name"), + 2: .standard(proto: "service_type"), + 3: .same(proto: "password"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._serviceName) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._serviceType) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._password) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._serviceName { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._serviceType { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = self._password { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.AwdlCredentials, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.AwdlCredentials) -> Bool { + if lhs._serviceName != rhs._serviceName {return false} + if lhs._serviceType != rhs._serviceType {return false} + if lhs._password != rhs._password {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.UpgradePathRequest: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.protoMessageName + ".UpgradePathRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "mediums"), + 2: .standard(proto: "medium_meta_data"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedEnumField(value: &self.mediums) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._mediumMetaData) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.mediums.isEmpty { + try visitor.visitPackedEnumField(value: self.mediums, fieldNumber: 1) + } + try { if let v = self._mediumMetaData { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.UpgradePathRequest, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.UpgradePathInfo.UpgradePathRequest) -> Bool { + if lhs.mediums != rhs.mediums {return false} + if lhs._mediumMetaData != rhs._mediumMetaData {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.protoMessageName + ".SafeToClosePriorChannel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "sta_frequency"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._staFrequency) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._staFrequency { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) -> Bool { + if lhs._staFrequency != rhs._staFrequency {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroduction: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.protoMessageName + ".ClientIntroduction" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "endpoint_id"), + 2: .standard(proto: "supports_disabling_encryption"), + 3: .standard(proto: "last_endpoint_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._endpointID) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._supportsDisablingEncryption) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._lastEndpointID) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._endpointID { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._supportsDisablingEncryption { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } }() + try { if let v = self._lastEndpointID { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroduction, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroduction) -> Bool { + if lhs._endpointID != rhs._endpointID {return false} + if lhs._supportsDisablingEncryption != rhs._supportsDisablingEncryption {return false} + if lhs._lastEndpointID != rhs._lastEndpointID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroductionAck: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.protoMessageName + ".ClientIntroductionAck" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroductionAck, rhs: Location_Nearby_Connections_BandwidthUpgradeNegotiationFrame.ClientIntroductionAck) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeRetryFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BandwidthUpgradeRetryFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "supported_medium"), + 2: .standard(proto: "is_request"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedEnumField(value: &self.supportedMedium) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._isRequest) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.supportedMedium.isEmpty { + try visitor.visitRepeatedEnumField(value: self.supportedMedium, fieldNumber: 1) + } + try { if let v = self._isRequest { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_BandwidthUpgradeRetryFrame, rhs: Location_Nearby_Connections_BandwidthUpgradeRetryFrame) -> Bool { + if lhs.supportedMedium != rhs.supportedMedium {return false} + if lhs._isRequest != rhs._isRequest {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_BandwidthUpgradeRetryFrame.Medium: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_MEDIUM"), + 2: .same(proto: "BLUETOOTH"), + 3: .same(proto: "WIFI_HOTSPOT"), + 4: .same(proto: "BLE"), + 5: .same(proto: "WIFI_LAN"), + 6: .same(proto: "WIFI_AWARE"), + 7: .same(proto: "NFC"), + 8: .same(proto: "WIFI_DIRECT"), + 9: .same(proto: "WEB_RTC"), + 10: .same(proto: "BLE_L2CAP"), + 11: .same(proto: "USB"), + 12: .same(proto: "WEB_RTC_NON_CELLULAR"), + 13: .same(proto: "AWDL"), + ] +} + +extension Location_Nearby_Connections_KeepAliveFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".KeepAliveFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "ack"), + 2: .standard(proto: "seq_num"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self._ack) }() + case 2: try { try decoder.decodeSingularUInt32Field(value: &self._seqNum) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._ack { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } }() + try { if let v = self._seqNum { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_KeepAliveFrame, rhs: Location_Nearby_Connections_KeepAliveFrame) -> Bool { + if lhs._ack != rhs._ack {return false} + if lhs._seqNum != rhs._seqNum {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_DisconnectionFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DisconnectionFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "request_safe_to_disconnect"), + 2: .standard(proto: "ack_safe_to_disconnect"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self._requestSafeToDisconnect) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._ackSafeToDisconnect) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._requestSafeToDisconnect { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } }() + try { if let v = self._ackSafeToDisconnect { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_DisconnectionFrame, rhs: Location_Nearby_Connections_DisconnectionFrame) -> Bool { + if lhs._requestSafeToDisconnect != rhs._requestSafeToDisconnect {return false} + if lhs._ackSafeToDisconnect != rhs._ackSafeToDisconnect {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_PairedKeyEncryptionFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PairedKeyEncryptionFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "signed_data"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._signedData) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._signedData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_PairedKeyEncryptionFrame, rhs: Location_Nearby_Connections_PairedKeyEncryptionFrame) -> Bool { + if lhs._signedData != rhs._signedData {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_AuthenticationMessageFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AuthenticationMessageFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "auth_message"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._authMessage) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._authMessage { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_AuthenticationMessageFrame, rhs: Location_Nearby_Connections_AuthenticationMessageFrame) -> Bool { + if lhs._authMessage != rhs._authMessage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_AuthenticationResultFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AuthenticationResultFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "result"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._result) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._result { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_AuthenticationResultFrame, rhs: Location_Nearby_Connections_AuthenticationResultFrame) -> Bool { + if lhs._result != rhs._result {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_AutoResumeFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AutoResumeFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "event_type"), + 2: .standard(proto: "pending_payload_id"), + 3: .standard(proto: "next_payload_chunk_index"), + 4: .same(proto: "version"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._eventType) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self._pendingPayloadID) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self._nextPayloadChunkIndex) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &self._version) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._eventType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._pendingPayloadID { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 2) + } }() + try { if let v = self._nextPayloadChunkIndex { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) + } }() + try { if let v = self._version { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_AutoResumeFrame, rhs: Location_Nearby_Connections_AutoResumeFrame) -> Bool { + if lhs._eventType != rhs._eventType {return false} + if lhs._pendingPayloadID != rhs._pendingPayloadID {return false} + if lhs._nextPayloadChunkIndex != rhs._nextPayloadChunkIndex {return false} + if lhs._version != rhs._version {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_AutoResumeFrame.EventType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_AUTO_RESUME_EVENT_TYPE"), + 1: .same(proto: "PAYLOAD_RESUME_TRANSFER_START"), + 2: .same(proto: "PAYLOAD_RESUME_TRANSFER_ACK"), + ] +} + +extension Location_Nearby_Connections_AutoReconnectFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AutoReconnectFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "endpoint_id"), + 2: .standard(proto: "event_type"), + 3: .standard(proto: "last_endpoint_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._endpointID) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._eventType) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._lastEndpointID) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._endpointID { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._eventType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try { if let v = self._lastEndpointID { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_AutoReconnectFrame, rhs: Location_Nearby_Connections_AutoReconnectFrame) -> Bool { + if lhs._endpointID != rhs._endpointID {return false} + if lhs._eventType != rhs._eventType {return false} + if lhs._lastEndpointID != rhs._lastEndpointID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_AutoReconnectFrame.EventType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_EVENT_TYPE"), + 1: .same(proto: "CLIENT_INTRODUCTION"), + 2: .same(proto: "CLIENT_INTRODUCTION_ACK"), + ] +} + +extension Location_Nearby_Connections_MediumMetadata: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".MediumMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "supports_5_ghz"), + 2: .same(proto: "bssid"), + 3: .standard(proto: "ip_address"), + 4: .standard(proto: "supports_6_ghz"), + 5: .standard(proto: "mobile_radio"), + 6: .standard(proto: "ap_frequency"), + 7: .standard(proto: "available_channels"), + 8: .standard(proto: "wifi_direct_cli_usable_channels"), + 9: .standard(proto: "wifi_lan_usable_channels"), + 10: .standard(proto: "wifi_aware_usable_channels"), + 11: .standard(proto: "wifi_hotspot_sta_usable_channels"), + 12: .standard(proto: "medium_role"), + ] + + fileprivate class _StorageClass { + var _supports5Ghz: Bool? = nil + var _bssid: String? = nil + var _ipAddress: Data? = nil + var _supports6Ghz: Bool? = nil + var _mobileRadio: Bool? = nil + var _apFrequency: Int32? = nil + var _availableChannels: Location_Nearby_Connections_AvailableChannels? = nil + var _wifiDirectCliUsableChannels: Location_Nearby_Connections_WifiDirectCliUsableChannels? = nil + var _wifiLanUsableChannels: Location_Nearby_Connections_WifiLanUsableChannels? = nil + var _wifiAwareUsableChannels: Location_Nearby_Connections_WifiAwareUsableChannels? = nil + var _wifiHotspotStaUsableChannels: Location_Nearby_Connections_WifiHotspotStaUsableChannels? = nil + var _mediumRole: Location_Nearby_Connections_MediumRole? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _supports5Ghz = source._supports5Ghz + _bssid = source._bssid + _ipAddress = source._ipAddress + _supports6Ghz = source._supports6Ghz + _mobileRadio = source._mobileRadio + _apFrequency = source._apFrequency + _availableChannels = source._availableChannels + _wifiDirectCliUsableChannels = source._wifiDirectCliUsableChannels + _wifiLanUsableChannels = source._wifiLanUsableChannels + _wifiAwareUsableChannels = source._wifiAwareUsableChannels + _wifiHotspotStaUsableChannels = source._wifiHotspotStaUsableChannels + _mediumRole = source._mediumRole + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &_storage._supports5Ghz) }() + case 2: try { try decoder.decodeSingularStringField(value: &_storage._bssid) }() + case 3: try { try decoder.decodeSingularBytesField(value: &_storage._ipAddress) }() + case 4: try { try decoder.decodeSingularBoolField(value: &_storage._supports6Ghz) }() + case 5: try { try decoder.decodeSingularBoolField(value: &_storage._mobileRadio) }() + case 6: try { try decoder.decodeSingularInt32Field(value: &_storage._apFrequency) }() + case 7: try { try decoder.decodeSingularMessageField(value: &_storage._availableChannels) }() + case 8: try { try decoder.decodeSingularMessageField(value: &_storage._wifiDirectCliUsableChannels) }() + case 9: try { try decoder.decodeSingularMessageField(value: &_storage._wifiLanUsableChannels) }() + case 10: try { try decoder.decodeSingularMessageField(value: &_storage._wifiAwareUsableChannels) }() + case 11: try { try decoder.decodeSingularMessageField(value: &_storage._wifiHotspotStaUsableChannels) }() + case 12: try { try decoder.decodeSingularMessageField(value: &_storage._mediumRole) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = _storage._supports5Ghz { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._bssid { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._ipAddress { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = _storage._supports6Ghz { + try visitor.visitSingularBoolField(value: v, fieldNumber: 4) + } }() + try { if let v = _storage._mobileRadio { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } }() + try { if let v = _storage._apFrequency { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._availableChannels { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try { if let v = _storage._wifiDirectCliUsableChannels { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._wifiLanUsableChannels { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() + try { if let v = _storage._wifiAwareUsableChannels { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } }() + try { if let v = _storage._wifiHotspotStaUsableChannels { + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + } }() + try { if let v = _storage._mediumRole { + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_MediumMetadata, rhs: Location_Nearby_Connections_MediumMetadata) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._supports5Ghz != rhs_storage._supports5Ghz {return false} + if _storage._bssid != rhs_storage._bssid {return false} + if _storage._ipAddress != rhs_storage._ipAddress {return false} + if _storage._supports6Ghz != rhs_storage._supports6Ghz {return false} + if _storage._mobileRadio != rhs_storage._mobileRadio {return false} + if _storage._apFrequency != rhs_storage._apFrequency {return false} + if _storage._availableChannels != rhs_storage._availableChannels {return false} + if _storage._wifiDirectCliUsableChannels != rhs_storage._wifiDirectCliUsableChannels {return false} + if _storage._wifiLanUsableChannels != rhs_storage._wifiLanUsableChannels {return false} + if _storage._wifiAwareUsableChannels != rhs_storage._wifiAwareUsableChannels {return false} + if _storage._wifiHotspotStaUsableChannels != rhs_storage._wifiHotspotStaUsableChannels {return false} + if _storage._mediumRole != rhs_storage._mediumRole {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_AvailableChannels: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AvailableChannels" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.channels) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channels.isEmpty { + try visitor.visitPackedInt32Field(value: self.channels, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_AvailableChannels, rhs: Location_Nearby_Connections_AvailableChannels) -> Bool { + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_WifiDirectCliUsableChannels: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WifiDirectCliUsableChannels" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.channels) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channels.isEmpty { + try visitor.visitPackedInt32Field(value: self.channels, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_WifiDirectCliUsableChannels, rhs: Location_Nearby_Connections_WifiDirectCliUsableChannels) -> Bool { + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_WifiLanUsableChannels: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WifiLanUsableChannels" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.channels) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channels.isEmpty { + try visitor.visitPackedInt32Field(value: self.channels, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_WifiLanUsableChannels, rhs: Location_Nearby_Connections_WifiLanUsableChannels) -> Bool { + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_WifiAwareUsableChannels: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WifiAwareUsableChannels" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.channels) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channels.isEmpty { + try visitor.visitPackedInt32Field(value: self.channels, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_WifiAwareUsableChannels, rhs: Location_Nearby_Connections_WifiAwareUsableChannels) -> Bool { + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_WifiHotspotStaUsableChannels: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WifiHotspotStaUsableChannels" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.channels) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channels.isEmpty { + try visitor.visitPackedInt32Field(value: self.channels, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_WifiHotspotStaUsableChannels, rhs: Location_Nearby_Connections_WifiHotspotStaUsableChannels) -> Bool { + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_MediumRole: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".MediumRole" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "support_wifi_direct_group_owner"), + 2: .standard(proto: "support_wifi_direct_group_client"), + 3: .standard(proto: "support_wifi_hotspot_host"), + 4: .standard(proto: "support_wifi_hotspot_client"), + 5: .standard(proto: "support_wifi_aware_publisher"), + 6: .standard(proto: "support_wifi_aware_subscriber"), + 7: .standard(proto: "support_awdl_publisher"), + 8: .standard(proto: "support_awdl_subscriber"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self._supportWifiDirectGroupOwner) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._supportWifiDirectGroupClient) }() + case 3: try { try decoder.decodeSingularBoolField(value: &self._supportWifiHotspotHost) }() + case 4: try { try decoder.decodeSingularBoolField(value: &self._supportWifiHotspotClient) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self._supportWifiAwarePublisher) }() + case 6: try { try decoder.decodeSingularBoolField(value: &self._supportWifiAwareSubscriber) }() + case 7: try { try decoder.decodeSingularBoolField(value: &self._supportAwdlPublisher) }() + case 8: try { try decoder.decodeSingularBoolField(value: &self._supportAwdlSubscriber) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._supportWifiDirectGroupOwner { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } }() + try { if let v = self._supportWifiDirectGroupClient { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } }() + try { if let v = self._supportWifiHotspotHost { + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + } }() + try { if let v = self._supportWifiHotspotClient { + try visitor.visitSingularBoolField(value: v, fieldNumber: 4) + } }() + try { if let v = self._supportWifiAwarePublisher { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } }() + try { if let v = self._supportWifiAwareSubscriber { + try visitor.visitSingularBoolField(value: v, fieldNumber: 6) + } }() + try { if let v = self._supportAwdlPublisher { + try visitor.visitSingularBoolField(value: v, fieldNumber: 7) + } }() + try { if let v = self._supportAwdlSubscriber { + try visitor.visitSingularBoolField(value: v, fieldNumber: 8) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_MediumRole, rhs: Location_Nearby_Connections_MediumRole) -> Bool { + if lhs._supportWifiDirectGroupOwner != rhs._supportWifiDirectGroupOwner {return false} + if lhs._supportWifiDirectGroupClient != rhs._supportWifiDirectGroupClient {return false} + if lhs._supportWifiHotspotHost != rhs._supportWifiHotspotHost {return false} + if lhs._supportWifiHotspotClient != rhs._supportWifiHotspotClient {return false} + if lhs._supportWifiAwarePublisher != rhs._supportWifiAwarePublisher {return false} + if lhs._supportWifiAwareSubscriber != rhs._supportWifiAwareSubscriber {return false} + if lhs._supportAwdlPublisher != rhs._supportAwdlPublisher {return false} + if lhs._supportAwdlSubscriber != rhs._supportAwdlSubscriber {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_LocationHint: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LocationHint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "location"), + 2: .same(proto: "format"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._location) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._format) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._location { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._format { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_LocationHint, rhs: Location_Nearby_Connections_LocationHint) -> Bool { + if lhs._location != rhs._location {return false} + if lhs._format != rhs._format {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_LocationStandard: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LocationStandard" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_LocationStandard, rhs: Location_Nearby_Connections_LocationStandard) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_LocationStandard.Format: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "E164_CALLING"), + 2: .same(proto: "ISO_3166_1_ALPHA_2"), + ] +} + +extension Location_Nearby_Connections_OsInfo: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OsInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._type) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_OsInfo, rhs: Location_Nearby_Connections_OsInfo) -> Bool { + if lhs._type != rhs._type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_OsInfo.OsType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_OS_TYPE"), + 1: .same(proto: "ANDROID"), + 2: .same(proto: "CHROME_OS"), + 3: .same(proto: "WINDOWS"), + 4: .same(proto: "APPLE"), + 100: .same(proto: "LINUX"), + ] +} + +extension Location_Nearby_Connections_ConnectionsDevice: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConnectionsDevice" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "endpoint_id"), + 2: .standard(proto: "endpoint_type"), + 3: .standard(proto: "connectivity_info_list"), + 4: .standard(proto: "endpoint_info"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._endpointID) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._endpointType) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._connectivityInfoList) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self._endpointInfo) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._endpointID { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._endpointType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try { if let v = self._connectivityInfoList { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = self._endpointInfo { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_ConnectionsDevice, rhs: Location_Nearby_Connections_ConnectionsDevice) -> Bool { + if lhs._endpointID != rhs._endpointID {return false} + if lhs._endpointType != rhs._endpointType {return false} + if lhs._connectivityInfoList != rhs._connectivityInfoList {return false} + if lhs._endpointInfo != rhs._endpointInfo {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_PresenceDevice: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PresenceDevice" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "endpoint_id"), + 2: .standard(proto: "endpoint_type"), + 3: .standard(proto: "connectivity_info_list"), + 4: .standard(proto: "device_id"), + 5: .standard(proto: "device_name"), + 6: .standard(proto: "device_type"), + 7: .standard(proto: "device_image_url"), + 8: .standard(proto: "discovery_medium"), + 9: .same(proto: "actions"), + 10: .standard(proto: "identity_type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._endpointID) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._endpointType) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._connectivityInfoList) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self._deviceID) }() + case 5: try { try decoder.decodeSingularStringField(value: &self._deviceName) }() + case 6: try { try decoder.decodeSingularEnumField(value: &self._deviceType) }() + case 7: try { try decoder.decodeSingularStringField(value: &self._deviceImageURL) }() + case 8: try { try decoder.decodeRepeatedEnumField(value: &self.discoveryMedium) }() + case 9: try { try decoder.decodeRepeatedInt32Field(value: &self.actions) }() + case 10: try { try decoder.decodeRepeatedInt64Field(value: &self.identityType) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._endpointID { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._endpointType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try { if let v = self._connectivityInfoList { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = self._deviceID { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 4) + } }() + try { if let v = self._deviceName { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } }() + try { if let v = self._deviceType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 6) + } }() + try { if let v = self._deviceImageURL { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } }() + if !self.discoveryMedium.isEmpty { + try visitor.visitPackedEnumField(value: self.discoveryMedium, fieldNumber: 8) + } + if !self.actions.isEmpty { + try visitor.visitPackedInt32Field(value: self.actions, fieldNumber: 9) + } + if !self.identityType.isEmpty { + try visitor.visitPackedInt64Field(value: self.identityType, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location_Nearby_Connections_PresenceDevice, rhs: Location_Nearby_Connections_PresenceDevice) -> Bool { + if lhs._endpointID != rhs._endpointID {return false} + if lhs._endpointType != rhs._endpointType {return false} + if lhs._connectivityInfoList != rhs._connectivityInfoList {return false} + if lhs._deviceID != rhs._deviceID {return false} + if lhs._deviceName != rhs._deviceName {return false} + if lhs._deviceType != rhs._deviceType {return false} + if lhs._deviceImageURL != rhs._deviceImageURL {return false} + if lhs.discoveryMedium != rhs.discoveryMedium {return false} + if lhs.actions != rhs.actions {return false} + if lhs.identityType != rhs.identityType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location_Nearby_Connections_PresenceDevice.DeviceType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "PHONE"), + 2: .same(proto: "TABLET"), + 3: .same(proto: "DISPLAY"), + 4: .same(proto: "LAPTOP"), + 5: .same(proto: "TV"), + 6: .same(proto: "WATCH"), + ] +} diff --git a/airsync-mac/Core/QuickShare/Protobuf/securegcm.pb.swift b/airsync-mac/Core/QuickShare/Protobuf/securegcm.pb.swift new file mode 100644 index 00000000..0169b877 --- /dev/null +++ b/airsync-mac/Core/QuickShare/Protobuf/securegcm.pb.swift @@ -0,0 +1,1522 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: securegcm.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +@preconcurrency import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// This enum is used by iOS devices as values for device_display_diagonal_mils +/// in GcmDeviceInfo. There is no good way to calculate it on those devices. +enum Securegcm_AppleDeviceDiagonalMils: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// This is the mils diagonal on an iPhone 5. + case applePhone // = 4000 + + /// This is the mils diagonal on an iPad mini. + case applePad // = 7900 + + init() { + self = .applePhone + } + + init?(rawValue: Int) { + switch rawValue { + case 4000: self = .applePhone + case 7900: self = .applePad + default: return nil + } + } + + var rawValue: Int { + switch self { + case .applePhone: return 4000 + case .applePad: return 7900 + } + } + +} + +#if swift(>=4.2) + +extension Securegcm_AppleDeviceDiagonalMils: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// This should be kept in sync with DeviceType in: +/// java/com/google/security/cryptauth/backend/services/common/common_enums.proto +enum Securegcm_DeviceType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case android // = 1 + case chrome // = 2 + case ios // = 3 + case browser // = 4 + case osx // = 5 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .android + case 2: self = .chrome + case 3: self = .ios + case 4: self = .browser + case 5: self = .osx + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .android: return 1 + case .chrome: return 2 + case .ios: return 3 + case .browser: return 4 + case .osx: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Securegcm_DeviceType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// MultiDevice features which may be supported and enabled on a device. See +enum Securegcm_SoftwareFeature: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownFeature // = 0 + case betterTogetherHost // = 1 + case betterTogetherClient // = 2 + case easyUnlockHost // = 3 + case easyUnlockClient // = 4 + case magicTetherHost // = 5 + case magicTetherClient // = 6 + case smsConnectHost // = 7 + case smsConnectClient // = 8 + + init() { + self = .unknownFeature + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownFeature + case 1: self = .betterTogetherHost + case 2: self = .betterTogetherClient + case 3: self = .easyUnlockHost + case 4: self = .easyUnlockClient + case 5: self = .magicTetherHost + case 6: self = .magicTetherClient + case 7: self = .smsConnectHost + case 8: self = .smsConnectClient + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownFeature: return 0 + case .betterTogetherHost: return 1 + case .betterTogetherClient: return 2 + case .easyUnlockHost: return 3 + case .easyUnlockClient: return 4 + case .magicTetherHost: return 5 + case .magicTetherClient: return 6 + case .smsConnectHost: return 7 + case .smsConnectClient: return 8 + } + } + +} + +#if swift(>=4.2) + +extension Securegcm_SoftwareFeature: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// A list of "reasons" that can be provided for calling server-side APIs. +/// This is particularly important for calls that can be triggered by different +/// kinds of events. Please try to keep reasons as generic as possible, so that +/// codes can be re-used by various callers in a sensible fashion. +enum Securegcm_InvocationReason: SwiftProtobuf.Enum { + typealias RawValue = Int + case reasonUnknown // = 0 + + /// First run of the software package invoking this call + case reasonInitialization // = 1 + + /// Ordinary periodic actions (e.g. monthly master key rotation) + case reasonPeriodic // = 2 + + /// Slow-cycle periodic action (e.g. yearly keypair rotation???) + case reasonSlowPeriodic // = 3 + + /// Fast-cycle periodic action (e.g. daily sync for Smart Lock users) + case reasonFastPeriodic // = 4 + + /// Expired state (e.g. expired credentials, or cached entries) was detected + case reasonExpiration // = 5 + + /// An unexpected protocol failure occurred (so attempting to repair state) + case reasonFailureRecovery // = 6 + + /// A new account has been added to the device + case reasonNewAccount // = 7 + + /// An existing account on the device has been changed + case reasonChangedAccount // = 8 + + /// The user toggled the state of a feature (e.g. Smart Lock enabled via BT) + case reasonFeatureToggled // = 9 + + /// A "push" from the server caused this action (e.g. a sync tickle) + case reasonServerInitiated // = 10 + + /// A local address change triggered this (e.g. GCM registration id changed) + case reasonAddressChange // = 11 + + /// A software update has triggered this + case reasonSoftwareUpdate // = 12 + + /// A manual action by the user triggered this (e.g. commands sent via adb) + case reasonManual // = 13 + + /// A custom key has been invalidated on the device (e.g. screen lock is + /// disabled). + case reasonCustomKeyInvalidation // = 14 + + /// Periodic action triggered by auth_proximity + case reasonProximityPeriodic // = 15 + + init() { + self = .reasonUnknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .reasonUnknown + case 1: self = .reasonInitialization + case 2: self = .reasonPeriodic + case 3: self = .reasonSlowPeriodic + case 4: self = .reasonFastPeriodic + case 5: self = .reasonExpiration + case 6: self = .reasonFailureRecovery + case 7: self = .reasonNewAccount + case 8: self = .reasonChangedAccount + case 9: self = .reasonFeatureToggled + case 10: self = .reasonServerInitiated + case 11: self = .reasonAddressChange + case 12: self = .reasonSoftwareUpdate + case 13: self = .reasonManual + case 14: self = .reasonCustomKeyInvalidation + case 15: self = .reasonProximityPeriodic + default: return nil + } + } + + var rawValue: Int { + switch self { + case .reasonUnknown: return 0 + case .reasonInitialization: return 1 + case .reasonPeriodic: return 2 + case .reasonSlowPeriodic: return 3 + case .reasonFastPeriodic: return 4 + case .reasonExpiration: return 5 + case .reasonFailureRecovery: return 6 + case .reasonNewAccount: return 7 + case .reasonChangedAccount: return 8 + case .reasonFeatureToggled: return 9 + case .reasonServerInitiated: return 10 + case .reasonAddressChange: return 11 + case .reasonSoftwareUpdate: return 12 + case .reasonManual: return 13 + case .reasonCustomKeyInvalidation: return 14 + case .reasonProximityPeriodic: return 15 + } + } + +} + +#if swift(>=4.2) + +extension Securegcm_InvocationReason: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Securegcm_Type: SwiftProtobuf.Enum { + typealias RawValue = Int + case enrollment // = 0 + case tickle // = 1 + case txRequest // = 2 + case txReply // = 3 + case txSyncRequest // = 4 + case txSyncResponse // = 5 + case txPing // = 6 + case deviceInfoUpdate // = 7 + case txCancelRequest // = 8 + + /// DEPRECATED (can be re-used after Aug 2015) + case proximityauthPairing // = 10 + + /// The kind of identity assertion generated by a "GCM V1" device (i.e., + /// an Android phone that has registered with us a public and a symmetric + /// key) + case gcmv1IdentityAssertion // = 11 + + /// Device-to-device communications are protected by an unauthenticated + /// Diffie-Hellman exchange. The InitiatorHello message is simply the + /// initiator's public DH key, and is not encoded as a SecureMessage, so + /// it doesn't have a tag. + /// The ResponderHello message (which is sent by the responder + /// to the initiator), on the other hand, carries a payload that is protected + /// by the derived shared key. It also contains the responder's + /// public DH key. ResponderHelloAndPayload messages have the + /// DEVICE_TO_DEVICE_RESPONDER_HELLO tag. + case deviceToDeviceResponderHelloPayload // = 12 + + /// Device-to-device communications are protected by an unauthenticated + /// Diffie-Hellman exchange. Once the initiator and responder + /// agree on a shared key (through Diffie-Hellman), they will use messages + /// tagged with DEVICE_TO_DEVICE_MESSAGE to exchange data. + case deviceToDeviceMessage // = 13 + + /// Notification to let a device know it should contact a nearby device. + case deviceProximityCallback // = 14 + + /// Device-to-device communications are protected by an unauthenticated + /// Diffie-Hellman exchange. During device-to-device authentication, the first + /// message from initiator (the challenge) is signed and put into the payload + /// of the message sent back to the initiator. + case unlockKeySignedChallenge // = 15 + + /// Specialty (corp only) features + case loginNotification // = 101 + + init() { + self = .enrollment + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .enrollment + case 1: self = .tickle + case 2: self = .txRequest + case 3: self = .txReply + case 4: self = .txSyncRequest + case 5: self = .txSyncResponse + case 6: self = .txPing + case 7: self = .deviceInfoUpdate + case 8: self = .txCancelRequest + case 10: self = .proximityauthPairing + case 11: self = .gcmv1IdentityAssertion + case 12: self = .deviceToDeviceResponderHelloPayload + case 13: self = .deviceToDeviceMessage + case 14: self = .deviceProximityCallback + case 15: self = .unlockKeySignedChallenge + case 101: self = .loginNotification + default: return nil + } + } + + var rawValue: Int { + switch self { + case .enrollment: return 0 + case .tickle: return 1 + case .txRequest: return 2 + case .txReply: return 3 + case .txSyncRequest: return 4 + case .txSyncResponse: return 5 + case .txPing: return 6 + case .deviceInfoUpdate: return 7 + case .txCancelRequest: return 8 + case .proximityauthPairing: return 10 + case .gcmv1IdentityAssertion: return 11 + case .deviceToDeviceResponderHelloPayload: return 12 + case .deviceToDeviceMessage: return 13 + case .deviceProximityCallback: return 14 + case .unlockKeySignedChallenge: return 15 + case .loginNotification: return 101 + } + } + +} + +#if swift(>=4.2) + +extension Securegcm_Type: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Message used only during enrollment +/// Field numbers should be kept in sync with DeviceInfo in: +/// java/com/google/security/cryptauth/backend/services/common/common.proto +struct Securegcm_GcmDeviceInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// This field's name does not match the one in DeviceInfo for legacy reasons. + /// Consider using long_device_id and device_type instead when enrolling + /// non-android devices. + var androidDeviceID: UInt64 { + get {return _storage._androidDeviceID ?? 0} + set {_uniqueStorage()._androidDeviceID = newValue} + } + /// Returns true if `androidDeviceID` has been explicitly set. + var hasAndroidDeviceID: Bool {return _storage._androidDeviceID != nil} + /// Clears the value of `androidDeviceID`. Subsequent reads from it will return its default value. + mutating func clearAndroidDeviceID() {_uniqueStorage()._androidDeviceID = nil} + + /// Used for device_address of DeviceInfo field 2, but for GCM capable devices. + var gcmRegistrationID: Data { + get {return _storage._gcmRegistrationID ?? Data()} + set {_uniqueStorage()._gcmRegistrationID = newValue} + } + /// Returns true if `gcmRegistrationID` has been explicitly set. + var hasGcmRegistrationID: Bool {return _storage._gcmRegistrationID != nil} + /// Clears the value of `gcmRegistrationID`. Subsequent reads from it will return its default value. + mutating func clearGcmRegistrationID() {_uniqueStorage()._gcmRegistrationID = nil} + + /// Used for device_address of DeviceInfo field 2, but for iOS devices. + var apnRegistrationID: Data { + get {return _storage._apnRegistrationID ?? Data()} + set {_uniqueStorage()._apnRegistrationID = newValue} + } + /// Returns true if `apnRegistrationID` has been explicitly set. + var hasApnRegistrationID: Bool {return _storage._apnRegistrationID != nil} + /// Clears the value of `apnRegistrationID`. Subsequent reads from it will return its default value. + mutating func clearApnRegistrationID() {_uniqueStorage()._apnRegistrationID = nil} + + /// Does the user have notifications enabled for the given device address. + var notificationEnabled: Bool { + get {return _storage._notificationEnabled ?? true} + set {_uniqueStorage()._notificationEnabled = newValue} + } + /// Returns true if `notificationEnabled` has been explicitly set. + var hasNotificationEnabled: Bool {return _storage._notificationEnabled != nil} + /// Clears the value of `notificationEnabled`. Subsequent reads from it will return its default value. + mutating func clearNotificationEnabled() {_uniqueStorage()._notificationEnabled = nil} + + /// Used for device_address of DeviceInfo field 2, a Bluetooth Mac address for + /// the device (e.g., to be used with EasyUnlock) + var bluetoothMacAddress: String { + get {return _storage._bluetoothMacAddress ?? String()} + set {_uniqueStorage()._bluetoothMacAddress = newValue} + } + /// Returns true if `bluetoothMacAddress` has been explicitly set. + var hasBluetoothMacAddress: Bool {return _storage._bluetoothMacAddress != nil} + /// Clears the value of `bluetoothMacAddress`. Subsequent reads from it will return its default value. + mutating func clearBluetoothMacAddress() {_uniqueStorage()._bluetoothMacAddress = nil} + + /// SHA-256 hash of the device master key (from the key exchange). + /// Differs from DeviceInfo field 3, which contains the actual master key. + var deviceMasterKeyHash: Data { + get {return _storage._deviceMasterKeyHash ?? Data()} + set {_uniqueStorage()._deviceMasterKeyHash = newValue} + } + /// Returns true if `deviceMasterKeyHash` has been explicitly set. + var hasDeviceMasterKeyHash: Bool {return _storage._deviceMasterKeyHash != nil} + /// Clears the value of `deviceMasterKeyHash`. Subsequent reads from it will return its default value. + mutating func clearDeviceMasterKeyHash() {_uniqueStorage()._deviceMasterKeyHash = nil} + + /// A SecureMessage.EcP256PublicKey + var userPublicKey: Data { + get {return _storage._userPublicKey ?? Data()} + set {_uniqueStorage()._userPublicKey = newValue} + } + /// Returns true if `userPublicKey` has been explicitly set. + var hasUserPublicKey: Bool {return _storage._userPublicKey != nil} + /// Clears the value of `userPublicKey`. Subsequent reads from it will return its default value. + mutating func clearUserPublicKey() {_uniqueStorage()._userPublicKey = nil} + + /// device's model name + /// (e.g., an android.os.Build.MODEL or UIDevice.model) + var deviceModel: String { + get {return _storage._deviceModel ?? String()} + set {_uniqueStorage()._deviceModel = newValue} + } + /// Returns true if `deviceModel` has been explicitly set. + var hasDeviceModel: Bool {return _storage._deviceModel != nil} + /// Clears the value of `deviceModel`. Subsequent reads from it will return its default value. + mutating func clearDeviceModel() {_uniqueStorage()._deviceModel = nil} + + /// device's locale + var locale: String { + get {return _storage._locale ?? String()} + set {_uniqueStorage()._locale = newValue} + } + /// Returns true if `locale` has been explicitly set. + var hasLocale: Bool {return _storage._locale != nil} + /// Clears the value of `locale`. Subsequent reads from it will return its default value. + mutating func clearLocale() {_uniqueStorage()._locale = nil} + + /// The handle for user_public_key (and implicitly, a master key) + var keyHandle: Data { + get {return _storage._keyHandle ?? Data()} + set {_uniqueStorage()._keyHandle = newValue} + } + /// Returns true if `keyHandle` has been explicitly set. + var hasKeyHandle: Bool {return _storage._keyHandle != nil} + /// Clears the value of `keyHandle`. Subsequent reads from it will return its default value. + mutating func clearKeyHandle() {_uniqueStorage()._keyHandle = nil} + + /// The initial counter value for the device, sent by the device + var counter: Int64 { + get {return _storage._counter ?? 0} + set {_uniqueStorage()._counter = newValue} + } + /// Returns true if `counter` has been explicitly set. + var hasCounter: Bool {return _storage._counter != nil} + /// Clears the value of `counter`. Subsequent reads from it will return its default value. + mutating func clearCounter() {_uniqueStorage()._counter = nil} + + /// The Operating System version on the device + /// (e.g., an android.os.Build.DISPLAY or UIDevice.systemVersion) + var deviceOsVersion: String { + get {return _storage._deviceOsVersion ?? String()} + set {_uniqueStorage()._deviceOsVersion = newValue} + } + /// Returns true if `deviceOsVersion` has been explicitly set. + var hasDeviceOsVersion: Bool {return _storage._deviceOsVersion != nil} + /// Clears the value of `deviceOsVersion`. Subsequent reads from it will return its default value. + mutating func clearDeviceOsVersion() {_uniqueStorage()._deviceOsVersion = nil} + + /// The Operating System version number on the device + /// (e.g., an android.os.Build.VERSION.SDK_INT) + var deviceOsVersionCode: Int64 { + get {return _storage._deviceOsVersionCode ?? 0} + set {_uniqueStorage()._deviceOsVersionCode = newValue} + } + /// Returns true if `deviceOsVersionCode` has been explicitly set. + var hasDeviceOsVersionCode: Bool {return _storage._deviceOsVersionCode != nil} + /// Clears the value of `deviceOsVersionCode`. Subsequent reads from it will return its default value. + mutating func clearDeviceOsVersionCode() {_uniqueStorage()._deviceOsVersionCode = nil} + + /// The Operating System release on the device + /// (e.g., an android.os.Build.VERSION.RELEASE) + var deviceOsRelease: String { + get {return _storage._deviceOsRelease ?? String()} + set {_uniqueStorage()._deviceOsRelease = newValue} + } + /// Returns true if `deviceOsRelease` has been explicitly set. + var hasDeviceOsRelease: Bool {return _storage._deviceOsRelease != nil} + /// Clears the value of `deviceOsRelease`. Subsequent reads from it will return its default value. + mutating func clearDeviceOsRelease() {_uniqueStorage()._deviceOsRelease = nil} + + /// The Operating System codename on the device + /// (e.g., an android.os.Build.VERSION.CODENAME or UIDevice.systemName) + var deviceOsCodename: String { + get {return _storage._deviceOsCodename ?? String()} + set {_uniqueStorage()._deviceOsCodename = newValue} + } + /// Returns true if `deviceOsCodename` has been explicitly set. + var hasDeviceOsCodename: Bool {return _storage._deviceOsCodename != nil} + /// Clears the value of `deviceOsCodename`. Subsequent reads from it will return its default value. + mutating func clearDeviceOsCodename() {_uniqueStorage()._deviceOsCodename = nil} + + /// The software version running on the device + /// (e.g., Authenticator app version string) + var deviceSoftwareVersion: String { + get {return _storage._deviceSoftwareVersion ?? String()} + set {_uniqueStorage()._deviceSoftwareVersion = newValue} + } + /// Returns true if `deviceSoftwareVersion` has been explicitly set. + var hasDeviceSoftwareVersion: Bool {return _storage._deviceSoftwareVersion != nil} + /// Clears the value of `deviceSoftwareVersion`. Subsequent reads from it will return its default value. + mutating func clearDeviceSoftwareVersion() {_uniqueStorage()._deviceSoftwareVersion = nil} + + /// The software version number running on the device + /// (e.g., Authenticator app version code) + var deviceSoftwareVersionCode: Int64 { + get {return _storage._deviceSoftwareVersionCode ?? 0} + set {_uniqueStorage()._deviceSoftwareVersionCode = newValue} + } + /// Returns true if `deviceSoftwareVersionCode` has been explicitly set. + var hasDeviceSoftwareVersionCode: Bool {return _storage._deviceSoftwareVersionCode != nil} + /// Clears the value of `deviceSoftwareVersionCode`. Subsequent reads from it will return its default value. + mutating func clearDeviceSoftwareVersionCode() {_uniqueStorage()._deviceSoftwareVersionCode = nil} + + /// Software package information if applicable + /// (e.g., com.google.android.apps.authenticator2) + var deviceSoftwarePackage: String { + get {return _storage._deviceSoftwarePackage ?? String()} + set {_uniqueStorage()._deviceSoftwarePackage = newValue} + } + /// Returns true if `deviceSoftwarePackage` has been explicitly set. + var hasDeviceSoftwarePackage: Bool {return _storage._deviceSoftwarePackage != nil} + /// Clears the value of `deviceSoftwarePackage`. Subsequent reads from it will return its default value. + mutating func clearDeviceSoftwarePackage() {_uniqueStorage()._deviceSoftwarePackage = nil} + + /// Size of the display in thousandths of an inch (e.g., 7000 mils = 7 in) + var deviceDisplayDiagonalMils: Int32 { + get {return _storage._deviceDisplayDiagonalMils ?? 0} + set {_uniqueStorage()._deviceDisplayDiagonalMils = newValue} + } + /// Returns true if `deviceDisplayDiagonalMils` has been explicitly set. + var hasDeviceDisplayDiagonalMils: Bool {return _storage._deviceDisplayDiagonalMils != nil} + /// Clears the value of `deviceDisplayDiagonalMils`. Subsequent reads from it will return its default value. + mutating func clearDeviceDisplayDiagonalMils() {_uniqueStorage()._deviceDisplayDiagonalMils = nil} + + /// For Authzen capable devices, their Authzen protocol version + var deviceAuthzenVersion: Int32 { + get {return _storage._deviceAuthzenVersion ?? 0} + set {_uniqueStorage()._deviceAuthzenVersion = newValue} + } + /// Returns true if `deviceAuthzenVersion` has been explicitly set. + var hasDeviceAuthzenVersion: Bool {return _storage._deviceAuthzenVersion != nil} + /// Clears the value of `deviceAuthzenVersion`. Subsequent reads from it will return its default value. + mutating func clearDeviceAuthzenVersion() {_uniqueStorage()._deviceAuthzenVersion = nil} + + /// Not all devices have device identifiers that fit in 64 bits. + var longDeviceID: Data { + get {return _storage._longDeviceID ?? Data()} + set {_uniqueStorage()._longDeviceID = newValue} + } + /// Returns true if `longDeviceID` has been explicitly set. + var hasLongDeviceID: Bool {return _storage._longDeviceID != nil} + /// Clears the value of `longDeviceID`. Subsequent reads from it will return its default value. + mutating func clearLongDeviceID() {_uniqueStorage()._longDeviceID = nil} + + /// The device manufacturer name + /// (e.g., android.os.Build.MANUFACTURER) + var deviceManufacturer: String { + get {return _storage._deviceManufacturer ?? String()} + set {_uniqueStorage()._deviceManufacturer = newValue} + } + /// Returns true if `deviceManufacturer` has been explicitly set. + var hasDeviceManufacturer: Bool {return _storage._deviceManufacturer != nil} + /// Clears the value of `deviceManufacturer`. Subsequent reads from it will return its default value. + mutating func clearDeviceManufacturer() {_uniqueStorage()._deviceManufacturer = nil} + + /// Used to indicate which type of device this is. + var deviceType: Securegcm_DeviceType { + get {return _storage._deviceType ?? .android} + set {_uniqueStorage()._deviceType = newValue} + } + /// Returns true if `deviceType` has been explicitly set. + var hasDeviceType: Bool {return _storage._deviceType != nil} + /// Clears the value of `deviceType`. Subsequent reads from it will return its default value. + mutating func clearDeviceType() {_uniqueStorage()._deviceType = nil} + + /// Is this device using a secure screenlock (e.g., pattern or pin unlock) + var usingSecureScreenlock: Bool { + get {return _storage._usingSecureScreenlock ?? false} + set {_uniqueStorage()._usingSecureScreenlock = newValue} + } + /// Returns true if `usingSecureScreenlock` has been explicitly set. + var hasUsingSecureScreenlock: Bool {return _storage._usingSecureScreenlock != nil} + /// Clears the value of `usingSecureScreenlock`. Subsequent reads from it will return its default value. + mutating func clearUsingSecureScreenlock() {_uniqueStorage()._usingSecureScreenlock = nil} + + /// Is auto-unlocking the screenlock (e.g., when at "home") supported? + var autoUnlockScreenlockSupported: Bool { + get {return _storage._autoUnlockScreenlockSupported ?? false} + set {_uniqueStorage()._autoUnlockScreenlockSupported = newValue} + } + /// Returns true if `autoUnlockScreenlockSupported` has been explicitly set. + var hasAutoUnlockScreenlockSupported: Bool {return _storage._autoUnlockScreenlockSupported != nil} + /// Clears the value of `autoUnlockScreenlockSupported`. Subsequent reads from it will return its default value. + mutating func clearAutoUnlockScreenlockSupported() {_uniqueStorage()._autoUnlockScreenlockSupported = nil} + + /// Is auto-unlocking the screenlock (e.g., when at "home") enabled? + var autoUnlockScreenlockEnabled: Bool { + get {return _storage._autoUnlockScreenlockEnabled ?? false} + set {_uniqueStorage()._autoUnlockScreenlockEnabled = newValue} + } + /// Returns true if `autoUnlockScreenlockEnabled` has been explicitly set. + var hasAutoUnlockScreenlockEnabled: Bool {return _storage._autoUnlockScreenlockEnabled != nil} + /// Clears the value of `autoUnlockScreenlockEnabled`. Subsequent reads from it will return its default value. + mutating func clearAutoUnlockScreenlockEnabled() {_uniqueStorage()._autoUnlockScreenlockEnabled = nil} + + /// Does the device have a Bluetooth (classic) radio? + var bluetoothRadioSupported: Bool { + get {return _storage._bluetoothRadioSupported ?? false} + set {_uniqueStorage()._bluetoothRadioSupported = newValue} + } + /// Returns true if `bluetoothRadioSupported` has been explicitly set. + var hasBluetoothRadioSupported: Bool {return _storage._bluetoothRadioSupported != nil} + /// Clears the value of `bluetoothRadioSupported`. Subsequent reads from it will return its default value. + mutating func clearBluetoothRadioSupported() {_uniqueStorage()._bluetoothRadioSupported = nil} + + /// Is the Bluetooth (classic) radio on? + var bluetoothRadioEnabled: Bool { + get {return _storage._bluetoothRadioEnabled ?? false} + set {_uniqueStorage()._bluetoothRadioEnabled = newValue} + } + /// Returns true if `bluetoothRadioEnabled` has been explicitly set. + var hasBluetoothRadioEnabled: Bool {return _storage._bluetoothRadioEnabled != nil} + /// Clears the value of `bluetoothRadioEnabled`. Subsequent reads from it will return its default value. + mutating func clearBluetoothRadioEnabled() {_uniqueStorage()._bluetoothRadioEnabled = nil} + + /// Does the device hardware support a mobile data connection? + var mobileDataSupported: Bool { + get {return _storage._mobileDataSupported ?? false} + set {_uniqueStorage()._mobileDataSupported = newValue} + } + /// Returns true if `mobileDataSupported` has been explicitly set. + var hasMobileDataSupported: Bool {return _storage._mobileDataSupported != nil} + /// Clears the value of `mobileDataSupported`. Subsequent reads from it will return its default value. + mutating func clearMobileDataSupported() {_uniqueStorage()._mobileDataSupported = nil} + + /// Does the device support tethering? + var tetheringSupported: Bool { + get {return _storage._tetheringSupported ?? false} + set {_uniqueStorage()._tetheringSupported = newValue} + } + /// Returns true if `tetheringSupported` has been explicitly set. + var hasTetheringSupported: Bool {return _storage._tetheringSupported != nil} + /// Clears the value of `tetheringSupported`. Subsequent reads from it will return its default value. + mutating func clearTetheringSupported() {_uniqueStorage()._tetheringSupported = nil} + + /// Does the device have a BLE radio? + var bleRadioSupported: Bool { + get {return _storage._bleRadioSupported ?? false} + set {_uniqueStorage()._bleRadioSupported = newValue} + } + /// Returns true if `bleRadioSupported` has been explicitly set. + var hasBleRadioSupported: Bool {return _storage._bleRadioSupported != nil} + /// Clears the value of `bleRadioSupported`. Subsequent reads from it will return its default value. + mutating func clearBleRadioSupported() {_uniqueStorage()._bleRadioSupported = nil} + + /// Is the device a "Pixel Experience" Android device? + var pixelExperience: Bool { + get {return _storage._pixelExperience ?? false} + set {_uniqueStorage()._pixelExperience = newValue} + } + /// Returns true if `pixelExperience` has been explicitly set. + var hasPixelExperience: Bool {return _storage._pixelExperience != nil} + /// Clears the value of `pixelExperience`. Subsequent reads from it will return its default value. + mutating func clearPixelExperience() {_uniqueStorage()._pixelExperience = nil} + + /// Is the device running in the ARC++ container on a chromebook? + var arcPlusPlus: Bool { + get {return _storage._arcPlusPlus ?? false} + set {_uniqueStorage()._arcPlusPlus = newValue} + } + /// Returns true if `arcPlusPlus` has been explicitly set. + var hasArcPlusPlus: Bool {return _storage._arcPlusPlus != nil} + /// Clears the value of `arcPlusPlus`. Subsequent reads from it will return its default value. + mutating func clearArcPlusPlus() {_uniqueStorage()._arcPlusPlus = nil} + + /// Is the value set in |using_secure_screenlock| reliable? On some Android + /// devices, the platform API to get the screenlock state is not trustworthy. + /// See b/32212161. + var isScreenlockStateFlaky: Bool { + get {return _storage._isScreenlockStateFlaky ?? false} + set {_uniqueStorage()._isScreenlockStateFlaky = newValue} + } + /// Returns true if `isScreenlockStateFlaky` has been explicitly set. + var hasIsScreenlockStateFlaky: Bool {return _storage._isScreenlockStateFlaky != nil} + /// Clears the value of `isScreenlockStateFlaky`. Subsequent reads from it will return its default value. + mutating func clearIsScreenlockStateFlaky() {_uniqueStorage()._isScreenlockStateFlaky = nil} + + /// A list of multi-device software features supported by the device. + var supportedSoftwareFeatures: [Securegcm_SoftwareFeature] { + get {return _storage._supportedSoftwareFeatures} + set {_uniqueStorage()._supportedSoftwareFeatures = newValue} + } + + /// A list of multi-device software features currently enabled (active) on the + /// device. + var enabledSoftwareFeatures: [Securegcm_SoftwareFeature] { + get {return _storage._enabledSoftwareFeatures} + set {_uniqueStorage()._enabledSoftwareFeatures = newValue} + } + + /// The enrollment session id this is sent with + var enrollmentSessionID: Data { + get {return _storage._enrollmentSessionID ?? Data()} + set {_uniqueStorage()._enrollmentSessionID = newValue} + } + /// Returns true if `enrollmentSessionID` has been explicitly set. + var hasEnrollmentSessionID: Bool {return _storage._enrollmentSessionID != nil} + /// Clears the value of `enrollmentSessionID`. Subsequent reads from it will return its default value. + mutating func clearEnrollmentSessionID() {_uniqueStorage()._enrollmentSessionID = nil} + + /// A copy of the user's OAuth token + var oauthToken: String { + get {return _storage._oauthToken ?? String()} + set {_uniqueStorage()._oauthToken = newValue} + } + /// Returns true if `oauthToken` has been explicitly set. + var hasOauthToken: Bool {return _storage._oauthToken != nil} + /// Clears the value of `oauthToken`. Subsequent reads from it will return its default value. + mutating func clearOauthToken() {_uniqueStorage()._oauthToken = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Securegcm_GcmMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: Securegcm_Type { + get {return _type ?? .enrollment} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var version: Int32 { + get {return _version ?? 0} + set {_version = newValue} + } + /// Returns true if `version` has been explicitly set. + var hasVersion: Bool {return self._version != nil} + /// Clears the value of `version`. Subsequent reads from it will return its default value. + mutating func clearVersion() {self._version = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _type: Securegcm_Type? = nil + fileprivate var _version: Int32? = nil +} + +struct Securegcm_Tickle { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Time after which this tickle should expire + var expiryTime: UInt64 { + get {return _expiryTime ?? 0} + set {_expiryTime = newValue} + } + /// Returns true if `expiryTime` has been explicitly set. + var hasExpiryTime: Bool {return self._expiryTime != nil} + /// Clears the value of `expiryTime`. Subsequent reads from it will return its default value. + mutating func clearExpiryTime() {self._expiryTime = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _expiryTime: UInt64? = nil +} + +struct Securegcm_LoginNotificationInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Time at which the server received the login notification request. + var creationTime: UInt64 { + get {return _creationTime ?? 0} + set {_creationTime = newValue} + } + /// Returns true if `creationTime` has been explicitly set. + var hasCreationTime: Bool {return self._creationTime != nil} + /// Clears the value of `creationTime`. Subsequent reads from it will return its default value. + mutating func clearCreationTime() {self._creationTime = nil} + + /// Must correspond to user_id in LoginNotificationRequest, if set. + var email: String { + get {return _email ?? String()} + set {_email = newValue} + } + /// Returns true if `email` has been explicitly set. + var hasEmail: Bool {return self._email != nil} + /// Clears the value of `email`. Subsequent reads from it will return its default value. + mutating func clearEmail() {self._email = nil} + + /// Host where the user's credentials were used to login, if meaningful. + var host: String { + get {return _host ?? String()} + set {_host = newValue} + } + /// Returns true if `host` has been explicitly set. + var hasHost: Bool {return self._host != nil} + /// Clears the value of `host`. Subsequent reads from it will return its default value. + mutating func clearHost() {self._host = nil} + + /// Location from where the user's credentials were used, if meaningful. + var source: String { + get {return _source ?? String()} + set {_source = newValue} + } + /// Returns true if `source` has been explicitly set. + var hasSource: Bool {return self._source != nil} + /// Clears the value of `source`. Subsequent reads from it will return its default value. + mutating func clearSource() {self._source = nil} + + /// Type of login, e.g. ssh, gnome-screensaver, or web. + var eventType: String { + get {return _eventType ?? String()} + set {_eventType = newValue} + } + /// Returns true if `eventType` has been explicitly set. + var hasEventType: Bool {return self._eventType != nil} + /// Clears the value of `eventType`. Subsequent reads from it will return its default value. + mutating func clearEventType() {self._eventType = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _creationTime: UInt64? = nil + fileprivate var _email: String? = nil + fileprivate var _host: String? = nil + fileprivate var _source: String? = nil + fileprivate var _eventType: String? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Securegcm_AppleDeviceDiagonalMils: @unchecked Sendable {} +extension Securegcm_DeviceType: @unchecked Sendable {} +extension Securegcm_SoftwareFeature: @unchecked Sendable {} +extension Securegcm_InvocationReason: @unchecked Sendable {} +extension Securegcm_Type: @unchecked Sendable {} +extension Securegcm_GcmDeviceInfo: @unchecked Sendable {} +extension Securegcm_GcmMetadata: @unchecked Sendable {} +extension Securegcm_Tickle: @unchecked Sendable {} +extension Securegcm_LoginNotificationInfo: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "securegcm" + +extension Securegcm_AppleDeviceDiagonalMils: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 4000: .same(proto: "APPLE_PHONE"), + 7900: .same(proto: "APPLE_PAD"), + ] +} + +extension Securegcm_DeviceType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "ANDROID"), + 2: .same(proto: "CHROME"), + 3: .same(proto: "IOS"), + 4: .same(proto: "BROWSER"), + 5: .same(proto: "OSX"), + ] +} + +extension Securegcm_SoftwareFeature: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_FEATURE"), + 1: .same(proto: "BETTER_TOGETHER_HOST"), + 2: .same(proto: "BETTER_TOGETHER_CLIENT"), + 3: .same(proto: "EASY_UNLOCK_HOST"), + 4: .same(proto: "EASY_UNLOCK_CLIENT"), + 5: .same(proto: "MAGIC_TETHER_HOST"), + 6: .same(proto: "MAGIC_TETHER_CLIENT"), + 7: .same(proto: "SMS_CONNECT_HOST"), + 8: .same(proto: "SMS_CONNECT_CLIENT"), + ] +} + +extension Securegcm_InvocationReason: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "REASON_UNKNOWN"), + 1: .same(proto: "REASON_INITIALIZATION"), + 2: .same(proto: "REASON_PERIODIC"), + 3: .same(proto: "REASON_SLOW_PERIODIC"), + 4: .same(proto: "REASON_FAST_PERIODIC"), + 5: .same(proto: "REASON_EXPIRATION"), + 6: .same(proto: "REASON_FAILURE_RECOVERY"), + 7: .same(proto: "REASON_NEW_ACCOUNT"), + 8: .same(proto: "REASON_CHANGED_ACCOUNT"), + 9: .same(proto: "REASON_FEATURE_TOGGLED"), + 10: .same(proto: "REASON_SERVER_INITIATED"), + 11: .same(proto: "REASON_ADDRESS_CHANGE"), + 12: .same(proto: "REASON_SOFTWARE_UPDATE"), + 13: .same(proto: "REASON_MANUAL"), + 14: .same(proto: "REASON_CUSTOM_KEY_INVALIDATION"), + 15: .same(proto: "REASON_PROXIMITY_PERIODIC"), + ] +} + +extension Securegcm_Type: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "ENROLLMENT"), + 1: .same(proto: "TICKLE"), + 2: .same(proto: "TX_REQUEST"), + 3: .same(proto: "TX_REPLY"), + 4: .same(proto: "TX_SYNC_REQUEST"), + 5: .same(proto: "TX_SYNC_RESPONSE"), + 6: .same(proto: "TX_PING"), + 7: .same(proto: "DEVICE_INFO_UPDATE"), + 8: .same(proto: "TX_CANCEL_REQUEST"), + 10: .same(proto: "PROXIMITYAUTH_PAIRING"), + 11: .same(proto: "GCMV1_IDENTITY_ASSERTION"), + 12: .same(proto: "DEVICE_TO_DEVICE_RESPONDER_HELLO_PAYLOAD"), + 13: .same(proto: "DEVICE_TO_DEVICE_MESSAGE"), + 14: .same(proto: "DEVICE_PROXIMITY_CALLBACK"), + 15: .same(proto: "UNLOCK_KEY_SIGNED_CHALLENGE"), + 101: .same(proto: "LOGIN_NOTIFICATION"), + ] +} + +extension Securegcm_GcmDeviceInfo: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GcmDeviceInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "android_device_id"), + 102: .standard(proto: "gcm_registration_id"), + 202: .standard(proto: "apn_registration_id"), + 203: .standard(proto: "notification_enabled"), + 302: .standard(proto: "bluetooth_mac_address"), + 103: .standard(proto: "device_master_key_hash"), + 4: .standard(proto: "user_public_key"), + 7: .standard(proto: "device_model"), + 8: .same(proto: "locale"), + 9: .standard(proto: "key_handle"), + 12: .same(proto: "counter"), + 13: .standard(proto: "device_os_version"), + 14: .standard(proto: "device_os_version_code"), + 15: .standard(proto: "device_os_release"), + 16: .standard(proto: "device_os_codename"), + 17: .standard(proto: "device_software_version"), + 18: .standard(proto: "device_software_version_code"), + 19: .standard(proto: "device_software_package"), + 22: .standard(proto: "device_display_diagonal_mils"), + 24: .standard(proto: "device_authzen_version"), + 29: .standard(proto: "long_device_id"), + 31: .standard(proto: "device_manufacturer"), + 32: .standard(proto: "device_type"), + 400: .standard(proto: "using_secure_screenlock"), + 401: .standard(proto: "auto_unlock_screenlock_supported"), + 402: .standard(proto: "auto_unlock_screenlock_enabled"), + 403: .standard(proto: "bluetooth_radio_supported"), + 404: .standard(proto: "bluetooth_radio_enabled"), + 405: .standard(proto: "mobile_data_supported"), + 406: .standard(proto: "tethering_supported"), + 407: .standard(proto: "ble_radio_supported"), + 408: .standard(proto: "pixel_experience"), + 409: .standard(proto: "arc_plus_plus"), + 410: .standard(proto: "is_screenlock_state_flaky"), + 411: .standard(proto: "supported_software_features"), + 412: .standard(proto: "enabled_software_features"), + 1000: .standard(proto: "enrollment_session_id"), + 1001: .standard(proto: "oauth_token"), + ] + + fileprivate class _StorageClass { + var _androidDeviceID: UInt64? = nil + var _gcmRegistrationID: Data? = nil + var _apnRegistrationID: Data? = nil + var _notificationEnabled: Bool? = nil + var _bluetoothMacAddress: String? = nil + var _deviceMasterKeyHash: Data? = nil + var _userPublicKey: Data? = nil + var _deviceModel: String? = nil + var _locale: String? = nil + var _keyHandle: Data? = nil + var _counter: Int64? = nil + var _deviceOsVersion: String? = nil + var _deviceOsVersionCode: Int64? = nil + var _deviceOsRelease: String? = nil + var _deviceOsCodename: String? = nil + var _deviceSoftwareVersion: String? = nil + var _deviceSoftwareVersionCode: Int64? = nil + var _deviceSoftwarePackage: String? = nil + var _deviceDisplayDiagonalMils: Int32? = nil + var _deviceAuthzenVersion: Int32? = nil + var _longDeviceID: Data? = nil + var _deviceManufacturer: String? = nil + var _deviceType: Securegcm_DeviceType? = nil + var _usingSecureScreenlock: Bool? = nil + var _autoUnlockScreenlockSupported: Bool? = nil + var _autoUnlockScreenlockEnabled: Bool? = nil + var _bluetoothRadioSupported: Bool? = nil + var _bluetoothRadioEnabled: Bool? = nil + var _mobileDataSupported: Bool? = nil + var _tetheringSupported: Bool? = nil + var _bleRadioSupported: Bool? = nil + var _pixelExperience: Bool? = nil + var _arcPlusPlus: Bool? = nil + var _isScreenlockStateFlaky: Bool? = nil + var _supportedSoftwareFeatures: [Securegcm_SoftwareFeature] = [] + var _enabledSoftwareFeatures: [Securegcm_SoftwareFeature] = [] + var _enrollmentSessionID: Data? = nil + var _oauthToken: String? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _androidDeviceID = source._androidDeviceID + _gcmRegistrationID = source._gcmRegistrationID + _apnRegistrationID = source._apnRegistrationID + _notificationEnabled = source._notificationEnabled + _bluetoothMacAddress = source._bluetoothMacAddress + _deviceMasterKeyHash = source._deviceMasterKeyHash + _userPublicKey = source._userPublicKey + _deviceModel = source._deviceModel + _locale = source._locale + _keyHandle = source._keyHandle + _counter = source._counter + _deviceOsVersion = source._deviceOsVersion + _deviceOsVersionCode = source._deviceOsVersionCode + _deviceOsRelease = source._deviceOsRelease + _deviceOsCodename = source._deviceOsCodename + _deviceSoftwareVersion = source._deviceSoftwareVersion + _deviceSoftwareVersionCode = source._deviceSoftwareVersionCode + _deviceSoftwarePackage = source._deviceSoftwarePackage + _deviceDisplayDiagonalMils = source._deviceDisplayDiagonalMils + _deviceAuthzenVersion = source._deviceAuthzenVersion + _longDeviceID = source._longDeviceID + _deviceManufacturer = source._deviceManufacturer + _deviceType = source._deviceType + _usingSecureScreenlock = source._usingSecureScreenlock + _autoUnlockScreenlockSupported = source._autoUnlockScreenlockSupported + _autoUnlockScreenlockEnabled = source._autoUnlockScreenlockEnabled + _bluetoothRadioSupported = source._bluetoothRadioSupported + _bluetoothRadioEnabled = source._bluetoothRadioEnabled + _mobileDataSupported = source._mobileDataSupported + _tetheringSupported = source._tetheringSupported + _bleRadioSupported = source._bleRadioSupported + _pixelExperience = source._pixelExperience + _arcPlusPlus = source._arcPlusPlus + _isScreenlockStateFlaky = source._isScreenlockStateFlaky + _supportedSoftwareFeatures = source._supportedSoftwareFeatures + _enabledSoftwareFeatures = source._enabledSoftwareFeatures + _enrollmentSessionID = source._enrollmentSessionID + _oauthToken = source._oauthToken + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public var isInitialized: Bool { + return withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if _storage._userPublicKey == nil {return false} + return true + } + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularFixed64Field(value: &_storage._androidDeviceID) }() + case 4: try { try decoder.decodeSingularBytesField(value: &_storage._userPublicKey) }() + case 7: try { try decoder.decodeSingularStringField(value: &_storage._deviceModel) }() + case 8: try { try decoder.decodeSingularStringField(value: &_storage._locale) }() + case 9: try { try decoder.decodeSingularBytesField(value: &_storage._keyHandle) }() + case 12: try { try decoder.decodeSingularInt64Field(value: &_storage._counter) }() + case 13: try { try decoder.decodeSingularStringField(value: &_storage._deviceOsVersion) }() + case 14: try { try decoder.decodeSingularInt64Field(value: &_storage._deviceOsVersionCode) }() + case 15: try { try decoder.decodeSingularStringField(value: &_storage._deviceOsRelease) }() + case 16: try { try decoder.decodeSingularStringField(value: &_storage._deviceOsCodename) }() + case 17: try { try decoder.decodeSingularStringField(value: &_storage._deviceSoftwareVersion) }() + case 18: try { try decoder.decodeSingularInt64Field(value: &_storage._deviceSoftwareVersionCode) }() + case 19: try { try decoder.decodeSingularStringField(value: &_storage._deviceSoftwarePackage) }() + case 22: try { try decoder.decodeSingularInt32Field(value: &_storage._deviceDisplayDiagonalMils) }() + case 24: try { try decoder.decodeSingularInt32Field(value: &_storage._deviceAuthzenVersion) }() + case 29: try { try decoder.decodeSingularBytesField(value: &_storage._longDeviceID) }() + case 31: try { try decoder.decodeSingularStringField(value: &_storage._deviceManufacturer) }() + case 32: try { try decoder.decodeSingularEnumField(value: &_storage._deviceType) }() + case 102: try { try decoder.decodeSingularBytesField(value: &_storage._gcmRegistrationID) }() + case 103: try { try decoder.decodeSingularBytesField(value: &_storage._deviceMasterKeyHash) }() + case 202: try { try decoder.decodeSingularBytesField(value: &_storage._apnRegistrationID) }() + case 203: try { try decoder.decodeSingularBoolField(value: &_storage._notificationEnabled) }() + case 302: try { try decoder.decodeSingularStringField(value: &_storage._bluetoothMacAddress) }() + case 400: try { try decoder.decodeSingularBoolField(value: &_storage._usingSecureScreenlock) }() + case 401: try { try decoder.decodeSingularBoolField(value: &_storage._autoUnlockScreenlockSupported) }() + case 402: try { try decoder.decodeSingularBoolField(value: &_storage._autoUnlockScreenlockEnabled) }() + case 403: try { try decoder.decodeSingularBoolField(value: &_storage._bluetoothRadioSupported) }() + case 404: try { try decoder.decodeSingularBoolField(value: &_storage._bluetoothRadioEnabled) }() + case 405: try { try decoder.decodeSingularBoolField(value: &_storage._mobileDataSupported) }() + case 406: try { try decoder.decodeSingularBoolField(value: &_storage._tetheringSupported) }() + case 407: try { try decoder.decodeSingularBoolField(value: &_storage._bleRadioSupported) }() + case 408: try { try decoder.decodeSingularBoolField(value: &_storage._pixelExperience) }() + case 409: try { try decoder.decodeSingularBoolField(value: &_storage._arcPlusPlus) }() + case 410: try { try decoder.decodeSingularBoolField(value: &_storage._isScreenlockStateFlaky) }() + case 411: try { try decoder.decodeRepeatedEnumField(value: &_storage._supportedSoftwareFeatures) }() + case 412: try { try decoder.decodeRepeatedEnumField(value: &_storage._enabledSoftwareFeatures) }() + case 1000: try { try decoder.decodeSingularBytesField(value: &_storage._enrollmentSessionID) }() + case 1001: try { try decoder.decodeSingularStringField(value: &_storage._oauthToken) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = _storage._androidDeviceID { + try visitor.visitSingularFixed64Field(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._userPublicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } }() + try { if let v = _storage._deviceModel { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } }() + try { if let v = _storage._locale { + try visitor.visitSingularStringField(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._keyHandle { + try visitor.visitSingularBytesField(value: v, fieldNumber: 9) + } }() + try { if let v = _storage._counter { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 12) + } }() + try { if let v = _storage._deviceOsVersion { + try visitor.visitSingularStringField(value: v, fieldNumber: 13) + } }() + try { if let v = _storage._deviceOsVersionCode { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 14) + } }() + try { if let v = _storage._deviceOsRelease { + try visitor.visitSingularStringField(value: v, fieldNumber: 15) + } }() + try { if let v = _storage._deviceOsCodename { + try visitor.visitSingularStringField(value: v, fieldNumber: 16) + } }() + try { if let v = _storage._deviceSoftwareVersion { + try visitor.visitSingularStringField(value: v, fieldNumber: 17) + } }() + try { if let v = _storage._deviceSoftwareVersionCode { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 18) + } }() + try { if let v = _storage._deviceSoftwarePackage { + try visitor.visitSingularStringField(value: v, fieldNumber: 19) + } }() + try { if let v = _storage._deviceDisplayDiagonalMils { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 22) + } }() + try { if let v = _storage._deviceAuthzenVersion { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 24) + } }() + try { if let v = _storage._longDeviceID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 29) + } }() + try { if let v = _storage._deviceManufacturer { + try visitor.visitSingularStringField(value: v, fieldNumber: 31) + } }() + try { if let v = _storage._deviceType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 32) + } }() + try { if let v = _storage._gcmRegistrationID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 102) + } }() + try { if let v = _storage._deviceMasterKeyHash { + try visitor.visitSingularBytesField(value: v, fieldNumber: 103) + } }() + try { if let v = _storage._apnRegistrationID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 202) + } }() + try { if let v = _storage._notificationEnabled { + try visitor.visitSingularBoolField(value: v, fieldNumber: 203) + } }() + try { if let v = _storage._bluetoothMacAddress { + try visitor.visitSingularStringField(value: v, fieldNumber: 302) + } }() + try { if let v = _storage._usingSecureScreenlock { + try visitor.visitSingularBoolField(value: v, fieldNumber: 400) + } }() + try { if let v = _storage._autoUnlockScreenlockSupported { + try visitor.visitSingularBoolField(value: v, fieldNumber: 401) + } }() + try { if let v = _storage._autoUnlockScreenlockEnabled { + try visitor.visitSingularBoolField(value: v, fieldNumber: 402) + } }() + try { if let v = _storage._bluetoothRadioSupported { + try visitor.visitSingularBoolField(value: v, fieldNumber: 403) + } }() + try { if let v = _storage._bluetoothRadioEnabled { + try visitor.visitSingularBoolField(value: v, fieldNumber: 404) + } }() + try { if let v = _storage._mobileDataSupported { + try visitor.visitSingularBoolField(value: v, fieldNumber: 405) + } }() + try { if let v = _storage._tetheringSupported { + try visitor.visitSingularBoolField(value: v, fieldNumber: 406) + } }() + try { if let v = _storage._bleRadioSupported { + try visitor.visitSingularBoolField(value: v, fieldNumber: 407) + } }() + try { if let v = _storage._pixelExperience { + try visitor.visitSingularBoolField(value: v, fieldNumber: 408) + } }() + try { if let v = _storage._arcPlusPlus { + try visitor.visitSingularBoolField(value: v, fieldNumber: 409) + } }() + try { if let v = _storage._isScreenlockStateFlaky { + try visitor.visitSingularBoolField(value: v, fieldNumber: 410) + } }() + if !_storage._supportedSoftwareFeatures.isEmpty { + try visitor.visitRepeatedEnumField(value: _storage._supportedSoftwareFeatures, fieldNumber: 411) + } + if !_storage._enabledSoftwareFeatures.isEmpty { + try visitor.visitRepeatedEnumField(value: _storage._enabledSoftwareFeatures, fieldNumber: 412) + } + try { if let v = _storage._enrollmentSessionID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1000) + } }() + try { if let v = _storage._oauthToken { + try visitor.visitSingularStringField(value: v, fieldNumber: 1001) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_GcmDeviceInfo, rhs: Securegcm_GcmDeviceInfo) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._androidDeviceID != rhs_storage._androidDeviceID {return false} + if _storage._gcmRegistrationID != rhs_storage._gcmRegistrationID {return false} + if _storage._apnRegistrationID != rhs_storage._apnRegistrationID {return false} + if _storage._notificationEnabled != rhs_storage._notificationEnabled {return false} + if _storage._bluetoothMacAddress != rhs_storage._bluetoothMacAddress {return false} + if _storage._deviceMasterKeyHash != rhs_storage._deviceMasterKeyHash {return false} + if _storage._userPublicKey != rhs_storage._userPublicKey {return false} + if _storage._deviceModel != rhs_storage._deviceModel {return false} + if _storage._locale != rhs_storage._locale {return false} + if _storage._keyHandle != rhs_storage._keyHandle {return false} + if _storage._counter != rhs_storage._counter {return false} + if _storage._deviceOsVersion != rhs_storage._deviceOsVersion {return false} + if _storage._deviceOsVersionCode != rhs_storage._deviceOsVersionCode {return false} + if _storage._deviceOsRelease != rhs_storage._deviceOsRelease {return false} + if _storage._deviceOsCodename != rhs_storage._deviceOsCodename {return false} + if _storage._deviceSoftwareVersion != rhs_storage._deviceSoftwareVersion {return false} + if _storage._deviceSoftwareVersionCode != rhs_storage._deviceSoftwareVersionCode {return false} + if _storage._deviceSoftwarePackage != rhs_storage._deviceSoftwarePackage {return false} + if _storage._deviceDisplayDiagonalMils != rhs_storage._deviceDisplayDiagonalMils {return false} + if _storage._deviceAuthzenVersion != rhs_storage._deviceAuthzenVersion {return false} + if _storage._longDeviceID != rhs_storage._longDeviceID {return false} + if _storage._deviceManufacturer != rhs_storage._deviceManufacturer {return false} + if _storage._deviceType != rhs_storage._deviceType {return false} + if _storage._usingSecureScreenlock != rhs_storage._usingSecureScreenlock {return false} + if _storage._autoUnlockScreenlockSupported != rhs_storage._autoUnlockScreenlockSupported {return false} + if _storage._autoUnlockScreenlockEnabled != rhs_storage._autoUnlockScreenlockEnabled {return false} + if _storage._bluetoothRadioSupported != rhs_storage._bluetoothRadioSupported {return false} + if _storage._bluetoothRadioEnabled != rhs_storage._bluetoothRadioEnabled {return false} + if _storage._mobileDataSupported != rhs_storage._mobileDataSupported {return false} + if _storage._tetheringSupported != rhs_storage._tetheringSupported {return false} + if _storage._bleRadioSupported != rhs_storage._bleRadioSupported {return false} + if _storage._pixelExperience != rhs_storage._pixelExperience {return false} + if _storage._arcPlusPlus != rhs_storage._arcPlusPlus {return false} + if _storage._isScreenlockStateFlaky != rhs_storage._isScreenlockStateFlaky {return false} + if _storage._supportedSoftwareFeatures != rhs_storage._supportedSoftwareFeatures {return false} + if _storage._enabledSoftwareFeatures != rhs_storage._enabledSoftwareFeatures {return false} + if _storage._enrollmentSessionID != rhs_storage._enrollmentSessionID {return false} + if _storage._oauthToken != rhs_storage._oauthToken {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_GcmMetadata: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GcmMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "version"), + ] + + public var isInitialized: Bool { + if self._type == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._type) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._version) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._version { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_GcmMetadata, rhs: Securegcm_GcmMetadata) -> Bool { + if lhs._type != rhs._type {return false} + if lhs._version != rhs._version {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_Tickle: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Tickle" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "expiry_time"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularFixed64Field(value: &self._expiryTime) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._expiryTime { + try visitor.visitSingularFixed64Field(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_Tickle, rhs: Securegcm_Tickle) -> Bool { + if lhs._expiryTime != rhs._expiryTime {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_LoginNotificationInfo: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LoginNotificationInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .standard(proto: "creation_time"), + 3: .same(proto: "email"), + 4: .same(proto: "host"), + 5: .same(proto: "source"), + 6: .standard(proto: "event_type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 2: try { try decoder.decodeSingularFixed64Field(value: &self._creationTime) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._email) }() + case 4: try { try decoder.decodeSingularStringField(value: &self._host) }() + case 5: try { try decoder.decodeSingularStringField(value: &self._source) }() + case 6: try { try decoder.decodeSingularStringField(value: &self._eventType) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._creationTime { + try visitor.visitSingularFixed64Field(value: v, fieldNumber: 2) + } }() + try { if let v = self._email { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } }() + try { if let v = self._host { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } }() + try { if let v = self._source { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } }() + try { if let v = self._eventType { + try visitor.visitSingularStringField(value: v, fieldNumber: 6) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_LoginNotificationInfo, rhs: Securegcm_LoginNotificationInfo) -> Bool { + if lhs._creationTime != rhs._creationTime {return false} + if lhs._email != rhs._email {return false} + if lhs._host != rhs._host {return false} + if lhs._source != rhs._source {return false} + if lhs._eventType != rhs._eventType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/airsync-mac/Core/QuickShare/Protobuf/securemessage.pb.swift b/airsync-mac/Core/QuickShare/Protobuf/securemessage.pb.swift new file mode 100644 index 00000000..a3ec5e27 --- /dev/null +++ b/airsync-mac/Core/QuickShare/Protobuf/securemessage.pb.swift @@ -0,0 +1,951 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: securemessage.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Proto definitions for SecureMessage format + +import Foundation +@preconcurrency import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// Supported "signature" schemes (both symmetric key and public key based) +enum Securemessage_SigScheme: SwiftProtobuf.Enum { + typealias RawValue = Int + case hmacSha256 // = 1 + case ecdsaP256Sha256 // = 2 + + /// Not recommended -- use ECDSA_P256_SHA256 instead + case rsa2048Sha256 // = 3 + + init() { + self = .hmacSha256 + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .hmacSha256 + case 2: self = .ecdsaP256Sha256 + case 3: self = .rsa2048Sha256 + default: return nil + } + } + + var rawValue: Int { + switch self { + case .hmacSha256: return 1 + case .ecdsaP256Sha256: return 2 + case .rsa2048Sha256: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Securemessage_SigScheme: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Supported encryption schemes +enum Securemessage_EncScheme: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// No encryption + case none // = 1 + case aes256Cbc // = 2 + + init() { + self = .none + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .none + case 2: self = .aes256Cbc + default: return nil + } + } + + var rawValue: Int { + switch self { + case .none: return 1 + case .aes256Cbc: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Securemessage_EncScheme: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// A list of supported public key types +enum Securemessage_PublicKeyType: SwiftProtobuf.Enum { + typealias RawValue = Int + case ecP256 // = 1 + case rsa2048 // = 2 + + /// 2048-bit MODP group 14, from RFC 3526 + case dh2048Modp // = 3 + + init() { + self = .ecP256 + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .ecP256 + case 2: self = .rsa2048 + case 3: self = .dh2048Modp + default: return nil + } + } + + var rawValue: Int { + switch self { + case .ecP256: return 1 + case .rsa2048: return 2 + case .dh2048Modp: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Securemessage_PublicKeyType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Securemessage_SecureMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Must contain a HeaderAndBody message + var headerAndBody: Data { + get {return _headerAndBody ?? Data()} + set {_headerAndBody = newValue} + } + /// Returns true if `headerAndBody` has been explicitly set. + var hasHeaderAndBody: Bool {return self._headerAndBody != nil} + /// Clears the value of `headerAndBody`. Subsequent reads from it will return its default value. + mutating func clearHeaderAndBody() {self._headerAndBody = nil} + + /// Signature of header_and_body + var signature: Data { + get {return _signature ?? Data()} + set {_signature = newValue} + } + /// Returns true if `signature` has been explicitly set. + var hasSignature: Bool {return self._signature != nil} + /// Clears the value of `signature`. Subsequent reads from it will return its default value. + mutating func clearSignature() {self._signature = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _headerAndBody: Data? = nil + fileprivate var _signature: Data? = nil +} + +struct Securemessage_Header { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var signatureScheme: Securemessage_SigScheme { + get {return _signatureScheme ?? .hmacSha256} + set {_signatureScheme = newValue} + } + /// Returns true if `signatureScheme` has been explicitly set. + var hasSignatureScheme: Bool {return self._signatureScheme != nil} + /// Clears the value of `signatureScheme`. Subsequent reads from it will return its default value. + mutating func clearSignatureScheme() {self._signatureScheme = nil} + + var encryptionScheme: Securemessage_EncScheme { + get {return _encryptionScheme ?? .none} + set {_encryptionScheme = newValue} + } + /// Returns true if `encryptionScheme` has been explicitly set. + var hasEncryptionScheme: Bool {return self._encryptionScheme != nil} + /// Clears the value of `encryptionScheme`. Subsequent reads from it will return its default value. + mutating func clearEncryptionScheme() {self._encryptionScheme = nil} + + /// Identifies the verification key + var verificationKeyID: Data { + get {return _verificationKeyID ?? Data()} + set {_verificationKeyID = newValue} + } + /// Returns true if `verificationKeyID` has been explicitly set. + var hasVerificationKeyID: Bool {return self._verificationKeyID != nil} + /// Clears the value of `verificationKeyID`. Subsequent reads from it will return its default value. + mutating func clearVerificationKeyID() {self._verificationKeyID = nil} + + /// Identifies the decryption key + var decryptionKeyID: Data { + get {return _decryptionKeyID ?? Data()} + set {_decryptionKeyID = newValue} + } + /// Returns true if `decryptionKeyID` has been explicitly set. + var hasDecryptionKeyID: Bool {return self._decryptionKeyID != nil} + /// Clears the value of `decryptionKeyID`. Subsequent reads from it will return its default value. + mutating func clearDecryptionKeyID() {self._decryptionKeyID = nil} + + /// Encryption may use an IV + var iv: Data { + get {return _iv ?? Data()} + set {_iv = newValue} + } + /// Returns true if `iv` has been explicitly set. + var hasIv: Bool {return self._iv != nil} + /// Clears the value of `iv`. Subsequent reads from it will return its default value. + mutating func clearIv() {self._iv = nil} + + /// Arbitrary per-protocol public data, to be sent with the plain-text header + var publicMetadata: Data { + get {return _publicMetadata ?? Data()} + set {_publicMetadata = newValue} + } + /// Returns true if `publicMetadata` has been explicitly set. + var hasPublicMetadata: Bool {return self._publicMetadata != nil} + /// Clears the value of `publicMetadata`. Subsequent reads from it will return its default value. + mutating func clearPublicMetadata() {self._publicMetadata = nil} + + /// The length of some associated data this is not sent in this SecureMessage, + /// but which will be bound to the signature. + var associatedDataLength: UInt32 { + get {return _associatedDataLength ?? 0} + set {_associatedDataLength = newValue} + } + /// Returns true if `associatedDataLength` has been explicitly set. + var hasAssociatedDataLength: Bool {return self._associatedDataLength != nil} + /// Clears the value of `associatedDataLength`. Subsequent reads from it will return its default value. + mutating func clearAssociatedDataLength() {self._associatedDataLength = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _signatureScheme: Securemessage_SigScheme? = nil + fileprivate var _encryptionScheme: Securemessage_EncScheme? = nil + fileprivate var _verificationKeyID: Data? = nil + fileprivate var _decryptionKeyID: Data? = nil + fileprivate var _iv: Data? = nil + fileprivate var _publicMetadata: Data? = nil + fileprivate var _associatedDataLength: UInt32? = nil +} + +struct Securemessage_HeaderAndBody { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Public data about this message (to be bound in the signature) + var header: Securemessage_Header { + get {return _header ?? Securemessage_Header()} + set {_header = newValue} + } + /// Returns true if `header` has been explicitly set. + var hasHeader: Bool {return self._header != nil} + /// Clears the value of `header`. Subsequent reads from it will return its default value. + mutating func clearHeader() {self._header = nil} + + /// Payload data + var body: Data { + get {return _body ?? Data()} + set {_body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return self._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {self._body = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _header: Securemessage_Header? = nil + fileprivate var _body: Data? = nil +} + +/// Must be kept wire-format compatible with HeaderAndBody. Provides the +/// SecureMessage code with a consistent wire-format representation that +/// remains stable irrespective of protobuf implementation choices. This +/// low-level representation of a HeaderAndBody should not be used by +/// any code outside of the SecureMessage library implementation/tests. +struct Securemessage_HeaderAndBodyInternal { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A raw (wire-format) byte encoding of a Header, suitable for hashing + var header: Data { + get {return _header ?? Data()} + set {_header = newValue} + } + /// Returns true if `header` has been explicitly set. + var hasHeader: Bool {return self._header != nil} + /// Clears the value of `header`. Subsequent reads from it will return its default value. + mutating func clearHeader() {self._header = nil} + + /// Payload data + var body: Data { + get {return _body ?? Data()} + set {_body = newValue} + } + /// Returns true if `body` has been explicitly set. + var hasBody: Bool {return self._body != nil} + /// Clears the value of `body`. Subsequent reads from it will return its default value. + mutating func clearBody() {self._body = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _header: Data? = nil + fileprivate var _body: Data? = nil +} + +/// A convenience proto for encoding NIST P-256 elliptic curve public keys +struct Securemessage_EcP256PublicKey { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// x and y are encoded in big-endian two's complement (slightly wasteful) + /// Client MUST verify (x,y) is a valid point on NIST P256 + var x: Data { + get {return _x ?? Data()} + set {_x = newValue} + } + /// Returns true if `x` has been explicitly set. + var hasX: Bool {return self._x != nil} + /// Clears the value of `x`. Subsequent reads from it will return its default value. + mutating func clearX() {self._x = nil} + + var y: Data { + get {return _y ?? Data()} + set {_y = newValue} + } + /// Returns true if `y` has been explicitly set. + var hasY: Bool {return self._y != nil} + /// Clears the value of `y`. Subsequent reads from it will return its default value. + mutating func clearY() {self._y = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _x: Data? = nil + fileprivate var _y: Data? = nil +} + +/// A convenience proto for encoding RSA public keys with small exponents +struct Securemessage_SimpleRsaPublicKey { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Encoded in big-endian two's complement + var n: Data { + get {return _n ?? Data()} + set {_n = newValue} + } + /// Returns true if `n` has been explicitly set. + var hasN: Bool {return self._n != nil} + /// Clears the value of `n`. Subsequent reads from it will return its default value. + mutating func clearN() {self._n = nil} + + var e: Int32 { + get {return _e ?? 65537} + set {_e = newValue} + } + /// Returns true if `e` has been explicitly set. + var hasE: Bool {return self._e != nil} + /// Clears the value of `e`. Subsequent reads from it will return its default value. + mutating func clearE() {self._e = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _n: Data? = nil + fileprivate var _e: Int32? = nil +} + +/// A convenience proto for encoding Diffie-Hellman public keys, +/// for use only when Elliptic Curve based key exchanges are not possible. +/// (Note that the group parameters must be specified separately) +struct Securemessage_DhPublicKey { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Big-endian two's complement encoded group element + var y: Data { + get {return _y ?? Data()} + set {_y = newValue} + } + /// Returns true if `y` has been explicitly set. + var hasY: Bool {return self._y != nil} + /// Clears the value of `y`. Subsequent reads from it will return its default value. + mutating func clearY() {self._y = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _y: Data? = nil +} + +struct Securemessage_GenericPublicKey { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: Securemessage_PublicKeyType { + get {return _type ?? .ecP256} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var ecP256PublicKey: Securemessage_EcP256PublicKey { + get {return _ecP256PublicKey ?? Securemessage_EcP256PublicKey()} + set {_ecP256PublicKey = newValue} + } + /// Returns true if `ecP256PublicKey` has been explicitly set. + var hasEcP256PublicKey: Bool {return self._ecP256PublicKey != nil} + /// Clears the value of `ecP256PublicKey`. Subsequent reads from it will return its default value. + mutating func clearEcP256PublicKey() {self._ecP256PublicKey = nil} + + var rsa2048PublicKey: Securemessage_SimpleRsaPublicKey { + get {return _rsa2048PublicKey ?? Securemessage_SimpleRsaPublicKey()} + set {_rsa2048PublicKey = newValue} + } + /// Returns true if `rsa2048PublicKey` has been explicitly set. + var hasRsa2048PublicKey: Bool {return self._rsa2048PublicKey != nil} + /// Clears the value of `rsa2048PublicKey`. Subsequent reads from it will return its default value. + mutating func clearRsa2048PublicKey() {self._rsa2048PublicKey = nil} + + /// Use only as a last resort + var dh2048PublicKey: Securemessage_DhPublicKey { + get {return _dh2048PublicKey ?? Securemessage_DhPublicKey()} + set {_dh2048PublicKey = newValue} + } + /// Returns true if `dh2048PublicKey` has been explicitly set. + var hasDh2048PublicKey: Bool {return self._dh2048PublicKey != nil} + /// Clears the value of `dh2048PublicKey`. Subsequent reads from it will return its default value. + mutating func clearDh2048PublicKey() {self._dh2048PublicKey = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _type: Securemessage_PublicKeyType? = nil + fileprivate var _ecP256PublicKey: Securemessage_EcP256PublicKey? = nil + fileprivate var _rsa2048PublicKey: Securemessage_SimpleRsaPublicKey? = nil + fileprivate var _dh2048PublicKey: Securemessage_DhPublicKey? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Securemessage_SigScheme: @unchecked Sendable {} +extension Securemessage_EncScheme: @unchecked Sendable {} +extension Securemessage_PublicKeyType: @unchecked Sendable {} +extension Securemessage_SecureMessage: @unchecked Sendable {} +extension Securemessage_Header: @unchecked Sendable {} +extension Securemessage_HeaderAndBody: @unchecked Sendable {} +extension Securemessage_HeaderAndBodyInternal: @unchecked Sendable {} +extension Securemessage_EcP256PublicKey: @unchecked Sendable {} +extension Securemessage_SimpleRsaPublicKey: @unchecked Sendable {} +extension Securemessage_DhPublicKey: @unchecked Sendable {} +extension Securemessage_GenericPublicKey: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "securemessage" + +extension Securemessage_SigScheme: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "HMAC_SHA256"), + 2: .same(proto: "ECDSA_P256_SHA256"), + 3: .same(proto: "RSA2048_SHA256"), + ] +} + +extension Securemessage_EncScheme: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "NONE"), + 2: .same(proto: "AES_256_CBC"), + ] +} + +extension Securemessage_PublicKeyType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "EC_P256"), + 2: .same(proto: "RSA2048"), + 3: .same(proto: "DH2048_MODP"), + ] +} + +extension Securemessage_SecureMessage: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SecureMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "header_and_body"), + 2: .same(proto: "signature"), + ] + + public var isInitialized: Bool { + if self._headerAndBody == nil {return false} + if self._signature == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._headerAndBody) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._signature) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._headerAndBody { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._signature { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_SecureMessage, rhs: Securemessage_SecureMessage) -> Bool { + if lhs._headerAndBody != rhs._headerAndBody {return false} + if lhs._signature != rhs._signature {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securemessage_Header: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Header" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "signature_scheme"), + 2: .standard(proto: "encryption_scheme"), + 3: .standard(proto: "verification_key_id"), + 4: .standard(proto: "decryption_key_id"), + 5: .same(proto: "iv"), + 6: .standard(proto: "public_metadata"), + 7: .standard(proto: "associated_data_length"), + ] + + public var isInitialized: Bool { + if self._signatureScheme == nil {return false} + if self._encryptionScheme == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._signatureScheme) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._encryptionScheme) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._verificationKeyID) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self._decryptionKeyID) }() + case 5: try { try decoder.decodeSingularBytesField(value: &self._iv) }() + case 6: try { try decoder.decodeSingularBytesField(value: &self._publicMetadata) }() + case 7: try { try decoder.decodeSingularUInt32Field(value: &self._associatedDataLength) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._signatureScheme { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._encryptionScheme { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try { if let v = self._verificationKeyID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = self._decryptionKeyID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } }() + try { if let v = self._iv { + try visitor.visitSingularBytesField(value: v, fieldNumber: 5) + } }() + try { if let v = self._publicMetadata { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } }() + try { if let v = self._associatedDataLength { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 7) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_Header, rhs: Securemessage_Header) -> Bool { + if lhs._signatureScheme != rhs._signatureScheme {return false} + if lhs._encryptionScheme != rhs._encryptionScheme {return false} + if lhs._verificationKeyID != rhs._verificationKeyID {return false} + if lhs._decryptionKeyID != rhs._decryptionKeyID {return false} + if lhs._iv != rhs._iv {return false} + if lhs._publicMetadata != rhs._publicMetadata {return false} + if lhs._associatedDataLength != rhs._associatedDataLength {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securemessage_HeaderAndBody: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HeaderAndBody" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "header"), + 2: .same(proto: "body"), + ] + + public var isInitialized: Bool { + if self._header == nil {return false} + if self._body == nil {return false} + if let v = self._header, !v.isInitialized {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._header) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._body) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._header { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._body { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_HeaderAndBody, rhs: Securemessage_HeaderAndBody) -> Bool { + if lhs._header != rhs._header {return false} + if lhs._body != rhs._body {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securemessage_HeaderAndBodyInternal: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HeaderAndBodyInternal" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "header"), + 2: .same(proto: "body"), + ] + + public var isInitialized: Bool { + if self._header == nil {return false} + if self._body == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._header) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._body) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._header { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._body { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_HeaderAndBodyInternal, rhs: Securemessage_HeaderAndBodyInternal) -> Bool { + if lhs._header != rhs._header {return false} + if lhs._body != rhs._body {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securemessage_EcP256PublicKey: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EcP256PublicKey" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "x"), + 2: .same(proto: "y"), + ] + + public var isInitialized: Bool { + if self._x == nil {return false} + if self._y == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._x) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._y) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._x { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._y { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_EcP256PublicKey, rhs: Securemessage_EcP256PublicKey) -> Bool { + if lhs._x != rhs._x {return false} + if lhs._y != rhs._y {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securemessage_SimpleRsaPublicKey: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SimpleRsaPublicKey" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "n"), + 2: .same(proto: "e"), + ] + + public var isInitialized: Bool { + if self._n == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._n) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._e) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._n { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._e { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_SimpleRsaPublicKey, rhs: Securemessage_SimpleRsaPublicKey) -> Bool { + if lhs._n != rhs._n {return false} + if lhs._e != rhs._e {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securemessage_DhPublicKey: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DhPublicKey" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "y"), + ] + + public var isInitialized: Bool { + if self._y == nil {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._y) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._y { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_DhPublicKey, rhs: Securemessage_DhPublicKey) -> Bool { + if lhs._y != rhs._y {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securemessage_GenericPublicKey: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GenericPublicKey" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .standard(proto: "ec_p256_public_key"), + 3: .standard(proto: "rsa2048_public_key"), + 4: .standard(proto: "dh2048_public_key"), + ] + + public var isInitialized: Bool { + if self._type == nil {return false} + if let v = self._ecP256PublicKey, !v.isInitialized {return false} + if let v = self._rsa2048PublicKey, !v.isInitialized {return false} + if let v = self._dh2048PublicKey, !v.isInitialized {return false} + return true + } + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._type) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._ecP256PublicKey) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._rsa2048PublicKey) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._dh2048PublicKey) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._ecP256PublicKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = self._rsa2048PublicKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = self._dh2048PublicKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securemessage_GenericPublicKey, rhs: Securemessage_GenericPublicKey) -> Bool { + if lhs._type != rhs._type {return false} + if lhs._ecP256PublicKey != rhs._ecP256PublicKey {return false} + if lhs._rsa2048PublicKey != rhs._rsa2048PublicKey {return false} + if lhs._dh2048PublicKey != rhs._dh2048PublicKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/airsync-mac/Core/QuickShare/Protobuf/sharing_enums.pb.swift b/airsync-mac/Core/QuickShare/Protobuf/sharing_enums.pb.swift new file mode 100644 index 00000000..3f67c88c --- /dev/null +++ b/airsync-mac/Core/QuickShare/Protobuf/sharing_enums.pb.swift @@ -0,0 +1,3468 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: sharing_enums.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// We use event based logging (an event object can be constructed and logged +/// immediately when they occur). To obtain session based information (e.g. +/// durations, counting incoming introductions), we use flowId (sender/receiver) +/// in NearbyClearcutLogger (for android, or clearcut_event_logger as the +/// equivalence for Windows) for all events (may exclude settings), and +/// session_id for a pair of events (start and end of a session). +/// Next id: 74 +enum Location_Nearby_Proto_Sharing_EventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownEventType // = 0 + + /// When new users accept agreements (like grant permission to contacts for + /// CONTACT_ONLY visibility) and are enrolled into Nearby Sharing. This event + /// is used to count number of new users. + case acceptAgreements // = 1 + + /// User enables/disables nearby sharing from setting or tile service. + case enableNearbySharing // = 2 + + /// User sets visibility preference from setting. + case setVisibility // = 3 + + /// Describe attachments immediately when Nearby Sharing is opened by another + /// app which is used to generate/attach attachments to be shared with other + /// devices. + case describeAttachments // = 4 + + /// Start of a scanning phase at sender. + case scanForShareTargetsStart // = 5 + + /// End of the scanning phase at sender. + case scanForShareTargetsEnd // = 6 + + /// Receiver advertises itself for presence (a pseudo session). + case advertiseDevicePresenceStart // = 7 + + /// End of the advertising phase at receiver. + case advertiseDevicePresenceEnd // = 8 + + /// Sender sends a fast initialization to receiver. + case sendFastInitialization // = 9 + + /// Receiver receives the fast initialization. + case receiveFastInitialization // = 10 + + /// Sender discovers a share target. + case discoverShareTarget // = 11 + + /// Sender sends introduction (before attachments being sent). + case sendIntroduction // = 12 + + /// Receiver receives introduction. + case receiveIntroduction // = 13 + + /// Receiver responds to introduction (before attachments being sent). + /// Actions: Accept, Reject, or (for some reason) Fail. + case respondToIntroduction // = 14 + + /// Start of the sending attachments phase at sender. + case sendAttachmentsStart // = 15 + + /// End of sending attachments phase at sender. + case sendAttachmentsEnd // = 16 + + /// Start of the receiving attachments phase at receiver. + case receiveAttachmentsStart // = 17 + + /// End of receiving attachments phase at receiver. + case receiveAttachmentsEnd // = 18 + + /// Sender cancels sending attachments. + case cancelSendingAttachments // = 19 + + /// Receiver cancels receiving attachments. + case cancelReceivingAttachments // = 20 + + /// Receiver opens received attachments. + case openReceivedAttachments // = 21 + + /// User opens the setup activity. + case launchSetupActivity // = 22 + + /// User adds a contact. + case addContact // = 23 + + /// User removes a contact. + case removeContact // = 24 + + /// Local devices all Fast Share server. + case fastShareServerResponse // = 25 + + /// The start of a sending session. + case sendStart // = 26 + + /// Receiver accepts a fast initialization. + case acceptFastInitialization // = 27 + + /// Set data usage preference. + case setDataUsage // = 28 + + /// Receiver dismisses a fast initialization + case dismissFastInitialization // = 29 + + /// Cancel connection. + case cancelConnection // = 30 + + /// User starts a chimera activity (e.g. ConsentsChimeraActivity, + /// DeviceVisibilityChimeraActivity...) + case launchActivity // = 31 + + /// Receiver dismisses a privacy notification. + case dismissPrivacyNotification // = 32 + + /// Receiver taps a privacy notification. + case tapPrivacyNotification // = 33 + + /// Receiver taps a help page. + case tapHelp // = 34 + + /// Receiver taps a feedback. + case tapFeedback // = 35 + + /// Receiver adds quick settings tile. + case addQuickSettingsTile // = 36 + + /// Receiver removes quick settings tile. + case removeQuickSettingsTile // = 37 + + /// Receiver phone consent clicked. + case launchPhoneConsent // = 38 + + /// Devices show a phone consent banner in Nearby Share Settings + case displayPhoneConsent // = 54 + + /// Receiver taps quick settings tile. + case tapQuickSettingsTile // = 39 + + /// Receiver Installation of APKs status. + case installApk // = 40 + + /// Receiver verification of APKs status. + case verifyApk // = 41 + + /// User starts a consent. + case launchConsent // = 42 + + /// After receiving payloads, Nearby Share still needs to transfer the payloads + /// to correct attachment formats and move files attachments from temporary + /// directory to final destination. + case processReceivedAttachmentsEnd // = 43 + + /// Toggle Show Notification setting item in Nearby Share setting. + case toggleShowNotification // = 44 + + /// Set device name + case setDeviceName // = 45 + + /// users dropped off opt-in page. + case declineAgreements // = 46 + + /// Request setting permissions (Wifi/BT/location/airplane mode). + case requestSettingPermissions // = 47 + + /// Set up a connection with the remote device. + case establishConnection // = 48 + + /// Track device states in Nearby Share setting. + case deviceSettings // = 49 + + /// Receiver auto dismisses a fast initialization notification. + case autoDismissFastInitialization // = 50 + + /// App Crash event. + /// Used only for Windows App now. + case appCrash // = 51 + + /// Sender taps the Send button in quick settings + case tapQuickSettingsFileShare // = 52 + + /// Devices show a privacy notification + case displayPrivacyNotification // = 53 + + /// Preference usage event (e.g. load/save preferences, etc). + /// Used only for Windows App now. + case preferencesUsage // = 55 + + /// Default opt in + case defaultOptIn // = 56 + + /// The result of the setup wizard flow + case setupWizard // = 57 + + /// Sender taps a QR code + case tapQrCode // = 58 + + /// QR code link shown + case qrCodeLinkShown // = 59 + + /// Sender failed to parse endpoint id. + case parsingFailedEndpointID // = 60 + + /// The device is discovered by fast initialization + case fastInitDiscoverDevice // = 61 + + /// Send desktop notification. + case sendDesktopNotification // = 62 + + /// User sets account preference + case setAccount // = 63 + + /// Decrypt certificate failure + case decryptCertificateFailure // = 64 + + /// Show allow permission auto access UI + case showAllowPermissionAutoAccess // = 65 + + /// UI events for transferring files with desktop applications. It includes + /// event types such as DESKTOP_TRANSFER_EVENT_SEND_TYPE_SELECT_A_DEVICE. + case sendDesktopTransferEvent // = 66 + + /// Show accept button on Quick Share receive UI + case waitingForAccept // = 67 + + /// High quality event setup + case highQualityMediumSetup // = 68 + + /// RPC call status + case rpcCallStatus // = 69 + + /// A QR code sharing session has started + case startQrCodeSession // = 70 + + /// A QR code URL has been opened in a web client/browser instead of in a + /// native Quick Share app. + case qrCodeOpenedInWebClient // = 71 + + /// A HaTS survey session id has been joined with Quick Share flow id. + case hatsJointEvent // = 72 + + /// Previews received. + case receivePreviews // = 73 + + init() { + self = .unknownEventType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownEventType + case 1: self = .acceptAgreements + case 2: self = .enableNearbySharing + case 3: self = .setVisibility + case 4: self = .describeAttachments + case 5: self = .scanForShareTargetsStart + case 6: self = .scanForShareTargetsEnd + case 7: self = .advertiseDevicePresenceStart + case 8: self = .advertiseDevicePresenceEnd + case 9: self = .sendFastInitialization + case 10: self = .receiveFastInitialization + case 11: self = .discoverShareTarget + case 12: self = .sendIntroduction + case 13: self = .receiveIntroduction + case 14: self = .respondToIntroduction + case 15: self = .sendAttachmentsStart + case 16: self = .sendAttachmentsEnd + case 17: self = .receiveAttachmentsStart + case 18: self = .receiveAttachmentsEnd + case 19: self = .cancelSendingAttachments + case 20: self = .cancelReceivingAttachments + case 21: self = .openReceivedAttachments + case 22: self = .launchSetupActivity + case 23: self = .addContact + case 24: self = .removeContact + case 25: self = .fastShareServerResponse + case 26: self = .sendStart + case 27: self = .acceptFastInitialization + case 28: self = .setDataUsage + case 29: self = .dismissFastInitialization + case 30: self = .cancelConnection + case 31: self = .launchActivity + case 32: self = .dismissPrivacyNotification + case 33: self = .tapPrivacyNotification + case 34: self = .tapHelp + case 35: self = .tapFeedback + case 36: self = .addQuickSettingsTile + case 37: self = .removeQuickSettingsTile + case 38: self = .launchPhoneConsent + case 39: self = .tapQuickSettingsTile + case 40: self = .installApk + case 41: self = .verifyApk + case 42: self = .launchConsent + case 43: self = .processReceivedAttachmentsEnd + case 44: self = .toggleShowNotification + case 45: self = .setDeviceName + case 46: self = .declineAgreements + case 47: self = .requestSettingPermissions + case 48: self = .establishConnection + case 49: self = .deviceSettings + case 50: self = .autoDismissFastInitialization + case 51: self = .appCrash + case 52: self = .tapQuickSettingsFileShare + case 53: self = .displayPrivacyNotification + case 54: self = .displayPhoneConsent + case 55: self = .preferencesUsage + case 56: self = .defaultOptIn + case 57: self = .setupWizard + case 58: self = .tapQrCode + case 59: self = .qrCodeLinkShown + case 60: self = .parsingFailedEndpointID + case 61: self = .fastInitDiscoverDevice + case 62: self = .sendDesktopNotification + case 63: self = .setAccount + case 64: self = .decryptCertificateFailure + case 65: self = .showAllowPermissionAutoAccess + case 66: self = .sendDesktopTransferEvent + case 67: self = .waitingForAccept + case 68: self = .highQualityMediumSetup + case 69: self = .rpcCallStatus + case 70: self = .startQrCodeSession + case 71: self = .qrCodeOpenedInWebClient + case 72: self = .hatsJointEvent + case 73: self = .receivePreviews + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownEventType: return 0 + case .acceptAgreements: return 1 + case .enableNearbySharing: return 2 + case .setVisibility: return 3 + case .describeAttachments: return 4 + case .scanForShareTargetsStart: return 5 + case .scanForShareTargetsEnd: return 6 + case .advertiseDevicePresenceStart: return 7 + case .advertiseDevicePresenceEnd: return 8 + case .sendFastInitialization: return 9 + case .receiveFastInitialization: return 10 + case .discoverShareTarget: return 11 + case .sendIntroduction: return 12 + case .receiveIntroduction: return 13 + case .respondToIntroduction: return 14 + case .sendAttachmentsStart: return 15 + case .sendAttachmentsEnd: return 16 + case .receiveAttachmentsStart: return 17 + case .receiveAttachmentsEnd: return 18 + case .cancelSendingAttachments: return 19 + case .cancelReceivingAttachments: return 20 + case .openReceivedAttachments: return 21 + case .launchSetupActivity: return 22 + case .addContact: return 23 + case .removeContact: return 24 + case .fastShareServerResponse: return 25 + case .sendStart: return 26 + case .acceptFastInitialization: return 27 + case .setDataUsage: return 28 + case .dismissFastInitialization: return 29 + case .cancelConnection: return 30 + case .launchActivity: return 31 + case .dismissPrivacyNotification: return 32 + case .tapPrivacyNotification: return 33 + case .tapHelp: return 34 + case .tapFeedback: return 35 + case .addQuickSettingsTile: return 36 + case .removeQuickSettingsTile: return 37 + case .launchPhoneConsent: return 38 + case .tapQuickSettingsTile: return 39 + case .installApk: return 40 + case .verifyApk: return 41 + case .launchConsent: return 42 + case .processReceivedAttachmentsEnd: return 43 + case .toggleShowNotification: return 44 + case .setDeviceName: return 45 + case .declineAgreements: return 46 + case .requestSettingPermissions: return 47 + case .establishConnection: return 48 + case .deviceSettings: return 49 + case .autoDismissFastInitialization: return 50 + case .appCrash: return 51 + case .tapQuickSettingsFileShare: return 52 + case .displayPrivacyNotification: return 53 + case .displayPhoneConsent: return 54 + case .preferencesUsage: return 55 + case .defaultOptIn: return 56 + case .setupWizard: return 57 + case .tapQrCode: return 58 + case .qrCodeLinkShown: return 59 + case .parsingFailedEndpointID: return 60 + case .fastInitDiscoverDevice: return 61 + case .sendDesktopNotification: return 62 + case .setAccount: return 63 + case .decryptCertificateFailure: return 64 + case .showAllowPermissionAutoAccess: return 65 + case .sendDesktopTransferEvent: return 66 + case .waitingForAccept: return 67 + case .highQualityMediumSetup: return 68 + case .rpcCallStatus: return 69 + case .startQrCodeSession: return 70 + case .qrCodeOpenedInWebClient: return 71 + case .hatsJointEvent: return 72 + case .receivePreviews: return 73 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_EventType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Event category to differentiate whether this comes from sender or receiver, +/// whether this is for communication flow, or for settings. +enum Location_Nearby_Proto_Sharing_EventCategory: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownEventCategory // = 0 + case sendingEvent // = 1 + case receivingEvent // = 2 + case settingsEvent // = 3 + case rpcEvent // = 4 + + init() { + self = .unknownEventCategory + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownEventCategory + case 1: self = .sendingEvent + case 2: self = .receivingEvent + case 3: self = .settingsEvent + case 4: self = .rpcEvent + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownEventCategory: return 0 + case .sendingEvent: return 1 + case .receivingEvent: return 2 + case .settingsEvent: return 3 + case .rpcEvent: return 4 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_EventCategory: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Status of nearby sharing. +enum Location_Nearby_Proto_Sharing_NearbySharingStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownNearbySharingStatus // = 0 + case on // = 1 + case off // = 2 + + init() { + self = .unknownNearbySharingStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownNearbySharingStatus + case 1: self = .on + case 2: self = .off + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownNearbySharingStatus: return 0 + case .on: return 1 + case .off: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_NearbySharingStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_Visibility: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownVisibility // = 0 + case contactsOnly // = 1 + case everyone // = 2 + case selectedContactsOnly // = 3 + case hidden // = 4 + case selfShare // = 5 + + init() { + self = .unknownVisibility + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownVisibility + case 1: self = .contactsOnly + case 2: self = .everyone + case 3: self = .selectedContactsOnly + case 4: self = .hidden + case 5: self = .selfShare + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownVisibility: return 0 + case .contactsOnly: return 1 + case .everyone: return 2 + case .selectedContactsOnly: return 3 + case .hidden: return 4 + case .selfShare: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_Visibility: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_DataUsage: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownDataUsage // = 0 + case online // = 1 + case wifiOnly // = 2 + case offline // = 3 + + init() { + self = .unknownDataUsage + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownDataUsage + case 1: self = .online + case 2: self = .wifiOnly + case 3: self = .offline + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownDataUsage: return 0 + case .online: return 1 + case .wifiOnly: return 2 + case .offline: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_DataUsage: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The status of establishing a connection. Used by ESTABLISH_CONNECTION. +enum Location_Nearby_Proto_Sharing_EstablishConnectionStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case connectionStatusUnknown // = 0 + case connectionStatusSuccess // = 1 + case connectionStatusFailure // = 2 + case connectionStatusCancellation // = 3 + case connectionStatusMediaUnavailableAttachment // = 4 + case connectionStatusFailedPairedKeyhandshake // = 5 + case connectionStatusFailedWriteIntroduction // = 6 + case connectionStatusFailedNullConnection // = 7 + case connectionStatusFailedNoTransferUpdateCallback // = 8 + case connectionStatusLostConnectivity // = 9 + + /// TODO: b/341782941 - : Annote this status when it's confirmed by Nearby + /// Connections team. + case connectionStatusInvalidAdvertisement // = 10 + + init() { + self = .connectionStatusUnknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .connectionStatusUnknown + case 1: self = .connectionStatusSuccess + case 2: self = .connectionStatusFailure + case 3: self = .connectionStatusCancellation + case 4: self = .connectionStatusMediaUnavailableAttachment + case 5: self = .connectionStatusFailedPairedKeyhandshake + case 6: self = .connectionStatusFailedWriteIntroduction + case 7: self = .connectionStatusFailedNullConnection + case 8: self = .connectionStatusFailedNoTransferUpdateCallback + case 9: self = .connectionStatusLostConnectivity + case 10: self = .connectionStatusInvalidAdvertisement + default: return nil + } + } + + var rawValue: Int { + switch self { + case .connectionStatusUnknown: return 0 + case .connectionStatusSuccess: return 1 + case .connectionStatusFailure: return 2 + case .connectionStatusCancellation: return 3 + case .connectionStatusMediaUnavailableAttachment: return 4 + case .connectionStatusFailedPairedKeyhandshake: return 5 + case .connectionStatusFailedWriteIntroduction: return 6 + case .connectionStatusFailedNullConnection: return 7 + case .connectionStatusFailedNoTransferUpdateCallback: return 8 + case .connectionStatusLostConnectivity: return 9 + case .connectionStatusInvalidAdvertisement: return 10 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_EstablishConnectionStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The status of sending and receiving attachments. Used by SEND_ATTACHMENTS. +enum Location_Nearby_Proto_Sharing_AttachmentTransmissionStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownAttachmentTransmissionStatus // = 0 + case completeAttachmentTransmissionStatus // = 1 + case canceledAttachmentTransmissionStatus // = 2 + case failedAttachmentTransmissionStatus // = 3 + case rejectedAttachment // = 4 + case timedOutAttachment // = 5 + case awaitingRemoteAcceptanceFailedAttachment // = 6 + case notEnoughSpaceAttachment // = 7 + case failedNoTransferUpdateCallback // = 8 + case mediaUnavailableAttachment // = 9 + case unsupportedAttachmentTypeAttachment // = 10 + case noAttachmentFound // = 11 + case failedNoShareTargetEndpoint // = 12 + case failedPairedKeyhandshake // = 13 + case failedNullConnection // = 14 + case failedNoPayload // = 15 + case failedWriteIntroduction // = 16 + + /// The remote response is either missing or has an unknown type. + case failedUnknownRemoteResponse // = 17 + + /// Breakdowns of FAILED_NULL_CONNECTION (Desktop side) + case failedNullConnectionInitOutgoing // = 18 + case failedNullConnectionDisconnected // = 19 + + /// Breakdowns of FAILED_NULL_CONNECTION (android side) + /// Connection failed due to Wifi is disconnected or Bluetooth setting is off + /// or user turn on airplane mode. + case failedNullConnectionLostConnectivity // = 20 + + /// Unexpected connection failure. + case failedNullConnectionFailure // = 21 + case rejectedAttachmentTransmissionStatus // = 22 + case timedOutAttachmentTransmissionStatus // = 23 + case notEnoughSpaceAttachmentTransmissionStatus // = 24 + case unsupportedAttachmentTypeAttachmentTransmissionStatus // = 25 + case failedUnknownRemoteResponseTransmissionStatus // = 26 + + /// Connection failed due to Wifi is disconnected or Bluetooth setting is off + /// or user turn on airplane mode. + case noResponseFrameConnectionClosedLostConnectivityTransmissionStatus // = 27 + + /// Unexpected connection failure due to no response frame. + case noResponseFrameConnectionClosedTransmissionStatus // = 28 + + /// Connection failed due to Wifi is disconnected or Bluetooth setting is off + /// or user turn on airplane mode. + case lostConnectivityTransmissionStatus // = 29 + + /// Connection failed due to the medium is not allowed. + case failedDisallowedMedium // = 30 + + init() { + self = .unknownAttachmentTransmissionStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownAttachmentTransmissionStatus + case 1: self = .completeAttachmentTransmissionStatus + case 2: self = .canceledAttachmentTransmissionStatus + case 3: self = .failedAttachmentTransmissionStatus + case 4: self = .rejectedAttachment + case 5: self = .timedOutAttachment + case 6: self = .awaitingRemoteAcceptanceFailedAttachment + case 7: self = .notEnoughSpaceAttachment + case 8: self = .failedNoTransferUpdateCallback + case 9: self = .mediaUnavailableAttachment + case 10: self = .unsupportedAttachmentTypeAttachment + case 11: self = .noAttachmentFound + case 12: self = .failedNoShareTargetEndpoint + case 13: self = .failedPairedKeyhandshake + case 14: self = .failedNullConnection + case 15: self = .failedNoPayload + case 16: self = .failedWriteIntroduction + case 17: self = .failedUnknownRemoteResponse + case 18: self = .failedNullConnectionInitOutgoing + case 19: self = .failedNullConnectionDisconnected + case 20: self = .failedNullConnectionLostConnectivity + case 21: self = .failedNullConnectionFailure + case 22: self = .rejectedAttachmentTransmissionStatus + case 23: self = .timedOutAttachmentTransmissionStatus + case 24: self = .notEnoughSpaceAttachmentTransmissionStatus + case 25: self = .unsupportedAttachmentTypeAttachmentTransmissionStatus + case 26: self = .failedUnknownRemoteResponseTransmissionStatus + case 27: self = .noResponseFrameConnectionClosedLostConnectivityTransmissionStatus + case 28: self = .noResponseFrameConnectionClosedTransmissionStatus + case 29: self = .lostConnectivityTransmissionStatus + case 30: self = .failedDisallowedMedium + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownAttachmentTransmissionStatus: return 0 + case .completeAttachmentTransmissionStatus: return 1 + case .canceledAttachmentTransmissionStatus: return 2 + case .failedAttachmentTransmissionStatus: return 3 + case .rejectedAttachment: return 4 + case .timedOutAttachment: return 5 + case .awaitingRemoteAcceptanceFailedAttachment: return 6 + case .notEnoughSpaceAttachment: return 7 + case .failedNoTransferUpdateCallback: return 8 + case .mediaUnavailableAttachment: return 9 + case .unsupportedAttachmentTypeAttachment: return 10 + case .noAttachmentFound: return 11 + case .failedNoShareTargetEndpoint: return 12 + case .failedPairedKeyhandshake: return 13 + case .failedNullConnection: return 14 + case .failedNoPayload: return 15 + case .failedWriteIntroduction: return 16 + case .failedUnknownRemoteResponse: return 17 + case .failedNullConnectionInitOutgoing: return 18 + case .failedNullConnectionDisconnected: return 19 + case .failedNullConnectionLostConnectivity: return 20 + case .failedNullConnectionFailure: return 21 + case .rejectedAttachmentTransmissionStatus: return 22 + case .timedOutAttachmentTransmissionStatus: return 23 + case .notEnoughSpaceAttachmentTransmissionStatus: return 24 + case .unsupportedAttachmentTypeAttachmentTransmissionStatus: return 25 + case .failedUnknownRemoteResponseTransmissionStatus: return 26 + case .noResponseFrameConnectionClosedLostConnectivityTransmissionStatus: return 27 + case .noResponseFrameConnectionClosedTransmissionStatus: return 28 + case .lostConnectivityTransmissionStatus: return 29 + case .failedDisallowedMedium: return 30 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_AttachmentTransmissionStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Generic result status of NearbyConnections API calls. +enum Location_Nearby_Proto_Sharing_ConnectionLayerStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// No status is available + case unknown // = 0 + + /// The operation was successful. + case success // = 1 + + /// The operation failed, without any more information. + case error // = 2 + + /// The app called an API method out of order (i.e. another method is expected + /// to be called first). + case outOfOrderApiCall // = 3 + + /// The app already has active operations (advertising, discovering, or + /// connected to other devices) with another Strategy. Stop these operations on + /// the current Strategy before trying to advertise or discover with a new + /// Strategy. + case alreadyHaveActiveStrategy // = 4 + + /// The app is already advertising; call StopAdvertising() before trying to + /// advertise again. + case alreadyAdvertising // = 5 + + /// The app is already discovering; call StopDiscovery() before trying to + /// discover again. + case alreadyDiscovering // = 6 + + /// NC is already listening for incoming connections from remote endpoints. + case alreadyListening // = 7 + + /// An attempt to read from/write to a connected remote endpoint failed. If + /// this occurs repeatedly, consider invoking DisconnectFromEndpoint(). + case endPointIoError // = 8 + + /// An attempt to interact with a remote endpoint failed because it's unknown + /// to us -- it's either an endpoint that was never discovered, or an endpoint + /// that never connected to us (both of which are indicative of bad input from + /// the client app). + case endPointUnknown // = 9 + + /// The remote endpoint rejected the connection request. + case connectionRejected // = 10 + + /// The app is already connected to the specified endpoint. Multiple + /// connections to a remote endpoint cannot be maintained simultaneously. + case alreadyConnectedToEndPoint // = 11 + + /// The remote endpoint is not connected; messages cannot be sent to it. + case notConnectedToEndPoint // = 12 + + /// There was an error trying to use the device's Bluetooth capabilities. + case bluetoothError // = 13 + + /// There was an error trying to use the device's Bluetooth Low Energy + /// capabilities. + case bleError // = 14 + + /// There was an error trying to use the device's Wi-Fi capabilities. + case wifiLanError // = 15 + + /// An attempt to interact with an in-flight Payload failed because it's + /// unknown to us. + case payloadUnknown // = 16 + + /// The connection was reset + case reset // = 17 + + /// The connection timed out + case timeout // = 18 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .success + case 2: self = .error + case 3: self = .outOfOrderApiCall + case 4: self = .alreadyHaveActiveStrategy + case 5: self = .alreadyAdvertising + case 6: self = .alreadyDiscovering + case 7: self = .alreadyListening + case 8: self = .endPointIoError + case 9: self = .endPointUnknown + case 10: self = .connectionRejected + case 11: self = .alreadyConnectedToEndPoint + case 12: self = .notConnectedToEndPoint + case 13: self = .bluetoothError + case 14: self = .bleError + case 15: self = .wifiLanError + case 16: self = .payloadUnknown + case 17: self = .reset + case 18: self = .timeout + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .success: return 1 + case .error: return 2 + case .outOfOrderApiCall: return 3 + case .alreadyHaveActiveStrategy: return 4 + case .alreadyAdvertising: return 5 + case .alreadyDiscovering: return 6 + case .alreadyListening: return 7 + case .endPointIoError: return 8 + case .endPointUnknown: return 9 + case .connectionRejected: return 10 + case .alreadyConnectedToEndPoint: return 11 + case .notConnectedToEndPoint: return 12 + case .bluetoothError: return 13 + case .bleError: return 14 + case .wifiLanError: return 15 + case .payloadUnknown: return 16 + case .reset: return 17 + case .timeout: return 18 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ConnectionLayerStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The status of processing attachments after receiver received payloads +/// successfully. +enum Location_Nearby_Proto_Sharing_ProcessReceivedAttachmentsStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case processingStatusUnknown // = 0 + case processingStatusCompleteProcessingAttachments // = 1 + case processingStatusFailedMovingFiles // = 2 + case processingStatusFailedReceivingApk // = 3 + case processingStatusFailedReceivingText // = 4 + case processingStatusFailedReceivingWifiCredentials // = 5 + + init() { + self = .processingStatusUnknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .processingStatusUnknown + case 1: self = .processingStatusCompleteProcessingAttachments + case 2: self = .processingStatusFailedMovingFiles + case 3: self = .processingStatusFailedReceivingApk + case 4: self = .processingStatusFailedReceivingText + case 5: self = .processingStatusFailedReceivingWifiCredentials + default: return nil + } + } + + var rawValue: Int { + switch self { + case .processingStatusUnknown: return 0 + case .processingStatusCompleteProcessingAttachments: return 1 + case .processingStatusFailedMovingFiles: return 2 + case .processingStatusFailedReceivingApk: return 3 + case .processingStatusFailedReceivingText: return 4 + case .processingStatusFailedReceivingWifiCredentials: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ProcessReceivedAttachmentsStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The status of advertising and discovering sessions. Used by +/// SCAN_FOR_SHARE_TARGETS and ADVERTISE_DEVICE_PRESENCE. +enum Location_Nearby_Proto_Sharing_SessionStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownSessionStatus // = 0 + case succeededSessionStatus // = 1 + + /// TODO: b/341782941 - FAILED_SESSION_STATUS occurs when the status of + /// advertising or discovering sessions is not successful. It can be + /// due to STATUS_INTERNAL_ERROR, STATUS_INTERRUPTION, STATUS_CANCELLED. + /// More session statuses should be logged to determine the status. + case failedSessionStatus // = 2 + + init() { + self = .unknownSessionStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownSessionStatus + case 1: self = .succeededSessionStatus + case 2: self = .failedSessionStatus + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownSessionStatus: return 0 + case .succeededSessionStatus: return 1 + case .failedSessionStatus: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_SessionStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// User's response to introductions. +enum Location_Nearby_Proto_Sharing_ResponseToIntroduction: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownResponseToIntroduction // = 0 + case acceptIntroduction // = 1 + case rejectIntroduction // = 2 + case failIntroduction // = 3 + + init() { + self = .unknownResponseToIntroduction + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownResponseToIntroduction + case 1: self = .acceptIntroduction + case 2: self = .rejectIntroduction + case 3: self = .failIntroduction + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownResponseToIntroduction: return 0 + case .acceptIntroduction: return 1 + case .rejectIntroduction: return 2 + case .failIntroduction: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ResponseToIntroduction: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// TODO(fdi): may eventually include desktop, etc. +/// The type of a remote device. +enum Location_Nearby_Proto_Sharing_DeviceType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownDeviceType // = 0 + case phone // = 1 + case tablet // = 2 + case laptop // = 3 + case car // = 4 + case foldable // = 5 + case xr // = 6 + + init() { + self = .unknownDeviceType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownDeviceType + case 1: self = .phone + case 2: self = .tablet + case 3: self = .laptop + case 4: self = .car + case 5: self = .foldable + case 6: self = .xr + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownDeviceType: return 0 + case .phone: return 1 + case .tablet: return 2 + case .laptop: return 3 + case .car: return 4 + case .foldable: return 5 + case .xr: return 6 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_DeviceType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// TODO(fdi): may eventually include windows, iOS, etc. +/// The OS type of a remote device. +enum Location_Nearby_Proto_Sharing_OSType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownOsType // = 0 + case android // = 1 + case chromeOs // = 2 + case ios // = 3 + case windows // = 4 + case macos // = 5 + + init() { + self = .unknownOsType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownOsType + case 1: self = .android + case 2: self = .chromeOs + case 3: self = .ios + case 4: self = .windows + case 5: self = .macos + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownOsType: return 0 + case .android: return 1 + case .chromeOs: return 2 + case .ios: return 3 + case .windows: return 4 + case .macos: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_OSType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Relationship of remote device to sender device. +enum Location_Nearby_Proto_Sharing_DeviceRelationship: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownDeviceRelationship // = 0 + + /// The remote device belongs to the same owner as sender device. + case isSelf // = 1 + + /// The remote device is a contact of sender. + case isContact // = 2 + + /// The remote device is a stranger. + case isStranger // = 3 + + init() { + self = .unknownDeviceRelationship + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownDeviceRelationship + case 1: self = .isSelf + case 2: self = .isContact + case 3: self = .isStranger + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownDeviceRelationship: return 0 + case .isSelf: return 1 + case .isContact: return 2 + case .isStranger: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_DeviceRelationship: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The device sources of the clearcut log. +enum Location_Nearby_Proto_Sharing_LogSource: SwiftProtobuf.Enum { + typealias RawValue = Int + case unspecifiedSource // = 0 + + /// Represents the devices in Nearby labs. + case labDevices // = 1 + + /// Represents the devices tested by Nearby engs, in the long term can include + /// any devices with newest feature flags. + case internalDevices // = 2 + + /// Represents the devices testing our in-development features before they're + /// released to the greater public. + case betaTesterDevices // = 3 + + /// Represents the OEM partners (like Samsung) that we're working with to + /// verify functionality on their devices. + case oemDevices // = 4 + + /// Represents the device for debugging. + case debugDevices // = 5 + + /// Represents the device for Nearby Module Food. + case nearbyModuleFoodDevices // = 6 + + /// Represents the device for BeTo Team Food. + case betoDogfoodDevices // = 7 + + /// Represents the device for Nearby dog Food. + case nearbyDogfoodDevices // = 8 + + /// Represents the device for Nearby Team Food. + case nearbyTeamfoodDevices // = 9 + + init() { + self = .unspecifiedSource + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unspecifiedSource + case 1: self = .labDevices + case 2: self = .internalDevices + case 3: self = .betaTesterDevices + case 4: self = .oemDevices + case 5: self = .debugDevices + case 6: self = .nearbyModuleFoodDevices + case 7: self = .betoDogfoodDevices + case 8: self = .nearbyDogfoodDevices + case 9: self = .nearbyTeamfoodDevices + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unspecifiedSource: return 0 + case .labDevices: return 1 + case .internalDevices: return 2 + case .betaTesterDevices: return 3 + case .oemDevices: return 4 + case .debugDevices: return 5 + case .nearbyModuleFoodDevices: return 6 + case .betoDogfoodDevices: return 7 + case .nearbyDogfoodDevices: return 8 + case .nearbyTeamfoodDevices: return 9 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_LogSource: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The Fast Share server action name. +enum Location_Nearby_Proto_Sharing_ServerActionName: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownServerAction // = 0 + case uploadCertificates // = 1 + case downloadCertificates // = 2 + case checkReachability // = 3 + case uploadContacts // = 4 + case updateDeviceName // = 5 + case uploadSenderCertificates // = 6 + case downloadSenderCertificates // = 7 + case uploadContactsAndCertificates // = 8 + case listReachablePhoneNumbers // = 9 + case listMyDevices // = 10 + case listContactPeople // = 11 + + /// used for analytics logger to record action name. + case downloadCertificatesInfo // = 12 + + init() { + self = .unknownServerAction + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownServerAction + case 1: self = .uploadCertificates + case 2: self = .downloadCertificates + case 3: self = .checkReachability + case 4: self = .uploadContacts + case 5: self = .updateDeviceName + case 6: self = .uploadSenderCertificates + case 7: self = .downloadSenderCertificates + case 8: self = .uploadContactsAndCertificates + case 9: self = .listReachablePhoneNumbers + case 10: self = .listMyDevices + case 11: self = .listContactPeople + case 12: self = .downloadCertificatesInfo + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownServerAction: return 0 + case .uploadCertificates: return 1 + case .downloadCertificates: return 2 + case .checkReachability: return 3 + case .uploadContacts: return 4 + case .updateDeviceName: return 5 + case .uploadSenderCertificates: return 6 + case .downloadSenderCertificates: return 7 + case .uploadContactsAndCertificates: return 8 + case .listReachablePhoneNumbers: return 9 + case .listMyDevices: return 10 + case .listContactPeople: return 11 + case .downloadCertificatesInfo: return 12 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ServerActionName: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The Fast Share server response state. +enum Location_Nearby_Proto_Sharing_ServerResponseState: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownServerResponseState // = 0 + case serverResponseSuccess // = 1 + case serverResponseUnknownFailure // = 2 + + /// For StatusException. + case serverResponseStatusOtherFailure // = 3 + case serverResponseStatusDeadlineExceeded // = 4 + case serverResponseStatusPermissionDenied // = 5 + case serverResponseStatusUnavailable // = 6 + case serverResponseStatusUnauthenticated // = 7 + case serverResponseStatusInvalidArgument // = 9 + + /// For GoogleAuthException. + case serverResponseGoogleAuthFailure // = 8 + + /// For Internet connect status. + case serverResponseNotConnectedToInternet // = 10 + + init() { + self = .unknownServerResponseState + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownServerResponseState + case 1: self = .serverResponseSuccess + case 2: self = .serverResponseUnknownFailure + case 3: self = .serverResponseStatusOtherFailure + case 4: self = .serverResponseStatusDeadlineExceeded + case 5: self = .serverResponseStatusPermissionDenied + case 6: self = .serverResponseStatusUnavailable + case 7: self = .serverResponseStatusUnauthenticated + case 8: self = .serverResponseGoogleAuthFailure + case 9: self = .serverResponseStatusInvalidArgument + case 10: self = .serverResponseNotConnectedToInternet + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownServerResponseState: return 0 + case .serverResponseSuccess: return 1 + case .serverResponseUnknownFailure: return 2 + case .serverResponseStatusOtherFailure: return 3 + case .serverResponseStatusDeadlineExceeded: return 4 + case .serverResponseStatusPermissionDenied: return 5 + case .serverResponseStatusUnavailable: return 6 + case .serverResponseStatusUnauthenticated: return 7 + case .serverResponseGoogleAuthFailure: return 8 + case .serverResponseStatusInvalidArgument: return 9 + case .serverResponseNotConnectedToInternet: return 10 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ServerResponseState: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The purpose of requesting the server request. +enum Location_Nearby_Proto_Sharing_SyncPurpose: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + + /// When NearbySharingChimeraService#sync() is called. + case onDemandSync // = 1 + + /// Requested by chime notification. + case chimeNotification // = 2 + + /// For reqular daily sync. + case dailySync // = 3 + + /// Wen a device opts into Nearby Share. + case optInFirstSync // = 4 + + /// Requested when Nearby Share automatically enables a device that shares + /// a single account that has already opted in on another device. + case checkDefaultOptIn // = 5 + + /// When a device enables Nearby Share. + case nearbyShareEnabled // = 6 + + /// When a device is in fast init advertising. + case syncAtFastInit // = 7 + + /// When device start discovery. + case syncAtDiscovery // = 8 + + /// When device tries to load valid private certificate. + case syncAtLoadPrivateCertificate // = 9 + + /// When device start advertiseement. + case syncAtAdvertisement // = 10 + + /// When device contacts list changes. + case contactListChange // = 11 + + /// When showing the C11 banner in Neary Share setting. + case showC11NView // = 12 + + /// For regular check contact reachability. + case regularCheckContactReachability // = 13 + + /// When selected contacts list changes in visibility setting. + case visibilitySelectedContactChange // = 14 + + /// When switching account. + case accountChange // = 15 + + /// When regenerate certificates + case regenerateCertificates // = 16 + + /// When Device Contacts consent changes + case deviceContactsConsentChange // = 17 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .onDemandSync + case 2: self = .chimeNotification + case 3: self = .dailySync + case 4: self = .optInFirstSync + case 5: self = .checkDefaultOptIn + case 6: self = .nearbyShareEnabled + case 7: self = .syncAtFastInit + case 8: self = .syncAtDiscovery + case 9: self = .syncAtLoadPrivateCertificate + case 10: self = .syncAtAdvertisement + case 11: self = .contactListChange + case 12: self = .showC11NView + case 13: self = .regularCheckContactReachability + case 14: self = .visibilitySelectedContactChange + case 15: self = .accountChange + case 16: self = .regenerateCertificates + case 17: self = .deviceContactsConsentChange + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .onDemandSync: return 1 + case .chimeNotification: return 2 + case .dailySync: return 3 + case .optInFirstSync: return 4 + case .checkDefaultOptIn: return 5 + case .nearbyShareEnabled: return 6 + case .syncAtFastInit: return 7 + case .syncAtDiscovery: return 8 + case .syncAtLoadPrivateCertificate: return 9 + case .syncAtAdvertisement: return 10 + case .contactListChange: return 11 + case .showC11NView: return 12 + case .regularCheckContactReachability: return 13 + case .visibilitySelectedContactChange: return 14 + case .accountChange: return 15 + case .regenerateCertificates: return 16 + case .deviceContactsConsentChange: return 17 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_SyncPurpose: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The device role to trigger the server request. +enum Location_Nearby_Proto_Sharing_ClientRole: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case sender // = 1 + case receiver // = 2 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .sender + case 2: self = .receiver + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .sender: return 1 + case .receiver: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ClientRole: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The type of Nearby Sharing scanning. +enum Location_Nearby_Proto_Sharing_ScanType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownScanType // = 0 + case foregroundScan // = 1 + case foregroundRetryScan // = 2 + case directShareScan // = 3 + case backgroundScan // = 4 + + init() { + self = .unknownScanType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownScanType + case 1: self = .foregroundScan + case 2: self = .foregroundRetryScan + case 3: self = .directShareScan + case 4: self = .backgroundScan + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownScanType: return 0 + case .foregroundScan: return 1 + case .foregroundRetryScan: return 2 + case .directShareScan: return 3 + case .backgroundScan: return 4 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ScanType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The type of parsing endpoint id failed type. +enum Location_Nearby_Proto_Sharing_ParsingFailedType: SwiftProtobuf.Enum { + typealias RawValue = Int + case failedUnknownType // = 0 + + /// NULL advertisement is returned due to sender failing to parse advertisement + /// from endpointInfo byte stream from receiver advertisement. + case failedParseAdvertisement // = 1 + + /// NULL shareTarget is returned due to sender failing to create shareTarget + /// from a valid parsed advertisement stemming from issues in certificates, QR + /// code tokens or device names. + case failedConvertShareTarget // = 2 + + init() { + self = .failedUnknownType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .failedUnknownType + case 1: self = .failedParseAdvertisement + case 2: self = .failedConvertShareTarget + default: return nil + } + } + + var rawValue: Int { + switch self { + case .failedUnknownType: return 0 + case .failedParseAdvertisement: return 1 + case .failedConvertShareTarget: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ParsingFailedType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The Nearby Sharing advertising mode. +enum Location_Nearby_Proto_Sharing_AdvertisingMode: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownAdvertisingMode // = 0 + case screenOffAdvertisingMode // = 1 + case backgroundAdvertisingMode // = 2 + case midgroundAdvertisingMode // = 3 + case foregroundAdvertisingMode // = 4 + case suspendedAdvertisingMode // = 5 + + init() { + self = .unknownAdvertisingMode + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownAdvertisingMode + case 1: self = .screenOffAdvertisingMode + case 2: self = .backgroundAdvertisingMode + case 3: self = .midgroundAdvertisingMode + case 4: self = .foregroundAdvertisingMode + case 5: self = .suspendedAdvertisingMode + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownAdvertisingMode: return 0 + case .screenOffAdvertisingMode: return 1 + case .backgroundAdvertisingMode: return 2 + case .midgroundAdvertisingMode: return 3 + case .foregroundAdvertisingMode: return 4 + case .suspendedAdvertisingMode: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_AdvertisingMode: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The Nearby Sharing discovery mode. +enum Location_Nearby_Proto_Sharing_DiscoveryMode: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownDiscoveryMode // = 0 + case screenOffDiscoveryMode // = 1 + case backgroundDiscoveryMode // = 2 + case midgroundDiscoveryMode // = 3 + case foregroundDiscoveryMode // = 4 + case suspendedDiscoveryMode // = 5 + + init() { + self = .unknownDiscoveryMode + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownDiscoveryMode + case 1: self = .screenOffDiscoveryMode + case 2: self = .backgroundDiscoveryMode + case 3: self = .midgroundDiscoveryMode + case 4: self = .foregroundDiscoveryMode + case 5: self = .suspendedDiscoveryMode + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownDiscoveryMode: return 0 + case .screenOffDiscoveryMode: return 1 + case .backgroundDiscoveryMode: return 2 + case .midgroundDiscoveryMode: return 3 + case .foregroundDiscoveryMode: return 4 + case .suspendedDiscoveryMode: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_DiscoveryMode: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The class name of chimera activity. +enum Location_Nearby_Proto_Sharing_ActivityName: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownActivity // = 0 + case shareSheetActivity // = 1 + case settingsActivity // = 2 + case receiveSurfaceActivity // = 3 + case setupActivity // = 4 + case deviceVisibilityActivity // = 5 + case consentsActivity // = 6 + case setDeviceNameDialog // = 7 + case setDataUsageDialog // = 8 + case quickSettingsActivity // = 9 + case remoteCopyShareSheetActivity // = 10 + case setupWizardActivity // = 11 + case settingsReviewActivity // = 12 + + init() { + self = .unknownActivity + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownActivity + case 1: self = .shareSheetActivity + case 2: self = .settingsActivity + case 3: self = .receiveSurfaceActivity + case 4: self = .setupActivity + case 5: self = .deviceVisibilityActivity + case 6: self = .consentsActivity + case 7: self = .setDeviceNameDialog + case 8: self = .setDataUsageDialog + case 9: self = .quickSettingsActivity + case 10: self = .remoteCopyShareSheetActivity + case 11: self = .setupWizardActivity + case 12: self = .settingsReviewActivity + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownActivity: return 0 + case .shareSheetActivity: return 1 + case .settingsActivity: return 2 + case .receiveSurfaceActivity: return 3 + case .setupActivity: return 4 + case .deviceVisibilityActivity: return 5 + case .consentsActivity: return 6 + case .setDeviceNameDialog: return 7 + case .setDataUsageDialog: return 8 + case .quickSettingsActivity: return 9 + case .remoteCopyShareSheetActivity: return 10 + case .setupWizardActivity: return 11 + case .settingsReviewActivity: return 12 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ActivityName: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The type of consent page user launches. +enum Location_Nearby_Proto_Sharing_ConsentType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + + /// launch Constellation consent page. + case c11N // = 1 + + /// launch device contact consent page. + case deviceContact // = 2 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .c11N + case 2: self = .deviceContact + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .c11N: return 1 + case .deviceContact: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ConsentType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_ConsentAcceptanceStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case consentUnknownAcceptStatus // = 0 + case consentAccepted // = 1 + case consentDeclined // = 2 + + /// unable to enable consent. + case consentUnableToEnable // = 3 + + init() { + self = .consentUnknownAcceptStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .consentUnknownAcceptStatus + case 1: self = .consentAccepted + case 2: self = .consentDeclined + case 3: self = .consentUnableToEnable + default: return nil + } + } + + var rawValue: Int { + switch self { + case .consentUnknownAcceptStatus: return 0 + case .consentAccepted: return 1 + case .consentDeclined: return 2 + case .consentUnableToEnable: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ConsentAcceptanceStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_ApkSource: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownApkSource // = 0 + case apkFromSdCard // = 1 + case installedApp // = 2 + + init() { + self = .unknownApkSource + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownApkSource + case 1: self = .apkFromSdCard + case 2: self = .installedApp + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownApkSource: return 0 + case .apkFromSdCard: return 1 + case .installedApp: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ApkSource: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The Installation status of APK. +enum Location_Nearby_Proto_Sharing_InstallAPKStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownInstallApkStatus // = 0 + case failInstallation // = 1 + case successInstallation // = 2 + + init() { + self = .unknownInstallApkStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownInstallApkStatus + case 1: self = .failInstallation + case 2: self = .successInstallation + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownInstallApkStatus: return 0 + case .failInstallation: return 1 + case .successInstallation: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_InstallAPKStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The verification status of APK. +enum Location_Nearby_Proto_Sharing_VerifyAPKStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownVerifyApkStatus // = 0 + case notInstallable // = 1 + case installable // = 2 + case alreadyInstalled // = 3 + + init() { + self = .unknownVerifyApkStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownVerifyApkStatus + case 1: self = .notInstallable + case 2: self = .installable + case 3: self = .alreadyInstalled + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownVerifyApkStatus: return 0 + case .notInstallable: return 1 + case .installable: return 2 + case .alreadyInstalled: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_VerifyAPKStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_ShowNotificationStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownShowNotificationStatus // = 0 + case show // = 1 + case notShow // = 2 + + init() { + self = .unknownShowNotificationStatus + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownShowNotificationStatus + case 1: self = .show + case 2: self = .notShow + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownShowNotificationStatus: return 0 + case .show: return 1 + case .notShow: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ShowNotificationStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_PermissionRequestResult: SwiftProtobuf.Enum { + typealias RawValue = Int + case permissionUnknownRequestResult // = 0 + case permissionGranted // = 1 + case permissionRejected // = 2 + case permissionUnableToGrant // = 3 + + init() { + self = .permissionUnknownRequestResult + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .permissionUnknownRequestResult + case 1: self = .permissionGranted + case 2: self = .permissionRejected + case 3: self = .permissionUnableToGrant + default: return nil + } + } + + var rawValue: Int { + switch self { + case .permissionUnknownRequestResult: return 0 + case .permissionGranted: return 1 + case .permissionRejected: return 2 + case .permissionUnableToGrant: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_PermissionRequestResult: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_PermissionRequestType: SwiftProtobuf.Enum { + typealias RawValue = Int + case permissionUnknownType // = 0 + case permissionAirplaneModeOff // = 1 + case permissionWifi // = 2 + case permissionBluetooth // = 3 + case permissionLocation // = 4 + case permissionWifiHotspot // = 5 + + init() { + self = .permissionUnknownType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .permissionUnknownType + case 1: self = .permissionAirplaneModeOff + case 2: self = .permissionWifi + case 3: self = .permissionBluetooth + case 4: self = .permissionLocation + case 5: self = .permissionWifiHotspot + default: return nil + } + } + + var rawValue: Int { + switch self { + case .permissionUnknownType: return 0 + case .permissionAirplaneModeOff: return 1 + case .permissionWifi: return 2 + case .permissionBluetooth: return 3 + case .permissionLocation: return 4 + case .permissionWifiHotspot: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_PermissionRequestType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_SharingUseCase: SwiftProtobuf.Enum { + typealias RawValue = Int + case useCaseUnknown // = 0 + case useCaseNearbyShare // = 1 + case useCaseRemoteCopyPaste // = 2 + case useCaseWifiCredential // = 3 + case useCaseAppShare // = 4 + case useCaseQuickSettingFileShare // = 5 + case useCaseSetupWizard // = 6 + + /// Deprecated. QR code is an addition to existing use cases rather than being + /// a separate use case. + case useCaseNearbyShareWithQrCode // = 7 + + /// The user was redirected from Bluetooth sharing UI to Nearby Share + case useCaseRedirectedFromBluetoothShare // = 8 + + init() { + self = .useCaseUnknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .useCaseUnknown + case 1: self = .useCaseNearbyShare + case 2: self = .useCaseRemoteCopyPaste + case 3: self = .useCaseWifiCredential + case 4: self = .useCaseAppShare + case 5: self = .useCaseQuickSettingFileShare + case 6: self = .useCaseSetupWizard + case 7: self = .useCaseNearbyShareWithQrCode + case 8: self = .useCaseRedirectedFromBluetoothShare + default: return nil + } + } + + var rawValue: Int { + switch self { + case .useCaseUnknown: return 0 + case .useCaseNearbyShare: return 1 + case .useCaseRemoteCopyPaste: return 2 + case .useCaseWifiCredential: return 3 + case .useCaseAppShare: return 4 + case .useCaseQuickSettingFileShare: return 5 + case .useCaseSetupWizard: return 6 + case .useCaseNearbyShareWithQrCode: return 7 + case .useCaseRedirectedFromBluetoothShare: return 8 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_SharingUseCase: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Used only for Windows App now. +enum Location_Nearby_Proto_Sharing_AppCrashReason: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_AppCrashReason: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Thes source where the attachemnt comes from. It can be an action, app name, +/// etc. The first 6 source types are being used as FileSenderType in Nearby +/// Share Windows app. +enum Location_Nearby_Proto_Sharing_AttachmentSourceType: SwiftProtobuf.Enum { + typealias RawValue = Int + case attachmentSourceUnknown // = 0 + case attachmentSourceContextMenu // = 1 + case attachmentSourceDragAndDrop // = 2 + case attachmentSourceSelectFilesButton // = 3 + case attachmentSourcePaste // = 4 + case attachmentSourceSelectFoldersButton // = 5 + case attachmentSourceShareActivation // = 6 + + init() { + self = .attachmentSourceUnknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .attachmentSourceUnknown + case 1: self = .attachmentSourceContextMenu + case 2: self = .attachmentSourceDragAndDrop + case 3: self = .attachmentSourceSelectFilesButton + case 4: self = .attachmentSourcePaste + case 5: self = .attachmentSourceSelectFoldersButton + case 6: self = .attachmentSourceShareActivation + default: return nil + } + } + + var rawValue: Int { + switch self { + case .attachmentSourceUnknown: return 0 + case .attachmentSourceContextMenu: return 1 + case .attachmentSourceDragAndDrop: return 2 + case .attachmentSourceSelectFilesButton: return 3 + case .attachmentSourcePaste: return 4 + case .attachmentSourceSelectFoldersButton: return 5 + case .attachmentSourceShareActivation: return 6 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_AttachmentSourceType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The action to interact with preferences. +/// Used only for Windows App now. +enum Location_Nearby_Proto_Sharing_PreferencesAction: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case noAction // = 1 + + /// Primary actions/functions towards preferences + case loadPreferences // = 2 + case savePreferencess // = 3 + case attemptLoad // = 4 + case restoreFromBackup // = 5 + + /// Other actions within the 4 actions above + case createPreferencesPath // = 6 + case makePreferencesBackupFile // = 7 + case checkIfPreferencesPathExists // = 8 + case checkIfPreferencesInputStreamStatus // = 9 + case checkIfPreferencesFileIsCorrupted // = 10 + case checkIfPreferencesBackupFileExists // = 11 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .noAction + case 2: self = .loadPreferences + case 3: self = .savePreferencess + case 4: self = .attemptLoad + case 5: self = .restoreFromBackup + case 6: self = .createPreferencesPath + case 7: self = .makePreferencesBackupFile + case 8: self = .checkIfPreferencesPathExists + case 9: self = .checkIfPreferencesInputStreamStatus + case 10: self = .checkIfPreferencesFileIsCorrupted + case 11: self = .checkIfPreferencesBackupFileExists + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .noAction: return 1 + case .loadPreferences: return 2 + case .savePreferencess: return 3 + case .attemptLoad: return 4 + case .restoreFromBackup: return 5 + case .createPreferencesPath: return 6 + case .makePreferencesBackupFile: return 7 + case .checkIfPreferencesPathExists: return 8 + case .checkIfPreferencesInputStreamStatus: return 9 + case .checkIfPreferencesFileIsCorrupted: return 10 + case .checkIfPreferencesBackupFileExists: return 11 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_PreferencesAction: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// The status of the action to interact with preferences. +/// Used only for Windows App now. +enum Location_Nearby_Proto_Sharing_PreferencesActionStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case success // = 1 + case fail // = 2 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .success + case 2: self = .fail + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .success: return 1 + case .fail: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_PreferencesActionStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +///* The distance of the found nearby fast init advertisement. +enum Location_Nearby_Proto_Sharing_FastInitState: SwiftProtobuf.Enum { + typealias RawValue = Int + case fastInitUnknownState // = 0 + + /// A device was found in close proximity. + /// distance < fast_init_distance_close_centimeters(50 cm) + case fastInitCloseState // = 1 + + /// A device was found in far proximity. + /// distance < fast_init_distance_close_centimeters(10 m) + case fastInitFarState // = 2 + + /// No devices have been found nearby. The default state. + case fastInitLostState // = 3 + + init() { + self = .fastInitUnknownState + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .fastInitUnknownState + case 1: self = .fastInitCloseState + case 2: self = .fastInitFarState + case 3: self = .fastInitLostState + default: return nil + } + } + + var rawValue: Int { + switch self { + case .fastInitUnknownState: return 0 + case .fastInitCloseState: return 1 + case .fastInitFarState: return 2 + case .fastInitLostState: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_FastInitState: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +///* The type of FastInit advertisement. +enum Location_Nearby_Proto_Sharing_FastInitType: SwiftProtobuf.Enum { + typealias RawValue = Int + case fastInitUnknownType // = 0 + + /// Show HUN to notify the user. + case fastInitNotifyType // = 1 + + /// Not notify the user. + case fastInitSilentType // = 2 + + init() { + self = .fastInitUnknownType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .fastInitUnknownType + case 1: self = .fastInitNotifyType + case 2: self = .fastInitSilentType + default: return nil + } + } + + var rawValue: Int { + switch self { + case .fastInitUnknownType: return 0 + case .fastInitNotifyType: return 1 + case .fastInitSilentType: return 2 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_FastInitType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +///* The type of desktop notification event. +enum Location_Nearby_Proto_Sharing_DesktopNotification: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case connecting // = 1 + case progress // = 2 + case accept // = 3 + case received // = 4 + case error // = 5 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .connecting + case 2: self = .progress + case 3: self = .accept + case 4: self = .received + case 5: self = .error + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .connecting: return 1 + case .progress: return 2 + case .accept: return 3 + case .received: return 4 + case .error: return 5 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_DesktopNotification: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_DesktopTransferEventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + + /// Receive attachments. + case desktopTransferEventReceiveTypeAccept // = 1 + case desktopTransferEventReceiveTypeProgress // = 2 + case desktopTransferEventReceiveTypeReceived // = 3 + case desktopTransferEventReceiveTypeError // = 4 + + /// Send attachments. + case desktopTransferEventSendTypeStart // = 5 + case desktopTransferEventSendTypeSelectADevice // = 6 + case desktopTransferEventSendTypeProgress // = 7 + case desktopTransferEventSendTypeSent // = 8 + case desktopTransferEventSendTypeError // = 9 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .desktopTransferEventReceiveTypeAccept + case 2: self = .desktopTransferEventReceiveTypeProgress + case 3: self = .desktopTransferEventReceiveTypeReceived + case 4: self = .desktopTransferEventReceiveTypeError + case 5: self = .desktopTransferEventSendTypeStart + case 6: self = .desktopTransferEventSendTypeSelectADevice + case 7: self = .desktopTransferEventSendTypeProgress + case 8: self = .desktopTransferEventSendTypeSent + case 9: self = .desktopTransferEventSendTypeError + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .desktopTransferEventReceiveTypeAccept: return 1 + case .desktopTransferEventReceiveTypeProgress: return 2 + case .desktopTransferEventReceiveTypeReceived: return 3 + case .desktopTransferEventReceiveTypeError: return 4 + case .desktopTransferEventSendTypeStart: return 5 + case .desktopTransferEventSendTypeSelectADevice: return 6 + case .desktopTransferEventSendTypeProgress: return 7 + case .desktopTransferEventSendTypeSent: return 8 + case .desktopTransferEventSendTypeError: return 9 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_DesktopTransferEventType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_DecryptCertificateFailureStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case decryptCertUnknownFailure // = 0 + case decryptCertNoSuchAlgorithmFailure // = 1 + case decryptCertNoSuchPaddingFailure // = 2 + case decryptCertInvalidKeyFailure // = 3 + case decryptCertInvalidAlgorithmParameterFailure // = 4 + case decryptCertIllegalBlockSizeFailure // = 5 + case decryptCertBadPaddingFailure // = 6 + + init() { + self = .decryptCertUnknownFailure + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .decryptCertUnknownFailure + case 1: self = .decryptCertNoSuchAlgorithmFailure + case 2: self = .decryptCertNoSuchPaddingFailure + case 3: self = .decryptCertInvalidKeyFailure + case 4: self = .decryptCertInvalidAlgorithmParameterFailure + case 5: self = .decryptCertIllegalBlockSizeFailure + case 6: self = .decryptCertBadPaddingFailure + default: return nil + } + } + + var rawValue: Int { + switch self { + case .decryptCertUnknownFailure: return 0 + case .decryptCertNoSuchAlgorithmFailure: return 1 + case .decryptCertNoSuchPaddingFailure: return 2 + case .decryptCertInvalidKeyFailure: return 3 + case .decryptCertInvalidAlgorithmParameterFailure: return 4 + case .decryptCertIllegalBlockSizeFailure: return 5 + case .decryptCertBadPaddingFailure: return 6 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_DecryptCertificateFailureStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Refer to go/qs-contacts-consent-2024 for the detail. +enum Location_Nearby_Proto_Sharing_ContactAccess: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case noContactUploaded // = 1 + case onlyUploadGoogleContact // = 2 + case uploadContactForDeviceContactConsent // = 3 + case uploadContactForQuickShareConsent // = 4 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .noContactUploaded + case 2: self = .onlyUploadGoogleContact + case 3: self = .uploadContactForDeviceContactConsent + case 4: self = .uploadContactForQuickShareConsent + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .noContactUploaded: return 1 + case .onlyUploadGoogleContact: return 2 + case .uploadContactForDeviceContactConsent: return 3 + case .uploadContactForQuickShareConsent: return 4 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ContactAccess: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Refer to go/qs-contacts-consent-2024 for the detail. +enum Location_Nearby_Proto_Sharing_IdentityVerification: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case noPhoneNumberVerified // = 1 + case phoneNumberVerifiedNotLinkedToGaia // = 2 + case phoneNumberVerifiedLinkedToQsGaia // = 3 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .noPhoneNumberVerified + case 2: self = .phoneNumberVerifiedNotLinkedToGaia + case 3: self = .phoneNumberVerifiedLinkedToQsGaia + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .noPhoneNumberVerified: return 1 + case .phoneNumberVerifiedNotLinkedToGaia: return 2 + case .phoneNumberVerifiedLinkedToQsGaia: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_IdentityVerification: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +enum Location_Nearby_Proto_Sharing_ButtonStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case clickAccept // = 1 + case clickReject // = 2 + case ignore // = 3 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .clickAccept + case 2: self = .clickReject + case 3: self = .ignore + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .clickAccept: return 1 + case .clickReject: return 2 + case .ignore: return 3 + } + } + +} + +#if swift(>=4.2) + +extension Location_Nearby_Proto_Sharing_ButtonStatus: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +#if swift(>=5.5) && canImport(_Concurrency) +extension Location_Nearby_Proto_Sharing_EventType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_EventCategory: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_NearbySharingStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_Visibility: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_DataUsage: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_EstablishConnectionStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_AttachmentTransmissionStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ConnectionLayerStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ProcessReceivedAttachmentsStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_SessionStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ResponseToIntroduction: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_DeviceType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_OSType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_DeviceRelationship: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_LogSource: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ServerActionName: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ServerResponseState: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_SyncPurpose: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ClientRole: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ScanType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ParsingFailedType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_AdvertisingMode: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_DiscoveryMode: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ActivityName: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ConsentType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ConsentAcceptanceStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ApkSource: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_InstallAPKStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_VerifyAPKStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ShowNotificationStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_PermissionRequestResult: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_PermissionRequestType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_SharingUseCase: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_AppCrashReason: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_AttachmentSourceType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_PreferencesAction: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_PreferencesActionStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_FastInitState: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_FastInitType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_DesktopNotification: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_DesktopTransferEventType: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_DecryptCertificateFailureStatus: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ContactAccess: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_IdentityVerification: @unchecked Sendable {} +extension Location_Nearby_Proto_Sharing_ButtonStatus: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +extension Location_Nearby_Proto_Sharing_EventType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_EVENT_TYPE"), + 1: .same(proto: "ACCEPT_AGREEMENTS"), + 2: .same(proto: "ENABLE_NEARBY_SHARING"), + 3: .same(proto: "SET_VISIBILITY"), + 4: .same(proto: "DESCRIBE_ATTACHMENTS"), + 5: .same(proto: "SCAN_FOR_SHARE_TARGETS_START"), + 6: .same(proto: "SCAN_FOR_SHARE_TARGETS_END"), + 7: .same(proto: "ADVERTISE_DEVICE_PRESENCE_START"), + 8: .same(proto: "ADVERTISE_DEVICE_PRESENCE_END"), + 9: .same(proto: "SEND_FAST_INITIALIZATION"), + 10: .same(proto: "RECEIVE_FAST_INITIALIZATION"), + 11: .same(proto: "DISCOVER_SHARE_TARGET"), + 12: .same(proto: "SEND_INTRODUCTION"), + 13: .same(proto: "RECEIVE_INTRODUCTION"), + 14: .same(proto: "RESPOND_TO_INTRODUCTION"), + 15: .same(proto: "SEND_ATTACHMENTS_START"), + 16: .same(proto: "SEND_ATTACHMENTS_END"), + 17: .same(proto: "RECEIVE_ATTACHMENTS_START"), + 18: .same(proto: "RECEIVE_ATTACHMENTS_END"), + 19: .same(proto: "CANCEL_SENDING_ATTACHMENTS"), + 20: .same(proto: "CANCEL_RECEIVING_ATTACHMENTS"), + 21: .same(proto: "OPEN_RECEIVED_ATTACHMENTS"), + 22: .same(proto: "LAUNCH_SETUP_ACTIVITY"), + 23: .same(proto: "ADD_CONTACT"), + 24: .same(proto: "REMOVE_CONTACT"), + 25: .same(proto: "FAST_SHARE_SERVER_RESPONSE"), + 26: .same(proto: "SEND_START"), + 27: .same(proto: "ACCEPT_FAST_INITIALIZATION"), + 28: .same(proto: "SET_DATA_USAGE"), + 29: .same(proto: "DISMISS_FAST_INITIALIZATION"), + 30: .same(proto: "CANCEL_CONNECTION"), + 31: .same(proto: "LAUNCH_ACTIVITY"), + 32: .same(proto: "DISMISS_PRIVACY_NOTIFICATION"), + 33: .same(proto: "TAP_PRIVACY_NOTIFICATION"), + 34: .same(proto: "TAP_HELP"), + 35: .same(proto: "TAP_FEEDBACK"), + 36: .same(proto: "ADD_QUICK_SETTINGS_TILE"), + 37: .same(proto: "REMOVE_QUICK_SETTINGS_TILE"), + 38: .same(proto: "LAUNCH_PHONE_CONSENT"), + 39: .same(proto: "TAP_QUICK_SETTINGS_TILE"), + 40: .same(proto: "INSTALL_APK"), + 41: .same(proto: "VERIFY_APK"), + 42: .same(proto: "LAUNCH_CONSENT"), + 43: .same(proto: "PROCESS_RECEIVED_ATTACHMENTS_END"), + 44: .same(proto: "TOGGLE_SHOW_NOTIFICATION"), + 45: .same(proto: "SET_DEVICE_NAME"), + 46: .same(proto: "DECLINE_AGREEMENTS"), + 47: .same(proto: "REQUEST_SETTING_PERMISSIONS"), + 48: .same(proto: "ESTABLISH_CONNECTION"), + 49: .same(proto: "DEVICE_SETTINGS"), + 50: .same(proto: "AUTO_DISMISS_FAST_INITIALIZATION"), + 51: .same(proto: "APP_CRASH"), + 52: .same(proto: "TAP_QUICK_SETTINGS_FILE_SHARE"), + 53: .same(proto: "DISPLAY_PRIVACY_NOTIFICATION"), + 54: .same(proto: "DISPLAY_PHONE_CONSENT"), + 55: .same(proto: "PREFERENCES_USAGE"), + 56: .same(proto: "DEFAULT_OPT_IN"), + 57: .same(proto: "SETUP_WIZARD"), + 58: .same(proto: "TAP_QR_CODE"), + 59: .same(proto: "QR_CODE_LINK_SHOWN"), + 60: .same(proto: "PARSING_FAILED_ENDPOINT_ID"), + 61: .same(proto: "FAST_INIT_DISCOVER_DEVICE"), + 62: .same(proto: "SEND_DESKTOP_NOTIFICATION"), + 63: .same(proto: "SET_ACCOUNT"), + 64: .same(proto: "DECRYPT_CERTIFICATE_FAILURE"), + 65: .same(proto: "SHOW_ALLOW_PERMISSION_AUTO_ACCESS"), + 66: .same(proto: "SEND_DESKTOP_TRANSFER_EVENT"), + 67: .same(proto: "WAITING_FOR_ACCEPT"), + 68: .same(proto: "HIGH_QUALITY_MEDIUM_SETUP"), + 69: .same(proto: "RPC_CALL_STATUS"), + 70: .same(proto: "START_QR_CODE_SESSION"), + 71: .same(proto: "QR_CODE_OPENED_IN_WEB_CLIENT"), + 72: .same(proto: "HATS_JOINT_EVENT"), + 73: .same(proto: "RECEIVE_PREVIEWS"), + ] +} + +extension Location_Nearby_Proto_Sharing_EventCategory: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_EVENT_CATEGORY"), + 1: .same(proto: "SENDING_EVENT"), + 2: .same(proto: "RECEIVING_EVENT"), + 3: .same(proto: "SETTINGS_EVENT"), + 4: .same(proto: "RPC_EVENT"), + ] +} + +extension Location_Nearby_Proto_Sharing_NearbySharingStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_NEARBY_SHARING_STATUS"), + 1: .same(proto: "ON"), + 2: .same(proto: "OFF"), + ] +} + +extension Location_Nearby_Proto_Sharing_Visibility: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_VISIBILITY"), + 1: .same(proto: "CONTACTS_ONLY"), + 2: .same(proto: "EVERYONE"), + 3: .same(proto: "SELECTED_CONTACTS_ONLY"), + 4: .same(proto: "HIDDEN"), + 5: .same(proto: "SELF_SHARE"), + ] +} + +extension Location_Nearby_Proto_Sharing_DataUsage: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_DATA_USAGE"), + 1: .same(proto: "ONLINE"), + 2: .same(proto: "WIFI_ONLY"), + 3: .same(proto: "OFFLINE"), + ] +} + +extension Location_Nearby_Proto_Sharing_EstablishConnectionStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CONNECTION_STATUS_UNKNOWN"), + 1: .same(proto: "CONNECTION_STATUS_SUCCESS"), + 2: .same(proto: "CONNECTION_STATUS_FAILURE"), + 3: .same(proto: "CONNECTION_STATUS_CANCELLATION"), + 4: .same(proto: "CONNECTION_STATUS_MEDIA_UNAVAILABLE_ATTACHMENT"), + 5: .same(proto: "CONNECTION_STATUS_FAILED_PAIRED_KEYHANDSHAKE"), + 6: .same(proto: "CONNECTION_STATUS_FAILED_WRITE_INTRODUCTION"), + 7: .same(proto: "CONNECTION_STATUS_FAILED_NULL_CONNECTION"), + 8: .same(proto: "CONNECTION_STATUS_FAILED_NO_TRANSFER_UPDATE_CALLBACK"), + 9: .same(proto: "CONNECTION_STATUS_LOST_CONNECTIVITY"), + 10: .same(proto: "CONNECTION_STATUS_INVALID_ADVERTISEMENT"), + ] +} + +extension Location_Nearby_Proto_Sharing_AttachmentTransmissionStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_ATTACHMENT_TRANSMISSION_STATUS"), + 1: .same(proto: "COMPLETE_ATTACHMENT_TRANSMISSION_STATUS"), + 2: .same(proto: "CANCELED_ATTACHMENT_TRANSMISSION_STATUS"), + 3: .same(proto: "FAILED_ATTACHMENT_TRANSMISSION_STATUS"), + 4: .same(proto: "REJECTED_ATTACHMENT"), + 5: .same(proto: "TIMED_OUT_ATTACHMENT"), + 6: .same(proto: "AWAITING_REMOTE_ACCEPTANCE_FAILED_ATTACHMENT"), + 7: .same(proto: "NOT_ENOUGH_SPACE_ATTACHMENT"), + 8: .same(proto: "FAILED_NO_TRANSFER_UPDATE_CALLBACK"), + 9: .same(proto: "MEDIA_UNAVAILABLE_ATTACHMENT"), + 10: .same(proto: "UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT"), + 11: .same(proto: "NO_ATTACHMENT_FOUND"), + 12: .same(proto: "FAILED_NO_SHARE_TARGET_ENDPOINT"), + 13: .same(proto: "FAILED_PAIRED_KEYHANDSHAKE"), + 14: .same(proto: "FAILED_NULL_CONNECTION"), + 15: .same(proto: "FAILED_NO_PAYLOAD"), + 16: .same(proto: "FAILED_WRITE_INTRODUCTION"), + 17: .same(proto: "FAILED_UNKNOWN_REMOTE_RESPONSE"), + 18: .same(proto: "FAILED_NULL_CONNECTION_INIT_OUTGOING"), + 19: .same(proto: "FAILED_NULL_CONNECTION_DISCONNECTED"), + 20: .same(proto: "FAILED_NULL_CONNECTION_LOST_CONNECTIVITY"), + 21: .same(proto: "FAILED_NULL_CONNECTION_FAILURE"), + 22: .same(proto: "REJECTED_ATTACHMENT_TRANSMISSION_STATUS"), + 23: .same(proto: "TIMED_OUT_ATTACHMENT_TRANSMISSION_STATUS"), + 24: .same(proto: "NOT_ENOUGH_SPACE_ATTACHMENT_TRANSMISSION_STATUS"), + 25: .same(proto: "UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT_TRANSMISSION_STATUS"), + 26: .same(proto: "FAILED_UNKNOWN_REMOTE_RESPONSE_TRANSMISSION_STATUS"), + 27: .same(proto: "NO_RESPONSE_FRAME_CONNECTION_CLOSED_LOST_CONNECTIVITY_TRANSMISSION_STATUS"), + 28: .same(proto: "NO_RESPONSE_FRAME_CONNECTION_CLOSED_TRANSMISSION_STATUS"), + 29: .same(proto: "LOST_CONNECTIVITY_TRANSMISSION_STATUS"), + 30: .same(proto: "FAILED_DISALLOWED_MEDIUM"), + ] +} + +extension Location_Nearby_Proto_Sharing_ConnectionLayerStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CONNECTION_LAYER_STATUS_UNKNOWN"), + 1: .same(proto: "CONNECTION_LAYER_STATUS_SUCCESS"), + 2: .same(proto: "CONNECTION_LAYER_STATUS_ERROR"), + 3: .same(proto: "CONNECTION_LAYER_STATUS_OUT_OF_ORDER_API_CALL"), + 4: .same(proto: "CONNECTION_LAYER_STATUS_ALREADY_HAVE_ACTIVE_STRATEGY"), + 5: .same(proto: "CONNECTION_LAYER_STATUS_ALREADY_ADVERTISING"), + 6: .same(proto: "CONNECTION_LAYER_STATUS_ALREADY_DISCOVERING"), + 7: .same(proto: "CONNECTION_LAYER_STATUS_ALREADY_LISTENING"), + 8: .same(proto: "CONNECTION_LAYER_STATUS_END_POINT_IO_ERROR"), + 9: .same(proto: "CONNECTION_LAYER_STATUS_END_POINT_UNKNOWN"), + 10: .same(proto: "CONNECTION_LAYER_STATUS_CONNECTION_REJECTED"), + 11: .same(proto: "CONNECTION_LAYER_STATUS_ALREADY_CONNECTED_TO_END_POINT"), + 12: .same(proto: "CONNECTION_LAYER_STATUS_NOT_CONNECTED_TO_END_POINT"), + 13: .same(proto: "CONNECTION_LAYER_STATUS_BLUETOOTH_ERROR"), + 14: .same(proto: "CONNECTION_LAYER_STATUS_BLE_ERROR"), + 15: .same(proto: "CONNECTION_LAYER_STATUS_WIFI_LAN_ERROR"), + 16: .same(proto: "CONNECTION_LAYER_STATUS_PAYLOAD_UNKNOWN"), + 17: .same(proto: "CONNECTION_LAYER_STATUS_RESET"), + 18: .same(proto: "CONNECTION_LAYER_STATUS_TIMEOUT"), + ] +} + +extension Location_Nearby_Proto_Sharing_ProcessReceivedAttachmentsStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "PROCESSING_STATUS_UNKNOWN"), + 1: .same(proto: "PROCESSING_STATUS_COMPLETE_PROCESSING_ATTACHMENTS"), + 2: .same(proto: "PROCESSING_STATUS_FAILED_MOVING_FILES"), + 3: .same(proto: "PROCESSING_STATUS_FAILED_RECEIVING_APK"), + 4: .same(proto: "PROCESSING_STATUS_FAILED_RECEIVING_TEXT"), + 5: .same(proto: "PROCESSING_STATUS_FAILED_RECEIVING_WIFI_CREDENTIALS"), + ] +} + +extension Location_Nearby_Proto_Sharing_SessionStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_SESSION_STATUS"), + 1: .same(proto: "SUCCEEDED_SESSION_STATUS"), + 2: .same(proto: "FAILED_SESSION_STATUS"), + ] +} + +extension Location_Nearby_Proto_Sharing_ResponseToIntroduction: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_RESPONSE_TO_INTRODUCTION"), + 1: .same(proto: "ACCEPT_INTRODUCTION"), + 2: .same(proto: "REJECT_INTRODUCTION"), + 3: .same(proto: "FAIL_INTRODUCTION"), + ] +} + +extension Location_Nearby_Proto_Sharing_DeviceType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_DEVICE_TYPE"), + 1: .same(proto: "PHONE"), + 2: .same(proto: "TABLET"), + 3: .same(proto: "LAPTOP"), + 4: .same(proto: "CAR"), + 5: .same(proto: "FOLDABLE"), + 6: .same(proto: "XR"), + ] +} + +extension Location_Nearby_Proto_Sharing_OSType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_OS_TYPE"), + 1: .same(proto: "ANDROID"), + 2: .same(proto: "CHROME_OS"), + 3: .same(proto: "IOS"), + 4: .same(proto: "WINDOWS"), + 5: .same(proto: "MACOS"), + ] +} + +extension Location_Nearby_Proto_Sharing_DeviceRelationship: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_DEVICE_RELATIONSHIP"), + 1: .same(proto: "IS_SELF"), + 2: .same(proto: "IS_CONTACT"), + 3: .same(proto: "IS_STRANGER"), + ] +} + +extension Location_Nearby_Proto_Sharing_LogSource: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNSPECIFIED_SOURCE"), + 1: .same(proto: "LAB_DEVICES"), + 2: .same(proto: "INTERNAL_DEVICES"), + 3: .same(proto: "BETA_TESTER_DEVICES"), + 4: .same(proto: "OEM_DEVICES"), + 5: .same(proto: "DEBUG_DEVICES"), + 6: .same(proto: "NEARBY_MODULE_FOOD_DEVICES"), + 7: .same(proto: "BETO_DOGFOOD_DEVICES"), + 8: .same(proto: "NEARBY_DOGFOOD_DEVICES"), + 9: .same(proto: "NEARBY_TEAMFOOD_DEVICES"), + ] +} + +extension Location_Nearby_Proto_Sharing_ServerActionName: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_SERVER_ACTION"), + 1: .same(proto: "UPLOAD_CERTIFICATES"), + 2: .same(proto: "DOWNLOAD_CERTIFICATES"), + 3: .same(proto: "CHECK_REACHABILITY"), + 4: .same(proto: "UPLOAD_CONTACTS"), + 5: .same(proto: "UPDATE_DEVICE_NAME"), + 6: .same(proto: "UPLOAD_SENDER_CERTIFICATES"), + 7: .same(proto: "DOWNLOAD_SENDER_CERTIFICATES"), + 8: .same(proto: "UPLOAD_CONTACTS_AND_CERTIFICATES"), + 9: .same(proto: "LIST_REACHABLE_PHONE_NUMBERS"), + 10: .same(proto: "LIST_MY_DEVICES"), + 11: .same(proto: "LIST_CONTACT_PEOPLE"), + 12: .same(proto: "DOWNLOAD_CERTIFICATES_INFO"), + ] +} + +extension Location_Nearby_Proto_Sharing_ServerResponseState: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_SERVER_RESPONSE_STATE"), + 1: .same(proto: "SERVER_RESPONSE_SUCCESS"), + 2: .same(proto: "SERVER_RESPONSE_UNKNOWN_FAILURE"), + 3: .same(proto: "SERVER_RESPONSE_STATUS_OTHER_FAILURE"), + 4: .same(proto: "SERVER_RESPONSE_STATUS_DEADLINE_EXCEEDED"), + 5: .same(proto: "SERVER_RESPONSE_STATUS_PERMISSION_DENIED"), + 6: .same(proto: "SERVER_RESPONSE_STATUS_UNAVAILABLE"), + 7: .same(proto: "SERVER_RESPONSE_STATUS_UNAUTHENTICATED"), + 8: .same(proto: "SERVER_RESPONSE_GOOGLE_AUTH_FAILURE"), + 9: .same(proto: "SERVER_RESPONSE_STATUS_INVALID_ARGUMENT"), + 10: .same(proto: "SERVER_RESPONSE_NOT_CONNECTED_TO_INTERNET"), + ] +} + +extension Location_Nearby_Proto_Sharing_SyncPurpose: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "SYNC_PURPOSE_UNKNOWN"), + 1: .same(proto: "SYNC_PURPOSE_ON_DEMAND_SYNC"), + 2: .same(proto: "SYNC_PURPOSE_CHIME_NOTIFICATION"), + 3: .same(proto: "SYNC_PURPOSE_DAILY_SYNC"), + 4: .same(proto: "SYNC_PURPOSE_OPT_IN_FIRST_SYNC"), + 5: .same(proto: "SYNC_PURPOSE_CHECK_DEFAULT_OPT_IN"), + 6: .same(proto: "SYNC_PURPOSE_NEARBY_SHARE_ENABLED"), + 7: .same(proto: "SYNC_PURPOSE_SYNC_AT_FAST_INIT"), + 8: .same(proto: "SYNC_PURPOSE_SYNC_AT_DISCOVERY"), + 9: .same(proto: "SYNC_PURPOSE_SYNC_AT_LOAD_PRIVATE_CERTIFICATE"), + 10: .same(proto: "SYNC_PURPOSE_SYNC_AT_ADVERTISEMENT"), + 11: .same(proto: "SYNC_PURPOSE_CONTACT_LIST_CHANGE"), + 12: .same(proto: "SYNC_PURPOSE_SHOW_C11N_VIEW"), + 13: .same(proto: "SYNC_PURPOSE_REGULAR_CHECK_CONTACT_REACHABILITY"), + 14: .same(proto: "SYNC_PURPOSE_VISIBILITY_SELECTED_CONTACT_CHANGE"), + 15: .same(proto: "SYNC_PURPOSE_ACCOUNT_CHANGE"), + 16: .same(proto: "SYNC_PURPOSE_REGENERATE_CERTIFICATES"), + 17: .same(proto: "SYNC_PURPOSE_DEVICE_CONTACTS_CONSENT_CHANGE"), + ] +} + +extension Location_Nearby_Proto_Sharing_ClientRole: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CLIENT_ROLE_UNKNOWN"), + 1: .same(proto: "CLIENT_ROLE_SENDER"), + 2: .same(proto: "CLIENT_ROLE_RECEIVER"), + ] +} + +extension Location_Nearby_Proto_Sharing_ScanType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_SCAN_TYPE"), + 1: .same(proto: "FOREGROUND_SCAN"), + 2: .same(proto: "FOREGROUND_RETRY_SCAN"), + 3: .same(proto: "DIRECT_SHARE_SCAN"), + 4: .same(proto: "BACKGROUND_SCAN"), + ] +} + +extension Location_Nearby_Proto_Sharing_ParsingFailedType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "FAILED_UNKNOWN_TYPE"), + 1: .same(proto: "FAILED_PARSE_ADVERTISEMENT"), + 2: .same(proto: "FAILED_CONVERT_SHARE_TARGET"), + ] +} + +extension Location_Nearby_Proto_Sharing_AdvertisingMode: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_ADVERTISING_MODE"), + 1: .same(proto: "SCREEN_OFF_ADVERTISING_MODE"), + 2: .same(proto: "BACKGROUND_ADVERTISING_MODE"), + 3: .same(proto: "MIDGROUND_ADVERTISING_MODE"), + 4: .same(proto: "FOREGROUND_ADVERTISING_MODE"), + 5: .same(proto: "SUSPENDED_ADVERTISING_MODE"), + ] +} + +extension Location_Nearby_Proto_Sharing_DiscoveryMode: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_DISCOVERY_MODE"), + 1: .same(proto: "SCREEN_OFF_DISCOVERY_MODE"), + 2: .same(proto: "BACKGROUND_DISCOVERY_MODE"), + 3: .same(proto: "MIDGROUND_DISCOVERY_MODE"), + 4: .same(proto: "FOREGROUND_DISCOVERY_MODE"), + 5: .same(proto: "SUSPENDED_DISCOVERY_MODE"), + ] +} + +extension Location_Nearby_Proto_Sharing_ActivityName: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_ACTIVITY"), + 1: .same(proto: "SHARE_SHEET_ACTIVITY"), + 2: .same(proto: "SETTINGS_ACTIVITY"), + 3: .same(proto: "RECEIVE_SURFACE_ACTIVITY"), + 4: .same(proto: "SETUP_ACTIVITY"), + 5: .same(proto: "DEVICE_VISIBILITY_ACTIVITY"), + 6: .same(proto: "CONSENTS_ACTIVITY"), + 7: .same(proto: "SET_DEVICE_NAME_DIALOG"), + 8: .same(proto: "SET_DATA_USAGE_DIALOG"), + 9: .same(proto: "QUICK_SETTINGS_ACTIVITY"), + 10: .same(proto: "REMOTE_COPY_SHARE_SHEET_ACTIVITY"), + 11: .same(proto: "SETUP_WIZARD_ACTIVITY"), + 12: .same(proto: "SETTINGS_REVIEW_ACTIVITY"), + ] +} + +extension Location_Nearby_Proto_Sharing_ConsentType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CONSENT_TYPE_UNKNOWN"), + 1: .same(proto: "CONSENT_TYPE_C11N"), + 2: .same(proto: "CONSENT_TYPE_DEVICE_CONTACT"), + ] +} + +extension Location_Nearby_Proto_Sharing_ConsentAcceptanceStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CONSENT_UNKNOWN_ACCEPT_STATUS"), + 1: .same(proto: "CONSENT_ACCEPTED"), + 2: .same(proto: "CONSENT_DECLINED"), + 3: .same(proto: "CONSENT_UNABLE_TO_ENABLE"), + ] +} + +extension Location_Nearby_Proto_Sharing_ApkSource: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_APK_SOURCE"), + 1: .same(proto: "APK_FROM_SD_CARD"), + 2: .same(proto: "INSTALLED_APP"), + ] +} + +extension Location_Nearby_Proto_Sharing_InstallAPKStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_INSTALL_APK_STATUS"), + 1: .same(proto: "FAIL_INSTALLATION"), + 2: .same(proto: "SUCCESS_INSTALLATION"), + ] +} + +extension Location_Nearby_Proto_Sharing_VerifyAPKStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_VERIFY_APK_STATUS"), + 1: .same(proto: "NOT_INSTALLABLE"), + 2: .same(proto: "INSTALLABLE"), + 3: .same(proto: "ALREADY_INSTALLED"), + ] +} + +extension Location_Nearby_Proto_Sharing_ShowNotificationStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_SHOW_NOTIFICATION_STATUS"), + 1: .same(proto: "SHOW"), + 2: .same(proto: "NOT_SHOW"), + ] +} + +extension Location_Nearby_Proto_Sharing_PermissionRequestResult: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "PERMISSION_UNKNOWN_REQUEST_RESULT"), + 1: .same(proto: "PERMISSION_GRANTED"), + 2: .same(proto: "PERMISSION_REJECTED"), + 3: .same(proto: "PERMISSION_UNABLE_TO_GRANT"), + ] +} + +extension Location_Nearby_Proto_Sharing_PermissionRequestType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "PERMISSION_UNKNOWN_TYPE"), + 1: .same(proto: "PERMISSION_AIRPLANE_MODE_OFF"), + 2: .same(proto: "PERMISSION_WIFI"), + 3: .same(proto: "PERMISSION_BLUETOOTH"), + 4: .same(proto: "PERMISSION_LOCATION"), + 5: .same(proto: "PERMISSION_WIFI_HOTSPOT"), + ] +} + +extension Location_Nearby_Proto_Sharing_SharingUseCase: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "USE_CASE_UNKNOWN"), + 1: .same(proto: "USE_CASE_NEARBY_SHARE"), + 2: .same(proto: "USE_CASE_REMOTE_COPY_PASTE"), + 3: .same(proto: "USE_CASE_WIFI_CREDENTIAL"), + 4: .same(proto: "USE_CASE_APP_SHARE"), + 5: .same(proto: "USE_CASE_QUICK_SETTING_FILE_SHARE"), + 6: .same(proto: "USE_CASE_SETUP_WIZARD"), + 7: .same(proto: "USE_CASE_NEARBY_SHARE_WITH_QR_CODE"), + 8: .same(proto: "USE_CASE_REDIRECTED_FROM_BLUETOOTH_SHARE"), + ] +} + +extension Location_Nearby_Proto_Sharing_AppCrashReason: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "APP_CRASH_REASON_UNKNOWN"), + ] +} + +extension Location_Nearby_Proto_Sharing_AttachmentSourceType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "ATTACHMENT_SOURCE_UNKNOWN"), + 1: .same(proto: "ATTACHMENT_SOURCE_CONTEXT_MENU"), + 2: .same(proto: "ATTACHMENT_SOURCE_DRAG_AND_DROP"), + 3: .same(proto: "ATTACHMENT_SOURCE_SELECT_FILES_BUTTON"), + 4: .same(proto: "ATTACHMENT_SOURCE_PASTE"), + 5: .same(proto: "ATTACHMENT_SOURCE_SELECT_FOLDERS_BUTTON"), + 6: .same(proto: "ATTACHMENT_SOURCE_SHARE_ACTIVATION"), + ] +} + +extension Location_Nearby_Proto_Sharing_PreferencesAction: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "PREFERENCES_ACTION_UNKNOWN"), + 1: .same(proto: "PREFERENCES_ACTION_NO_ACTION"), + 2: .same(proto: "PREFERENCES_ACTION_LOAD_PREFERENCES"), + 3: .same(proto: "PREFERENCES_ACTION_SAVE_PREFERENCESS"), + 4: .same(proto: "PREFERENCES_ACTION_ATTEMPT_LOAD"), + 5: .same(proto: "PREFERENCES_ACTION_RESTORE_FROM_BACKUP"), + 6: .same(proto: "PREFERENCES_ACTION_CREATE_PREFERENCES_PATH"), + 7: .same(proto: "PREFERENCES_ACTION_MAKE_PREFERENCES_BACKUP_FILE"), + 8: .same(proto: "PREFERENCES_ACTION_CHECK_IF_PREFERENCES_PATH_EXISTS"), + 9: .same(proto: "PREFERENCES_ACTION_CHECK_IF_PREFERENCES_INPUT_STREAM_STATUS"), + 10: .same(proto: "PREFERENCES_ACTION_CHECK_IF_PREFERENCES_FILE_IS_CORRUPTED"), + 11: .same(proto: "PREFERENCES_ACTION_CHECK_IF_PREFERENCES_BACKUP_FILE_EXISTS"), + ] +} + +extension Location_Nearby_Proto_Sharing_PreferencesActionStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "PREFERENCES_ACTION_STATUS_UNKNOWN"), + 1: .same(proto: "PREFERENCES_ACTION_STATUS_SUCCESS"), + 2: .same(proto: "PREFERENCES_ACTION_STATUS_FAIL"), + ] +} + +extension Location_Nearby_Proto_Sharing_FastInitState: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "FAST_INIT_UNKNOWN_STATE"), + 1: .same(proto: "FAST_INIT_CLOSE_STATE"), + 2: .same(proto: "FAST_INIT_FAR_STATE"), + 3: .same(proto: "FAST_INIT_LOST_STATE"), + ] +} + +extension Location_Nearby_Proto_Sharing_FastInitType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "FAST_INIT_UNKNOWN_TYPE"), + 1: .same(proto: "FAST_INIT_NOTIFY_TYPE"), + 2: .same(proto: "FAST_INIT_SILENT_TYPE"), + ] +} + +extension Location_Nearby_Proto_Sharing_DesktopNotification: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DESKTOP_NOTIFICATION_UNKNOWN"), + 1: .same(proto: "DESKTOP_NOTIFICATION_CONNECTING"), + 2: .same(proto: "DESKTOP_NOTIFICATION_PROGRESS"), + 3: .same(proto: "DESKTOP_NOTIFICATION_ACCEPT"), + 4: .same(proto: "DESKTOP_NOTIFICATION_RECEIVED"), + 5: .same(proto: "DESKTOP_NOTIFICATION_ERROR"), + ] +} + +extension Location_Nearby_Proto_Sharing_DesktopTransferEventType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DESKTOP_TRANSFER_EVENT_TYPE_UNKNOWN"), + 1: .same(proto: "DESKTOP_TRANSFER_EVENT_RECEIVE_TYPE_ACCEPT"), + 2: .same(proto: "DESKTOP_TRANSFER_EVENT_RECEIVE_TYPE_PROGRESS"), + 3: .same(proto: "DESKTOP_TRANSFER_EVENT_RECEIVE_TYPE_RECEIVED"), + 4: .same(proto: "DESKTOP_TRANSFER_EVENT_RECEIVE_TYPE_ERROR"), + 5: .same(proto: "DESKTOP_TRANSFER_EVENT_SEND_TYPE_START"), + 6: .same(proto: "DESKTOP_TRANSFER_EVENT_SEND_TYPE_SELECT_A_DEVICE"), + 7: .same(proto: "DESKTOP_TRANSFER_EVENT_SEND_TYPE_PROGRESS"), + 8: .same(proto: "DESKTOP_TRANSFER_EVENT_SEND_TYPE_SENT"), + 9: .same(proto: "DESKTOP_TRANSFER_EVENT_SEND_TYPE_ERROR"), + ] +} + +extension Location_Nearby_Proto_Sharing_DecryptCertificateFailureStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DECRYPT_CERT_UNKNOWN_FAILURE"), + 1: .same(proto: "DECRYPT_CERT_NO_SUCH_ALGORITHM_FAILURE"), + 2: .same(proto: "DECRYPT_CERT_NO_SUCH_PADDING_FAILURE"), + 3: .same(proto: "DECRYPT_CERT_INVALID_KEY_FAILURE"), + 4: .same(proto: "DECRYPT_CERT_INVALID_ALGORITHM_PARAMETER_FAILURE"), + 5: .same(proto: "DECRYPT_CERT_ILLEGAL_BLOCK_SIZE_FAILURE"), + 6: .same(proto: "DECRYPT_CERT_BAD_PADDING_FAILURE"), + ] +} + +extension Location_Nearby_Proto_Sharing_ContactAccess: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CONTACT_ACCESS_UNKNOWN"), + 1: .same(proto: "CONTACT_ACCESS_NO_CONTACT_UPLOADED"), + 2: .same(proto: "CONTACT_ACCESS_ONLY_UPLOAD_GOOGLE_CONTACT"), + 3: .same(proto: "CONTACT_ACCESS_UPLOAD_CONTACT_FOR_DEVICE_CONTACT_CONSENT"), + 4: .same(proto: "CONTACT_ACCESS_UPLOAD_CONTACT_FOR_QUICK_SHARE_CONSENT"), + ] +} + +extension Location_Nearby_Proto_Sharing_IdentityVerification: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "IDENTITY_VERIFICATION_UNKNOWN"), + 1: .same(proto: "IDENTITY_VERIFICATION_NO_PHONE_NUMBER_VERIFIED"), + 2: .same(proto: "IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_NOT_LINKED_TO_GAIA"), + 3: .same(proto: "IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_LINKED_TO_QS_GAIA"), + ] +} + +extension Location_Nearby_Proto_Sharing_ButtonStatus: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "BUTTON_STATUS_UNKNOWN"), + 1: .same(proto: "BUTTON_STATUS_CLICK_ACCEPT"), + 2: .same(proto: "BUTTON_STATUS_CLICK_REJECT"), + 3: .same(proto: "BUTTON_STATUS_IGNORE"), + ] +} diff --git a/airsync-mac/Core/QuickShare/Protobuf/ukey.pb.swift b/airsync-mac/Core/QuickShare/Protobuf/ukey.pb.swift new file mode 100644 index 00000000..0219458f --- /dev/null +++ b/airsync-mac/Core/QuickShare/Protobuf/ukey.pb.swift @@ -0,0 +1,735 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: ukey.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +@preconcurrency import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +enum Securegcm_Ukey2HandshakeCipher: SwiftProtobuf.Enum { + typealias RawValue = Int + case reserved // = 0 + + /// NIST P-256 used for ECDH, SHA512 used for + case p256Sha512 // = 100 + + /// commitment + case curve25519Sha512 // = 200 + + init() { + self = .reserved + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .reserved + case 100: self = .p256Sha512 + case 200: self = .curve25519Sha512 + default: return nil + } + } + + var rawValue: Int { + switch self { + case .reserved: return 0 + case .p256Sha512: return 100 + case .curve25519Sha512: return 200 + } + } + +} + +#if swift(>=4.2) + +extension Securegcm_Ukey2HandshakeCipher: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Securegcm_Ukey2Message { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Identifies message type + var messageType: Securegcm_Ukey2Message.TypeEnum { + get {return _messageType ?? .unknownDoNotUse} + set {_messageType = newValue} + } + /// Returns true if `messageType` has been explicitly set. + var hasMessageType: Bool {return self._messageType != nil} + /// Clears the value of `messageType`. Subsequent reads from it will return its default value. + mutating func clearMessageType() {self._messageType = nil} + + /// Actual message, to be parsed according to + var messageData: Data { + get {return _messageData ?? Data()} + set {_messageData = newValue} + } + /// Returns true if `messageData` has been explicitly set. + var hasMessageData: Bool {return self._messageData != nil} + /// Clears the value of `messageData`. Subsequent reads from it will return its default value. + mutating func clearMessageData() {self._messageData = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownDoNotUse // = 0 + case alert // = 1 + case clientInit // = 2 + case serverInit // = 3 + case clientFinish // = 4 + + init() { + self = .unknownDoNotUse + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownDoNotUse + case 1: self = .alert + case 2: self = .clientInit + case 3: self = .serverInit + case 4: self = .clientFinish + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownDoNotUse: return 0 + case .alert: return 1 + case .clientInit: return 2 + case .serverInit: return 3 + case .clientFinish: return 4 + } + } + + } + + init() {} + + fileprivate var _messageType: Securegcm_Ukey2Message.TypeEnum? = nil + fileprivate var _messageData: Data? = nil +} + +#if swift(>=4.2) + +extension Securegcm_Ukey2Message.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Securegcm_Ukey2Alert { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: Securegcm_Ukey2Alert.AlertType { + get {return _type ?? .badMessage} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + var errorMessage: String { + get {return _errorMessage ?? String()} + set {_errorMessage = newValue} + } + /// Returns true if `errorMessage` has been explicitly set. + var hasErrorMessage: Bool {return self._errorMessage != nil} + /// Clears the value of `errorMessage`. Subsequent reads from it will return its default value. + mutating func clearErrorMessage() {self._errorMessage = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum AlertType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// Framing errors + case badMessage // = 1 + + /// message_type has an undefined value + case badMessageType // = 2 + + /// message_type received does not correspond to + case incorrectMessage // = 3 + + /// expected type at this stage of the protocol + case badMessageData // = 4 + + /// ClientInit and ServerInit errors + case badVersion // = 100 + + /// suitable version to speak with client. + case badRandom // = 101 + + /// length + case badHandshakeCipher // = 102 + + /// The next protocol is missing, unknown, or + case badNextProtocol // = 103 + + /// unsupported + case badPublicKey // = 104 + + /// Other errors + case internalError // = 200 + + init() { + self = .badMessage + } + + init?(rawValue: Int) { + switch rawValue { + case 1: self = .badMessage + case 2: self = .badMessageType + case 3: self = .incorrectMessage + case 4: self = .badMessageData + case 100: self = .badVersion + case 101: self = .badRandom + case 102: self = .badHandshakeCipher + case 103: self = .badNextProtocol + case 104: self = .badPublicKey + case 200: self = .internalError + default: return nil + } + } + + var rawValue: Int { + switch self { + case .badMessage: return 1 + case .badMessageType: return 2 + case .incorrectMessage: return 3 + case .badMessageData: return 4 + case .badVersion: return 100 + case .badRandom: return 101 + case .badHandshakeCipher: return 102 + case .badNextProtocol: return 103 + case .badPublicKey: return 104 + case .internalError: return 200 + } + } + + } + + init() {} + + fileprivate var _type: Securegcm_Ukey2Alert.AlertType? = nil + fileprivate var _errorMessage: String? = nil +} + +#if swift(>=4.2) + +extension Securegcm_Ukey2Alert.AlertType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +struct Securegcm_Ukey2ClientInit { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// highest supported version for rollback + var version: Int32 { + get {return _version ?? 0} + set {_version = newValue} + } + /// Returns true if `version` has been explicitly set. + var hasVersion: Bool {return self._version != nil} + /// Clears the value of `version`. Subsequent reads from it will return its default value. + mutating func clearVersion() {self._version = nil} + + /// protection + var random: Data { + get {return _random ?? Data()} + set {_random = newValue} + } + /// Returns true if `random` has been explicitly set. + var hasRandom: Bool {return self._random != nil} + /// Clears the value of `random`. Subsequent reads from it will return its default value. + mutating func clearRandom() {self._random = nil} + + var cipherCommitments: [Securegcm_Ukey2ClientInit.CipherCommitment] = [] + + /// Next protocol that the client wants to speak. + var nextProtocol: String { + get {return _nextProtocol ?? String()} + set {_nextProtocol = newValue} + } + /// Returns true if `nextProtocol` has been explicitly set. + var hasNextProtocol: Bool {return self._nextProtocol != nil} + /// Clears the value of `nextProtocol`. Subsequent reads from it will return its default value. + mutating func clearNextProtocol() {self._nextProtocol = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// One commitment (hash of ClientFinished containing public key) per supported + /// cipher + struct CipherCommitment { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var handshakeCipher: Securegcm_Ukey2HandshakeCipher { + get {return _handshakeCipher ?? .reserved} + set {_handshakeCipher = newValue} + } + /// Returns true if `handshakeCipher` has been explicitly set. + var hasHandshakeCipher: Bool {return self._handshakeCipher != nil} + /// Clears the value of `handshakeCipher`. Subsequent reads from it will return its default value. + mutating func clearHandshakeCipher() {self._handshakeCipher = nil} + + var commitment: Data { + get {return _commitment ?? Data()} + set {_commitment = newValue} + } + /// Returns true if `commitment` has been explicitly set. + var hasCommitment: Bool {return self._commitment != nil} + /// Clears the value of `commitment`. Subsequent reads from it will return its default value. + mutating func clearCommitment() {self._commitment = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _handshakeCipher: Securegcm_Ukey2HandshakeCipher? = nil + fileprivate var _commitment: Data? = nil + } + + init() {} + + fileprivate var _version: Int32? = nil + fileprivate var _random: Data? = nil + fileprivate var _nextProtocol: String? = nil +} + +struct Securegcm_Ukey2ServerInit { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// highest supported version for rollback + var version: Int32 { + get {return _version ?? 0} + set {_version = newValue} + } + /// Returns true if `version` has been explicitly set. + var hasVersion: Bool {return self._version != nil} + /// Clears the value of `version`. Subsequent reads from it will return its default value. + mutating func clearVersion() {self._version = nil} + + /// protection + var random: Data { + get {return _random ?? Data()} + set {_random = newValue} + } + /// Returns true if `random` has been explicitly set. + var hasRandom: Bool {return self._random != nil} + /// Clears the value of `random`. Subsequent reads from it will return its default value. + mutating func clearRandom() {self._random = nil} + + /// Selected Cipher and corresponding public key + var handshakeCipher: Securegcm_Ukey2HandshakeCipher { + get {return _handshakeCipher ?? .reserved} + set {_handshakeCipher = newValue} + } + /// Returns true if `handshakeCipher` has been explicitly set. + var hasHandshakeCipher: Bool {return self._handshakeCipher != nil} + /// Clears the value of `handshakeCipher`. Subsequent reads from it will return its default value. + mutating func clearHandshakeCipher() {self._handshakeCipher = nil} + + var publicKey: Data { + get {return _publicKey ?? Data()} + set {_publicKey = newValue} + } + /// Returns true if `publicKey` has been explicitly set. + var hasPublicKey: Bool {return self._publicKey != nil} + /// Clears the value of `publicKey`. Subsequent reads from it will return its default value. + mutating func clearPublicKey() {self._publicKey = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _version: Int32? = nil + fileprivate var _random: Data? = nil + fileprivate var _handshakeCipher: Securegcm_Ukey2HandshakeCipher? = nil + fileprivate var _publicKey: Data? = nil +} + +struct Securegcm_Ukey2ClientFinished { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// public key matching selected handshake + var publicKey: Data { + get {return _publicKey ?? Data()} + set {_publicKey = newValue} + } + /// Returns true if `publicKey` has been explicitly set. + var hasPublicKey: Bool {return self._publicKey != nil} + /// Clears the value of `publicKey`. Subsequent reads from it will return its default value. + mutating func clearPublicKey() {self._publicKey = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _publicKey: Data? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Securegcm_Ukey2HandshakeCipher: @unchecked Sendable {} +extension Securegcm_Ukey2Message: @unchecked Sendable {} +extension Securegcm_Ukey2Message.TypeEnum: @unchecked Sendable {} +extension Securegcm_Ukey2Alert: @unchecked Sendable {} +extension Securegcm_Ukey2Alert.AlertType: @unchecked Sendable {} +extension Securegcm_Ukey2ClientInit: @unchecked Sendable {} +extension Securegcm_Ukey2ClientInit.CipherCommitment: @unchecked Sendable {} +extension Securegcm_Ukey2ServerInit: @unchecked Sendable {} +extension Securegcm_Ukey2ClientFinished: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "securegcm" + +extension Securegcm_Ukey2HandshakeCipher: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "RESERVED"), + 100: .same(proto: "P256_SHA512"), + 200: .same(proto: "CURVE25519_SHA512"), + ] +} + +extension Securegcm_Ukey2Message: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Ukey2Message" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "message_type"), + 2: .standard(proto: "message_data"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._messageType) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._messageData) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._messageType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._messageData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_Ukey2Message, rhs: Securegcm_Ukey2Message) -> Bool { + if lhs._messageType != rhs._messageType {return false} + if lhs._messageData != rhs._messageData {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_Ukey2Message.TypeEnum: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_DO_NOT_USE"), + 1: .same(proto: "ALERT"), + 2: .same(proto: "CLIENT_INIT"), + 3: .same(proto: "SERVER_INIT"), + 4: .same(proto: "CLIENT_FINISH"), + ] +} + +extension Securegcm_Ukey2Alert: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Ukey2Alert" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .standard(proto: "error_message"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._type) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._errorMessage) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._errorMessage { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_Ukey2Alert, rhs: Securegcm_Ukey2Alert) -> Bool { + if lhs._type != rhs._type {return false} + if lhs._errorMessage != rhs._errorMessage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_Ukey2Alert.AlertType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "BAD_MESSAGE"), + 2: .same(proto: "BAD_MESSAGE_TYPE"), + 3: .same(proto: "INCORRECT_MESSAGE"), + 4: .same(proto: "BAD_MESSAGE_DATA"), + 100: .same(proto: "BAD_VERSION"), + 101: .same(proto: "BAD_RANDOM"), + 102: .same(proto: "BAD_HANDSHAKE_CIPHER"), + 103: .same(proto: "BAD_NEXT_PROTOCOL"), + 104: .same(proto: "BAD_PUBLIC_KEY"), + 200: .same(proto: "INTERNAL_ERROR"), + ] +} + +extension Securegcm_Ukey2ClientInit: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Ukey2ClientInit" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "version"), + 2: .same(proto: "random"), + 3: .standard(proto: "cipher_commitments"), + 4: .standard(proto: "next_protocol"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._version) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._random) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.cipherCommitments) }() + case 4: try { try decoder.decodeSingularStringField(value: &self._nextProtocol) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._version { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._random { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + if !self.cipherCommitments.isEmpty { + try visitor.visitRepeatedMessageField(value: self.cipherCommitments, fieldNumber: 3) + } + try { if let v = self._nextProtocol { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_Ukey2ClientInit, rhs: Securegcm_Ukey2ClientInit) -> Bool { + if lhs._version != rhs._version {return false} + if lhs._random != rhs._random {return false} + if lhs.cipherCommitments != rhs.cipherCommitments {return false} + if lhs._nextProtocol != rhs._nextProtocol {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_Ukey2ClientInit.CipherCommitment: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Securegcm_Ukey2ClientInit.protoMessageName + ".CipherCommitment" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "handshake_cipher"), + 2: .same(proto: "commitment"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._handshakeCipher) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._commitment) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._handshakeCipher { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._commitment { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_Ukey2ClientInit.CipherCommitment, rhs: Securegcm_Ukey2ClientInit.CipherCommitment) -> Bool { + if lhs._handshakeCipher != rhs._handshakeCipher {return false} + if lhs._commitment != rhs._commitment {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_Ukey2ServerInit: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Ukey2ServerInit" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "version"), + 2: .same(proto: "random"), + 3: .standard(proto: "handshake_cipher"), + 4: .standard(proto: "public_key"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._version) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._random) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self._handshakeCipher) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self._publicKey) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._version { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._random { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try { if let v = self._handshakeCipher { + try visitor.visitSingularEnumField(value: v, fieldNumber: 3) + } }() + try { if let v = self._publicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_Ukey2ServerInit, rhs: Securegcm_Ukey2ServerInit) -> Bool { + if lhs._version != rhs._version {return false} + if lhs._random != rhs._random {return false} + if lhs._handshakeCipher != rhs._handshakeCipher {return false} + if lhs._publicKey != rhs._publicKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Securegcm_Ukey2ClientFinished: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Ukey2ClientFinished" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "public_key"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._publicKey) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._publicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Securegcm_Ukey2ClientFinished, rhs: Securegcm_Ukey2ClientFinished) -> Bool { + if lhs._publicKey != rhs._publicKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/airsync-mac/Core/QuickShare/Protobuf/wire_format.pb.swift b/airsync-mac/Core/QuickShare/Protobuf/wire_format.pb.swift new file mode 100644 index 00000000..d0577cbb --- /dev/null +++ b/airsync-mac/Core/QuickShare/Protobuf/wire_format.pb.swift @@ -0,0 +1,2674 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: wire_format.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +@preconcurrency import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// File metadata. Does not include the actual bytes of the file. +/// NEXT_ID=10 +struct Sharing_Nearby_FileMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The human readable name of this file (eg. 'Cookbook.pdf'). + var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + mutating func clearName() {self._name = nil} + + /// The type of file (eg. 'IMAGE' from 'dog.jpg'). Specifying a type helps + /// provide a richer experience on the receiving side. + var type: Sharing_Nearby_FileMetadata.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + /// The FILE payload id that will be sent as a follow up containing the actual + /// bytes of the file. + var payloadID: Int64 { + get {return _payloadID ?? 0} + set {_payloadID = newValue} + } + /// Returns true if `payloadID` has been explicitly set. + var hasPayloadID: Bool {return self._payloadID != nil} + /// Clears the value of `payloadID`. Subsequent reads from it will return its default value. + mutating func clearPayloadID() {self._payloadID = nil} + + /// The total size of the file. + var size: Int64 { + get {return _size ?? 0} + set {_size = newValue} + } + /// Returns true if `size` has been explicitly set. + var hasSize: Bool {return self._size != nil} + /// Clears the value of `size`. Subsequent reads from it will return its default value. + mutating func clearSize() {self._size = nil} + + /// The mimeType of file (eg. 'image/jpeg' from 'dog.jpg'). Specifying a + /// mimeType helps provide a richer experience on receiving side. + var mimeType: String { + get {return _mimeType ?? "application/octet-stream"} + set {_mimeType = newValue} + } + /// Returns true if `mimeType` has been explicitly set. + var hasMimeType: Bool {return self._mimeType != nil} + /// Clears the value of `mimeType`. Subsequent reads from it will return its default value. + mutating func clearMimeType() {self._mimeType = nil} + + /// A uuid for the attachment. Should be unique across all attachments. + var id: Int64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// The parent folder. + var parentFolder: String { + get {return _parentFolder ?? String()} + set {_parentFolder = newValue} + } + /// Returns true if `parentFolder` has been explicitly set. + var hasParentFolder: Bool {return self._parentFolder != nil} + /// Clears the value of `parentFolder`. Subsequent reads from it will return its default value. + mutating func clearParentFolder() {self._parentFolder = nil} + + /// A stable identifier for the attachment. Used for receiver to identify same + /// attachment from different transfers. + var attachmentHash: Int64 { + get {return _attachmentHash ?? 0} + set {_attachmentHash = newValue} + } + /// Returns true if `attachmentHash` has been explicitly set. + var hasAttachmentHash: Bool {return self._attachmentHash != nil} + /// Clears the value of `attachmentHash`. Subsequent reads from it will return its default value. + mutating func clearAttachmentHash() {self._attachmentHash = nil} + + /// True, if image in file attachment is sensitive + var isSensitiveContent: Bool { + get {return _isSensitiveContent ?? false} + set {_isSensitiveContent = newValue} + } + /// Returns true if `isSensitiveContent` has been explicitly set. + var hasIsSensitiveContent: Bool {return self._isSensitiveContent != nil} + /// Clears the value of `isSensitiveContent`. Subsequent reads from it will return its default value. + mutating func clearIsSensitiveContent() {self._isSensitiveContent = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case image // = 1 + case video // = 2 + case androidApp // = 3 + case audio // = 4 + case document // = 5 + case contactCard // = 6 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .image + case 2: self = .video + case 3: self = .androidApp + case 4: self = .audio + case 5: self = .document + case 6: self = .contactCard + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .image: return 1 + case .video: return 2 + case .androidApp: return 3 + case .audio: return 4 + case .document: return 5 + case .contactCard: return 6 + } + } + + } + + init() {} + + fileprivate var _name: String? = nil + fileprivate var _type: Sharing_Nearby_FileMetadata.TypeEnum? = nil + fileprivate var _payloadID: Int64? = nil + fileprivate var _size: Int64? = nil + fileprivate var _mimeType: String? = nil + fileprivate var _id: Int64? = nil + fileprivate var _parentFolder: String? = nil + fileprivate var _attachmentHash: Int64? = nil + fileprivate var _isSensitiveContent: Bool? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_FileMetadata.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// NEXT_ID=8 +struct Sharing_Nearby_TextMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The title of the text content. + var textTitle: String { + get {return _textTitle ?? String()} + set {_textTitle = newValue} + } + /// Returns true if `textTitle` has been explicitly set. + var hasTextTitle: Bool {return self._textTitle != nil} + /// Clears the value of `textTitle`. Subsequent reads from it will return its default value. + mutating func clearTextTitle() {self._textTitle = nil} + + /// The type of text (phone number, url, address, or plain text). + var type: Sharing_Nearby_TextMetadata.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + /// The BYTE payload id that will be sent as a follow up containing the actual + /// bytes of the text. + var payloadID: Int64 { + get {return _payloadID ?? 0} + set {_payloadID = newValue} + } + /// Returns true if `payloadID` has been explicitly set. + var hasPayloadID: Bool {return self._payloadID != nil} + /// Clears the value of `payloadID`. Subsequent reads from it will return its default value. + mutating func clearPayloadID() {self._payloadID = nil} + + /// The size of the text content. + var size: Int64 { + get {return _size ?? 0} + set {_size = newValue} + } + /// Returns true if `size` has been explicitly set. + var hasSize: Bool {return self._size != nil} + /// Clears the value of `size`. Subsequent reads from it will return its default value. + mutating func clearSize() {self._size = nil} + + /// A uuid for the attachment. Should be unique across all attachments. + var id: Int64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// True if text is sensitive, e.g. password + var isSensitiveText: Bool { + get {return _isSensitiveText ?? false} + set {_isSensitiveText = newValue} + } + /// Returns true if `isSensitiveText` has been explicitly set. + var hasIsSensitiveText: Bool {return self._isSensitiveText != nil} + /// Clears the value of `isSensitiveText`. Subsequent reads from it will return its default value. + mutating func clearIsSensitiveText() {self._isSensitiveText = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case text // = 1 + + /// Open with browsers. + case url // = 2 + + /// Open with map apps. + case address // = 3 + + /// Dial. + case phoneNumber // = 4 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .text + case 2: self = .url + case 3: self = .address + case 4: self = .phoneNumber + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .text: return 1 + case .url: return 2 + case .address: return 3 + case .phoneNumber: return 4 + } + } + + } + + init() {} + + fileprivate var _textTitle: String? = nil + fileprivate var _type: Sharing_Nearby_TextMetadata.TypeEnum? = nil + fileprivate var _payloadID: Int64? = nil + fileprivate var _size: Int64? = nil + fileprivate var _id: Int64? = nil + fileprivate var _isSensitiveText: Bool? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_TextMetadata.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// NEXT_ID=6 +struct Sharing_Nearby_WifiCredentialsMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The Wifi network name. This will be sent in introduction. + var ssid: String { + get {return _ssid ?? String()} + set {_ssid = newValue} + } + /// Returns true if `ssid` has been explicitly set. + var hasSsid: Bool {return self._ssid != nil} + /// Clears the value of `ssid`. Subsequent reads from it will return its default value. + mutating func clearSsid() {self._ssid = nil} + + /// The security type of network (OPEN, WPA_PSK, WEP). + var securityType: Sharing_Nearby_WifiCredentialsMetadata.SecurityType { + get {return _securityType ?? .unknownSecurityType} + set {_securityType = newValue} + } + /// Returns true if `securityType` has been explicitly set. + var hasSecurityType: Bool {return self._securityType != nil} + /// Clears the value of `securityType`. Subsequent reads from it will return its default value. + mutating func clearSecurityType() {self._securityType = nil} + + /// The BYTE payload id that will be sent as a follow up containing the + /// password. + var payloadID: Int64 { + get {return _payloadID ?? 0} + set {_payloadID = newValue} + } + /// Returns true if `payloadID` has been explicitly set. + var hasPayloadID: Bool {return self._payloadID != nil} + /// Clears the value of `payloadID`. Subsequent reads from it will return its default value. + mutating func clearPayloadID() {self._payloadID = nil} + + /// A uuid for the attachment. Should be unique across all attachments. + var id: Int64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum SecurityType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownSecurityType // = 0 + case `open` // = 1 + case wpaPsk // = 2 + case wep // = 3 + case sae // = 4 + + init() { + self = .unknownSecurityType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownSecurityType + case 1: self = .open + case 2: self = .wpaPsk + case 3: self = .wep + case 4: self = .sae + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownSecurityType: return 0 + case .open: return 1 + case .wpaPsk: return 2 + case .wep: return 3 + case .sae: return 4 + } + } + + } + + init() {} + + fileprivate var _ssid: String? = nil + fileprivate var _securityType: Sharing_Nearby_WifiCredentialsMetadata.SecurityType? = nil + fileprivate var _payloadID: Int64? = nil + fileprivate var _id: Int64? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_WifiCredentialsMetadata.SecurityType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// NEXT_ID=8 +struct Sharing_Nearby_AppMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The app name. This will be sent in introduction. + var appName: String { + get {return _appName ?? String()} + set {_appName = newValue} + } + /// Returns true if `appName` has been explicitly set. + var hasAppName: Bool {return self._appName != nil} + /// Clears the value of `appName`. Subsequent reads from it will return its default value. + mutating func clearAppName() {self._appName = nil} + + /// The size of the all split of apks. + var size: Int64 { + get {return _size ?? 0} + set {_size = newValue} + } + /// Returns true if `size` has been explicitly set. + var hasSize: Bool {return self._size != nil} + /// Clears the value of `size`. Subsequent reads from it will return its default value. + mutating func clearSize() {self._size = nil} + + /// The File payload id that will be sent as a follow up containing the + /// apk paths. + var payloadID: [Int64] = [] + + /// A uuid for the attachment. Should be unique across all attachments. + var id: Int64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + /// The name of apk file. This will be sent in introduction. + var fileName: [String] = [] + + /// The size of apk file. This will be sent in introduction. + var fileSize: [Int64] = [] + + /// The package name. This will be sent in introduction. + var packageName: String { + get {return _packageName ?? String()} + set {_packageName = newValue} + } + /// Returns true if `packageName` has been explicitly set. + var hasPackageName: Bool {return self._packageName != nil} + /// Clears the value of `packageName`. Subsequent reads from it will return its default value. + mutating func clearPackageName() {self._packageName = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _appName: String? = nil + fileprivate var _size: Int64? = nil + fileprivate var _id: Int64? = nil + fileprivate var _packageName: String? = nil +} + +/// NEXT_ID=5 +struct Sharing_Nearby_StreamMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A human readable description for the stream. + var description_p: String { + get {return _description_p ?? String()} + set {_description_p = newValue} + } + /// Returns true if `description_p` has been explicitly set. + var hasDescription_p: Bool {return self._description_p != nil} + /// Clears the value of `description_p`. Subsequent reads from it will return its default value. + mutating func clearDescription_p() {self._description_p = nil} + + /// The package name of the sending application. + var packageName: String { + get {return _packageName ?? String()} + set {_packageName = newValue} + } + /// Returns true if `packageName` has been explicitly set. + var hasPackageName: Bool {return self._packageName != nil} + /// Clears the value of `packageName`. Subsequent reads from it will return its default value. + mutating func clearPackageName() {self._packageName = nil} + + /// The payload id that will be send as a followup containing the + /// ParcelFileDescriptor. + var payloadID: Int64 { + get {return _payloadID ?? 0} + set {_payloadID = newValue} + } + /// Returns true if `payloadID` has been explicitly set. + var hasPayloadID: Bool {return self._payloadID != nil} + /// Clears the value of `payloadID`. Subsequent reads from it will return its default value. + mutating func clearPayloadID() {self._payloadID = nil} + + /// The human-readable name of the package that should be displayed as + /// attribution if no other information is available (i.e. the package is not + /// installed locally yet). + var attributedAppName: String { + get {return _attributedAppName ?? String()} + set {_attributedAppName = newValue} + } + /// Returns true if `attributedAppName` has been explicitly set. + var hasAttributedAppName: Bool {return self._attributedAppName != nil} + /// Clears the value of `attributedAppName`. Subsequent reads from it will return its default value. + mutating func clearAttributedAppName() {self._attributedAppName = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _description_p: String? = nil + fileprivate var _packageName: String? = nil + fileprivate var _payloadID: Int64? = nil + fileprivate var _attributedAppName: String? = nil +} + +/// A frame used when sending messages over the wire. +/// NEXT_ID=3 +struct Sharing_Nearby_Frame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var version: Sharing_Nearby_Frame.Version { + get {return _version ?? .unknownVersion} + set {_version = newValue} + } + /// Returns true if `version` has been explicitly set. + var hasVersion: Bool {return self._version != nil} + /// Clears the value of `version`. Subsequent reads from it will return its default value. + mutating func clearVersion() {self._version = nil} + + /// Right now there's only 1 version, but if there are more, exactly one of + /// the following fields will be set. + var v1: Sharing_Nearby_V1Frame { + get {return _v1 ?? Sharing_Nearby_V1Frame()} + set {_v1 = newValue} + } + /// Returns true if `v1` has been explicitly set. + var hasV1: Bool {return self._v1 != nil} + /// Clears the value of `v1`. Subsequent reads from it will return its default value. + mutating func clearV1() {self._v1 = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Version: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownVersion // = 0 + case v1 // = 1 + + init() { + self = .unknownVersion + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownVersion + case 1: self = .v1 + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownVersion: return 0 + case .v1: return 1 + } + } + + } + + init() {} + + fileprivate var _version: Sharing_Nearby_Frame.Version? = nil + fileprivate var _v1: Sharing_Nearby_V1Frame? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_Frame.Version: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// NEXT_ID=8 +struct Sharing_Nearby_V1Frame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: Sharing_Nearby_V1Frame.FrameType { + get {return _storage._type ?? .unknownFrameType} + set {_uniqueStorage()._type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return _storage._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {_uniqueStorage()._type = nil} + + /// At most one of the following fields will be set. + var introduction: Sharing_Nearby_IntroductionFrame { + get {return _storage._introduction ?? Sharing_Nearby_IntroductionFrame()} + set {_uniqueStorage()._introduction = newValue} + } + /// Returns true if `introduction` has been explicitly set. + var hasIntroduction: Bool {return _storage._introduction != nil} + /// Clears the value of `introduction`. Subsequent reads from it will return its default value. + mutating func clearIntroduction() {_uniqueStorage()._introduction = nil} + + var connectionResponse: Sharing_Nearby_ConnectionResponseFrame { + get {return _storage._connectionResponse ?? Sharing_Nearby_ConnectionResponseFrame()} + set {_uniqueStorage()._connectionResponse = newValue} + } + /// Returns true if `connectionResponse` has been explicitly set. + var hasConnectionResponse: Bool {return _storage._connectionResponse != nil} + /// Clears the value of `connectionResponse`. Subsequent reads from it will return its default value. + mutating func clearConnectionResponse() {_uniqueStorage()._connectionResponse = nil} + + var pairedKeyEncryption: Sharing_Nearby_PairedKeyEncryptionFrame { + get {return _storage._pairedKeyEncryption ?? Sharing_Nearby_PairedKeyEncryptionFrame()} + set {_uniqueStorage()._pairedKeyEncryption = newValue} + } + /// Returns true if `pairedKeyEncryption` has been explicitly set. + var hasPairedKeyEncryption: Bool {return _storage._pairedKeyEncryption != nil} + /// Clears the value of `pairedKeyEncryption`. Subsequent reads from it will return its default value. + mutating func clearPairedKeyEncryption() {_uniqueStorage()._pairedKeyEncryption = nil} + + var pairedKeyResult: Sharing_Nearby_PairedKeyResultFrame { + get {return _storage._pairedKeyResult ?? Sharing_Nearby_PairedKeyResultFrame()} + set {_uniqueStorage()._pairedKeyResult = newValue} + } + /// Returns true if `pairedKeyResult` has been explicitly set. + var hasPairedKeyResult: Bool {return _storage._pairedKeyResult != nil} + /// Clears the value of `pairedKeyResult`. Subsequent reads from it will return its default value. + mutating func clearPairedKeyResult() {_uniqueStorage()._pairedKeyResult = nil} + + var certificateInfo: Sharing_Nearby_CertificateInfoFrame { + get {return _storage._certificateInfo ?? Sharing_Nearby_CertificateInfoFrame()} + set {_uniqueStorage()._certificateInfo = newValue} + } + /// Returns true if `certificateInfo` has been explicitly set. + var hasCertificateInfo: Bool {return _storage._certificateInfo != nil} + /// Clears the value of `certificateInfo`. Subsequent reads from it will return its default value. + mutating func clearCertificateInfo() {_uniqueStorage()._certificateInfo = nil} + + var progressUpdate: Sharing_Nearby_ProgressUpdateFrame { + get {return _storage._progressUpdate ?? Sharing_Nearby_ProgressUpdateFrame()} + set {_uniqueStorage()._progressUpdate = newValue} + } + /// Returns true if `progressUpdate` has been explicitly set. + var hasProgressUpdate: Bool {return _storage._progressUpdate != nil} + /// Clears the value of `progressUpdate`. Subsequent reads from it will return its default value. + mutating func clearProgressUpdate() {_uniqueStorage()._progressUpdate = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum FrameType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownFrameType // = 0 + case introduction // = 1 + case response // = 2 + case pairedKeyEncryption // = 3 + case pairedKeyResult // = 4 + + /// No longer used. + case certificateInfo // = 5 + case cancel // = 6 + + /// No longer used. + case progressUpdate // = 7 + + init() { + self = .unknownFrameType + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownFrameType + case 1: self = .introduction + case 2: self = .response + case 3: self = .pairedKeyEncryption + case 4: self = .pairedKeyResult + case 5: self = .certificateInfo + case 6: self = .cancel + case 7: self = .progressUpdate + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknownFrameType: return 0 + case .introduction: return 1 + case .response: return 2 + case .pairedKeyEncryption: return 3 + case .pairedKeyResult: return 4 + case .certificateInfo: return 5 + case .cancel: return 6 + case .progressUpdate: return 7 + } + } + + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=4.2) + +extension Sharing_Nearby_V1Frame.FrameType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// An introduction packet sent by the sending side. Contains a list of files +/// they'd like to share. +/// NEXT_ID=10 +struct Sharing_Nearby_IntroductionFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var fileMetadata: [Sharing_Nearby_FileMetadata] = [] + + var textMetadata: [Sharing_Nearby_TextMetadata] = [] + + /// The required app package to open the content. May be null. + var requiredPackage: String { + get {return _requiredPackage ?? String()} + set {_requiredPackage = newValue} + } + /// Returns true if `requiredPackage` has been explicitly set. + var hasRequiredPackage: Bool {return self._requiredPackage != nil} + /// Clears the value of `requiredPackage`. Subsequent reads from it will return its default value. + mutating func clearRequiredPackage() {self._requiredPackage = nil} + + var wifiCredentialsMetadata: [Sharing_Nearby_WifiCredentialsMetadata] = [] + + var appMetadata: [Sharing_Nearby_AppMetadata] = [] + + var startTransfer: Bool { + get {return _startTransfer ?? false} + set {_startTransfer = newValue} + } + /// Returns true if `startTransfer` has been explicitly set. + var hasStartTransfer: Bool {return self._startTransfer != nil} + /// Clears the value of `startTransfer`. Subsequent reads from it will return its default value. + mutating func clearStartTransfer() {self._startTransfer = nil} + + var streamMetadata: [Sharing_Nearby_StreamMetadata] = [] + + var useCase: Sharing_Nearby_IntroductionFrame.SharingUseCase { + get {return _useCase ?? .unknown} + set {_useCase = newValue} + } + /// Returns true if `useCase` has been explicitly set. + var hasUseCase: Bool {return self._useCase != nil} + /// Clears the value of `useCase`. Subsequent reads from it will return its default value. + mutating func clearUseCase() {self._useCase = nil} + + var previewPayloadIds: [Int64] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum SharingUseCase: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case nearbyShare // = 1 + case remoteCopy // = 2 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .nearbyShare + case 2: self = .remoteCopy + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .nearbyShare: return 1 + case .remoteCopy: return 2 + } + } + + } + + init() {} + + fileprivate var _requiredPackage: String? = nil + fileprivate var _startTransfer: Bool? = nil + fileprivate var _useCase: Sharing_Nearby_IntroductionFrame.SharingUseCase? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_IntroductionFrame.SharingUseCase: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// A progress update packet sent by the sending side. Contains transfer progress +/// value. NEXT_ID=3 +struct Sharing_Nearby_ProgressUpdateFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var progress: Float { + get {return _progress ?? 0} + set {_progress = newValue} + } + /// Returns true if `progress` has been explicitly set. + var hasProgress: Bool {return self._progress != nil} + /// Clears the value of `progress`. Subsequent reads from it will return its default value. + mutating func clearProgress() {self._progress = nil} + + /// True, if the receiver should start bandwidth upgrade and receiving the + /// payloads. + var startTransfer: Bool { + get {return _startTransfer ?? false} + set {_startTransfer = newValue} + } + /// Returns true if `startTransfer` has been explicitly set. + var hasStartTransfer: Bool {return self._startTransfer != nil} + /// Clears the value of `startTransfer`. Subsequent reads from it will return its default value. + mutating func clearStartTransfer() {self._startTransfer = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _progress: Float? = nil + fileprivate var _startTransfer: Bool? = nil +} + +/// A response packet sent by the receiving side. Accepts or rejects the list of +/// files. +/// NEXT_ID=4 +struct Sharing_Nearby_ConnectionResponseFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The receiving side's response. + var status: Sharing_Nearby_ConnectionResponseFrame.Status { + get {return _status ?? .unknown} + set {_status = newValue} + } + /// Returns true if `status` has been explicitly set. + var hasStatus: Bool {return self._status != nil} + /// Clears the value of `status`. Subsequent reads from it will return its default value. + mutating func clearStatus() {self._status = nil} + + /// Key is attachment hash, value is the details of attachment. + var attachmentDetails: Dictionary = [:] + + /// In the case of a stream attachments, the other side of the pipe. + /// Both sender and receiver should validate matching counts. + var streamMetadata: [Sharing_Nearby_StreamMetadata] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Status: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case accept // = 1 + case reject // = 2 + case notEnoughSpace // = 3 + case unsupportedAttachmentType // = 4 + case timedOut // = 5 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .accept + case 2: self = .reject + case 3: self = .notEnoughSpace + case 4: self = .unsupportedAttachmentType + case 5: self = .timedOut + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .accept: return 1 + case .reject: return 2 + case .notEnoughSpace: return 3 + case .unsupportedAttachmentType: return 4 + case .timedOut: return 5 + } + } + + } + + init() {} + + fileprivate var _status: Sharing_Nearby_ConnectionResponseFrame.Status? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_ConnectionResponseFrame.Status: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Attachment details that sent in ConnectionResponseFrame. +/// NEXT_ID=3 +struct Sharing_Nearby_AttachmentDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The attachment family type. + var type: Sharing_Nearby_AttachmentDetails.TypeEnum { + get {return _type ?? .unknown} + set {_type = newValue} + } + /// Returns true if `type` has been explicitly set. + var hasType: Bool {return self._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + mutating func clearType() {self._type = nil} + + /// This field is only for FILE type. + var fileAttachmentDetails: Sharing_Nearby_FileAttachmentDetails { + get {return _fileAttachmentDetails ?? Sharing_Nearby_FileAttachmentDetails()} + set {_fileAttachmentDetails = newValue} + } + /// Returns true if `fileAttachmentDetails` has been explicitly set. + var hasFileAttachmentDetails: Bool {return self._fileAttachmentDetails != nil} + /// Clears the value of `fileAttachmentDetails`. Subsequent reads from it will return its default value. + mutating func clearFileAttachmentDetails() {self._fileAttachmentDetails = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// LINT.IfChange + enum TypeEnum: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + + /// Represents FileAttachment. + case file // = 1 + + /// Represents TextAttachment. + case text // = 2 + + /// Represents WifiCredentialsAttachment. + case wifiCredentials // = 3 + + /// Represents AppAttachment. + case app // = 4 + + /// Represents StreamAttachment. + case stream // = 5 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .file + case 2: self = .text + case 3: self = .wifiCredentials + case 4: self = .app + case 5: self = .stream + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .file: return 1 + case .text: return 2 + case .wifiCredentials: return 3 + case .app: return 4 + case .stream: return 5 + } + } + + } + + init() {} + + fileprivate var _type: Sharing_Nearby_AttachmentDetails.TypeEnum? = nil + fileprivate var _fileAttachmentDetails: Sharing_Nearby_FileAttachmentDetails? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_AttachmentDetails.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// File attachment details included in ConnectionResponseFrame. +/// NEXT_ID=3 +struct Sharing_Nearby_FileAttachmentDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Existing local file size on receiver side. + var receiverExistingFileSize: Int64 { + get {return _receiverExistingFileSize ?? 0} + set {_receiverExistingFileSize = newValue} + } + /// Returns true if `receiverExistingFileSize` has been explicitly set. + var hasReceiverExistingFileSize: Bool {return self._receiverExistingFileSize != nil} + /// Clears the value of `receiverExistingFileSize`. Subsequent reads from it will return its default value. + mutating func clearReceiverExistingFileSize() {self._receiverExistingFileSize = nil} + + /// The key is attachment hash, a stable identifier for the attachment. + /// Value is list of payload details transferred for the attachment. + var attachmentHashPayloads: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _receiverExistingFileSize: Int64? = nil +} + +/// NEXT_ID=2 +struct Sharing_Nearby_PayloadsDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list should be sorted by creation timestamp. + var payloadDetails: [Sharing_Nearby_PayloadDetails] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Metadata of a payload file created by Nearby Connections. +/// NEXT_ID=4 +struct Sharing_Nearby_PayloadDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: Int64 { + get {return _id ?? 0} + set {_id = newValue} + } + /// Returns true if `id` has been explicitly set. + var hasID: Bool {return self._id != nil} + /// Clears the value of `id`. Subsequent reads from it will return its default value. + mutating func clearID() {self._id = nil} + + var creationTimestampMillis: Int64 { + get {return _creationTimestampMillis ?? 0} + set {_creationTimestampMillis = newValue} + } + /// Returns true if `creationTimestampMillis` has been explicitly set. + var hasCreationTimestampMillis: Bool {return self._creationTimestampMillis != nil} + /// Clears the value of `creationTimestampMillis`. Subsequent reads from it will return its default value. + mutating func clearCreationTimestampMillis() {self._creationTimestampMillis = nil} + + var size: Int64 { + get {return _size ?? 0} + set {_size = newValue} + } + /// Returns true if `size` has been explicitly set. + var hasSize: Bool {return self._size != nil} + /// Clears the value of `size`. Subsequent reads from it will return its default value. + mutating func clearSize() {self._size = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _id: Int64? = nil + fileprivate var _creationTimestampMillis: Int64? = nil + fileprivate var _size: Int64? = nil +} + +/// A paired key encryption packet sent between devices, contains signed data. +/// NEXT_ID=5 +struct Sharing_Nearby_PairedKeyEncryptionFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The encrypted data in byte array format. + var signedData: Data { + get {return _signedData ?? Data()} + set {_signedData = newValue} + } + /// Returns true if `signedData` has been explicitly set. + var hasSignedData: Bool {return self._signedData != nil} + /// Clears the value of `signedData`. Subsequent reads from it will return its default value. + mutating func clearSignedData() {self._signedData = nil} + + /// The hash of a certificate id. + var secretIDHash: Data { + get {return _secretIDHash ?? Data()} + set {_secretIDHash = newValue} + } + /// Returns true if `secretIDHash` has been explicitly set. + var hasSecretIDHash: Bool {return self._secretIDHash != nil} + /// Clears the value of `secretIDHash`. Subsequent reads from it will return its default value. + mutating func clearSecretIDHash() {self._secretIDHash = nil} + + /// An optional encrypted data in byte array format. + var optionalSignedData: Data { + get {return _optionalSignedData ?? Data()} + set {_optionalSignedData = newValue} + } + /// Returns true if `optionalSignedData` has been explicitly set. + var hasOptionalSignedData: Bool {return self._optionalSignedData != nil} + /// Clears the value of `optionalSignedData`. Subsequent reads from it will return its default value. + mutating func clearOptionalSignedData() {self._optionalSignedData = nil} + + /// An optional QR code handshake data in a byte array format. + /// For incoming connection contains a signature of the UKEY2 + /// token, created with the sender's private key. + /// For outgoing connection contains an HKDF of the connection token and of the + /// UKEY2 token + var qrCodeHandshakeData: Data { + get {return _qrCodeHandshakeData ?? Data()} + set {_qrCodeHandshakeData = newValue} + } + /// Returns true if `qrCodeHandshakeData` has been explicitly set. + var hasQrCodeHandshakeData: Bool {return self._qrCodeHandshakeData != nil} + /// Clears the value of `qrCodeHandshakeData`. Subsequent reads from it will return its default value. + mutating func clearQrCodeHandshakeData() {self._qrCodeHandshakeData = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _signedData: Data? = nil + fileprivate var _secretIDHash: Data? = nil + fileprivate var _optionalSignedData: Data? = nil + fileprivate var _qrCodeHandshakeData: Data? = nil +} + +/// A paired key verification result packet sent between devices. +/// NEXT_ID=3 +struct Sharing_Nearby_PairedKeyResultFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The verification result. + var status: Sharing_Nearby_PairedKeyResultFrame.Status { + get {return _status ?? .unknown} + set {_status = newValue} + } + /// Returns true if `status` has been explicitly set. + var hasStatus: Bool {return self._status != nil} + /// Clears the value of `status`. Subsequent reads from it will return its default value. + mutating func clearStatus() {self._status = nil} + + /// OS type. + var osType: Location_Nearby_Proto_Sharing_OSType { + get {return _osType ?? .unknownOsType} + set {_osType = newValue} + } + /// Returns true if `osType` has been explicitly set. + var hasOsType: Bool {return self._osType != nil} + /// Clears the value of `osType`. Subsequent reads from it will return its default value. + mutating func clearOsType() {self._osType = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum Status: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case success // = 1 + case fail // = 2 + case unable // = 3 + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .success + case 2: self = .fail + case 3: self = .unable + default: return nil + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .success: return 1 + case .fail: return 2 + case .unable: return 3 + } + } + + } + + init() {} + + fileprivate var _status: Sharing_Nearby_PairedKeyResultFrame.Status? = nil + fileprivate var _osType: Location_Nearby_Proto_Sharing_OSType? = nil +} + +#if swift(>=4.2) + +extension Sharing_Nearby_PairedKeyResultFrame.Status: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// A package containing certificate info to be shared to remote device offline. +/// NEXT_ID=2 +struct Sharing_Nearby_CertificateInfoFrame { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The public certificates to be shared with remote devices. + var publicCertificate: [Sharing_Nearby_PublicCertificate] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// A public certificate from the local device. +/// NEXT_ID=8 +struct Sharing_Nearby_PublicCertificate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The unique id of the public certificate. + var secretID: Data { + get {return _secretID ?? Data()} + set {_secretID = newValue} + } + /// Returns true if `secretID` has been explicitly set. + var hasSecretID: Bool {return self._secretID != nil} + /// Clears the value of `secretID`. Subsequent reads from it will return its default value. + mutating func clearSecretID() {self._secretID = nil} + + /// A bytes representation of a Secret Key owned by contact, to decrypt the + /// metadata_key stored within the advertisement. + var authenticityKey: Data { + get {return _authenticityKey ?? Data()} + set {_authenticityKey = newValue} + } + /// Returns true if `authenticityKey` has been explicitly set. + var hasAuthenticityKey: Bool {return self._authenticityKey != nil} + /// Clears the value of `authenticityKey`. Subsequent reads from it will return its default value. + mutating func clearAuthenticityKey() {self._authenticityKey = nil} + + /// A bytes representation a public key of X509Certificate, owned by contact, + /// to decrypt encrypted UKEY2 (from Nearby Connections API) as a hand shake in + /// contact verification phase. + var publicKey: Data { + get {return _publicKey ?? Data()} + set {_publicKey = newValue} + } + /// Returns true if `publicKey` has been explicitly set. + var hasPublicKey: Bool {return self._publicKey != nil} + /// Clears the value of `publicKey`. Subsequent reads from it will return its default value. + mutating func clearPublicKey() {self._publicKey = nil} + + /// The time in millis from epoch when this certificate becomes effective. + var startTime: Int64 { + get {return _startTime ?? 0} + set {_startTime = newValue} + } + /// Returns true if `startTime` has been explicitly set. + var hasStartTime: Bool {return self._startTime != nil} + /// Clears the value of `startTime`. Subsequent reads from it will return its default value. + mutating func clearStartTime() {self._startTime = nil} + + /// The time in millis from epoch when this certificate expires. + var endTime: Int64 { + get {return _endTime ?? 0} + set {_endTime = newValue} + } + /// Returns true if `endTime` has been explicitly set. + var hasEndTime: Bool {return self._endTime != nil} + /// Clears the value of `endTime`. Subsequent reads from it will return its default value. + mutating func clearEndTime() {self._endTime = nil} + + /// The encrypted metadata in bytes, contains personal information of the + /// device/user who created this certificate. Needs to be decrypted into bytes, + /// and converted back to EncryptedMetadata object to access fields. + var encryptedMetadataBytes: Data { + get {return _encryptedMetadataBytes ?? Data()} + set {_encryptedMetadataBytes = newValue} + } + /// Returns true if `encryptedMetadataBytes` has been explicitly set. + var hasEncryptedMetadataBytes: Bool {return self._encryptedMetadataBytes != nil} + /// Clears the value of `encryptedMetadataBytes`. Subsequent reads from it will return its default value. + mutating func clearEncryptedMetadataBytes() {self._encryptedMetadataBytes = nil} + + /// The tag for verifying metadata_encryption_key. + var metadataEncryptionKeyTag: Data { + get {return _metadataEncryptionKeyTag ?? Data()} + set {_metadataEncryptionKeyTag = newValue} + } + /// Returns true if `metadataEncryptionKeyTag` has been explicitly set. + var hasMetadataEncryptionKeyTag: Bool {return self._metadataEncryptionKeyTag != nil} + /// Clears the value of `metadataEncryptionKeyTag`. Subsequent reads from it will return its default value. + mutating func clearMetadataEncryptionKeyTag() {self._metadataEncryptionKeyTag = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _secretID: Data? = nil + fileprivate var _authenticityKey: Data? = nil + fileprivate var _publicKey: Data? = nil + fileprivate var _startTime: Int64? = nil + fileprivate var _endTime: Int64? = nil + fileprivate var _encryptedMetadataBytes: Data? = nil + fileprivate var _metadataEncryptionKeyTag: Data? = nil +} + +/// NEXT_ID=3 +struct Sharing_Nearby_WifiCredentials { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Wi-Fi password. + var password: String { + get {return _password ?? String()} + set {_password = newValue} + } + /// Returns true if `password` has been explicitly set. + var hasPassword: Bool {return self._password != nil} + /// Clears the value of `password`. Subsequent reads from it will return its default value. + mutating func clearPassword() {self._password = nil} + + /// True if the network is a hidden network that is not broadcasting its SSID. + /// Default is false. + var hiddenSsid: Bool { + get {return _hiddenSsid ?? false} + set {_hiddenSsid = newValue} + } + /// Returns true if `hiddenSsid` has been explicitly set. + var hasHiddenSsid: Bool {return self._hiddenSsid != nil} + /// Clears the value of `hiddenSsid`. Subsequent reads from it will return its default value. + mutating func clearHiddenSsid() {self._hiddenSsid = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _password: String? = nil + fileprivate var _hiddenSsid: Bool? = nil +} + +/// NEXT_ID=2 +struct Sharing_Nearby_StreamDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Serialized ParcelFileDescriptor for input stream (for the receiver). + var inputStreamParcelFileDescriptorBytes: Data { + get {return _inputStreamParcelFileDescriptorBytes ?? Data()} + set {_inputStreamParcelFileDescriptorBytes = newValue} + } + /// Returns true if `inputStreamParcelFileDescriptorBytes` has been explicitly set. + var hasInputStreamParcelFileDescriptorBytes: Bool {return self._inputStreamParcelFileDescriptorBytes != nil} + /// Clears the value of `inputStreamParcelFileDescriptorBytes`. Subsequent reads from it will return its default value. + mutating func clearInputStreamParcelFileDescriptorBytes() {self._inputStreamParcelFileDescriptorBytes = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _inputStreamParcelFileDescriptorBytes: Data? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Sharing_Nearby_FileMetadata: @unchecked Sendable {} +extension Sharing_Nearby_FileMetadata.TypeEnum: @unchecked Sendable {} +extension Sharing_Nearby_TextMetadata: @unchecked Sendable {} +extension Sharing_Nearby_TextMetadata.TypeEnum: @unchecked Sendable {} +extension Sharing_Nearby_WifiCredentialsMetadata: @unchecked Sendable {} +extension Sharing_Nearby_WifiCredentialsMetadata.SecurityType: @unchecked Sendable {} +extension Sharing_Nearby_AppMetadata: @unchecked Sendable {} +extension Sharing_Nearby_StreamMetadata: @unchecked Sendable {} +extension Sharing_Nearby_Frame: @unchecked Sendable {} +extension Sharing_Nearby_Frame.Version: @unchecked Sendable {} +extension Sharing_Nearby_V1Frame: @unchecked Sendable {} +extension Sharing_Nearby_V1Frame.FrameType: @unchecked Sendable {} +extension Sharing_Nearby_IntroductionFrame: @unchecked Sendable {} +extension Sharing_Nearby_IntroductionFrame.SharingUseCase: @unchecked Sendable {} +extension Sharing_Nearby_ProgressUpdateFrame: @unchecked Sendable {} +extension Sharing_Nearby_ConnectionResponseFrame: @unchecked Sendable {} +extension Sharing_Nearby_ConnectionResponseFrame.Status: @unchecked Sendable {} +extension Sharing_Nearby_AttachmentDetails: @unchecked Sendable {} +extension Sharing_Nearby_AttachmentDetails.TypeEnum: @unchecked Sendable {} +extension Sharing_Nearby_FileAttachmentDetails: @unchecked Sendable {} +extension Sharing_Nearby_PayloadsDetails: @unchecked Sendable {} +extension Sharing_Nearby_PayloadDetails: @unchecked Sendable {} +extension Sharing_Nearby_PairedKeyEncryptionFrame: @unchecked Sendable {} +extension Sharing_Nearby_PairedKeyResultFrame: @unchecked Sendable {} +extension Sharing_Nearby_PairedKeyResultFrame.Status: @unchecked Sendable {} +extension Sharing_Nearby_CertificateInfoFrame: @unchecked Sendable {} +extension Sharing_Nearby_PublicCertificate: @unchecked Sendable {} +extension Sharing_Nearby_WifiCredentials: @unchecked Sendable {} +extension Sharing_Nearby_StreamDetails: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "sharing.nearby" + +extension Sharing_Nearby_FileMetadata: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FileMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "type"), + 3: .standard(proto: "payload_id"), + 4: .same(proto: "size"), + 5: .standard(proto: "mime_type"), + 6: .same(proto: "id"), + 7: .standard(proto: "parent_folder"), + 8: .standard(proto: "attachment_hash"), + 9: .standard(proto: "is_sensitive_content"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._type) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &self._payloadID) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self._size) }() + case 5: try { try decoder.decodeSingularStringField(value: &self._mimeType) }() + case 6: try { try decoder.decodeSingularInt64Field(value: &self._id) }() + case 7: try { try decoder.decodeSingularStringField(value: &self._parentFolder) }() + case 8: try { try decoder.decodeSingularInt64Field(value: &self._attachmentHash) }() + case 9: try { try decoder.decodeSingularBoolField(value: &self._isSensitiveContent) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try { if let v = self._payloadID { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 3) + } }() + try { if let v = self._size { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 4) + } }() + try { if let v = self._mimeType { + try visitor.visitSingularStringField(value: v, fieldNumber: 5) + } }() + try { if let v = self._id { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 6) + } }() + try { if let v = self._parentFolder { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } }() + try { if let v = self._attachmentHash { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 8) + } }() + try { if let v = self._isSensitiveContent { + try visitor.visitSingularBoolField(value: v, fieldNumber: 9) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_FileMetadata, rhs: Sharing_Nearby_FileMetadata) -> Bool { + if lhs._name != rhs._name {return false} + if lhs._type != rhs._type {return false} + if lhs._payloadID != rhs._payloadID {return false} + if lhs._size != rhs._size {return false} + if lhs._mimeType != rhs._mimeType {return false} + if lhs._id != rhs._id {return false} + if lhs._parentFolder != rhs._parentFolder {return false} + if lhs._attachmentHash != rhs._attachmentHash {return false} + if lhs._isSensitiveContent != rhs._isSensitiveContent {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_FileMetadata.TypeEnum: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "IMAGE"), + 2: .same(proto: "VIDEO"), + 3: .same(proto: "ANDROID_APP"), + 4: .same(proto: "AUDIO"), + 5: .same(proto: "DOCUMENT"), + 6: .same(proto: "CONTACT_CARD"), + ] +} + +extension Sharing_Nearby_TextMetadata: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TextMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .standard(proto: "text_title"), + 3: .same(proto: "type"), + 4: .standard(proto: "payload_id"), + 5: .same(proto: "size"), + 6: .same(proto: "id"), + 7: .standard(proto: "is_sensitive_text"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 2: try { try decoder.decodeSingularStringField(value: &self._textTitle) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self._type) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self._payloadID) }() + case 5: try { try decoder.decodeSingularInt64Field(value: &self._size) }() + case 6: try { try decoder.decodeSingularInt64Field(value: &self._id) }() + case 7: try { try decoder.decodeSingularBoolField(value: &self._isSensitiveText) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._textTitle { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 3) + } }() + try { if let v = self._payloadID { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 4) + } }() + try { if let v = self._size { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 5) + } }() + try { if let v = self._id { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 6) + } }() + try { if let v = self._isSensitiveText { + try visitor.visitSingularBoolField(value: v, fieldNumber: 7) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_TextMetadata, rhs: Sharing_Nearby_TextMetadata) -> Bool { + if lhs._textTitle != rhs._textTitle {return false} + if lhs._type != rhs._type {return false} + if lhs._payloadID != rhs._payloadID {return false} + if lhs._size != rhs._size {return false} + if lhs._id != rhs._id {return false} + if lhs._isSensitiveText != rhs._isSensitiveText {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_TextMetadata.TypeEnum: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "TEXT"), + 2: .same(proto: "URL"), + 3: .same(proto: "ADDRESS"), + 4: .same(proto: "PHONE_NUMBER"), + ] +} + +extension Sharing_Nearby_WifiCredentialsMetadata: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WifiCredentialsMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .same(proto: "ssid"), + 3: .standard(proto: "security_type"), + 4: .standard(proto: "payload_id"), + 5: .same(proto: "id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 2: try { try decoder.decodeSingularStringField(value: &self._ssid) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self._securityType) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self._payloadID) }() + case 5: try { try decoder.decodeSingularInt64Field(value: &self._id) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._ssid { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = self._securityType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 3) + } }() + try { if let v = self._payloadID { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 4) + } }() + try { if let v = self._id { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 5) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_WifiCredentialsMetadata, rhs: Sharing_Nearby_WifiCredentialsMetadata) -> Bool { + if lhs._ssid != rhs._ssid {return false} + if lhs._securityType != rhs._securityType {return false} + if lhs._payloadID != rhs._payloadID {return false} + if lhs._id != rhs._id {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_WifiCredentialsMetadata.SecurityType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_SECURITY_TYPE"), + 1: .same(proto: "OPEN"), + 2: .same(proto: "WPA_PSK"), + 3: .same(proto: "WEP"), + 4: .same(proto: "SAE"), + ] +} + +extension Sharing_Nearby_AppMetadata: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AppMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "app_name"), + 2: .same(proto: "size"), + 3: .standard(proto: "payload_id"), + 4: .same(proto: "id"), + 5: .standard(proto: "file_name"), + 6: .standard(proto: "file_size"), + 7: .standard(proto: "package_name"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._appName) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self._size) }() + case 3: try { try decoder.decodeRepeatedInt64Field(value: &self.payloadID) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self._id) }() + case 5: try { try decoder.decodeRepeatedStringField(value: &self.fileName) }() + case 6: try { try decoder.decodeRepeatedInt64Field(value: &self.fileSize) }() + case 7: try { try decoder.decodeSingularStringField(value: &self._packageName) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._appName { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._size { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 2) + } }() + if !self.payloadID.isEmpty { + try visitor.visitPackedInt64Field(value: self.payloadID, fieldNumber: 3) + } + try { if let v = self._id { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 4) + } }() + if !self.fileName.isEmpty { + try visitor.visitRepeatedStringField(value: self.fileName, fieldNumber: 5) + } + if !self.fileSize.isEmpty { + try visitor.visitPackedInt64Field(value: self.fileSize, fieldNumber: 6) + } + try { if let v = self._packageName { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_AppMetadata, rhs: Sharing_Nearby_AppMetadata) -> Bool { + if lhs._appName != rhs._appName {return false} + if lhs._size != rhs._size {return false} + if lhs.payloadID != rhs.payloadID {return false} + if lhs._id != rhs._id {return false} + if lhs.fileName != rhs.fileName {return false} + if lhs.fileSize != rhs.fileSize {return false} + if lhs._packageName != rhs._packageName {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_StreamMetadata: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StreamMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "description"), + 2: .standard(proto: "package_name"), + 3: .standard(proto: "payload_id"), + 4: .standard(proto: "attributed_app_name"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._description_p) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._packageName) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &self._payloadID) }() + case 4: try { try decoder.decodeSingularStringField(value: &self._attributedAppName) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._description_p { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._packageName { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } }() + try { if let v = self._payloadID { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 3) + } }() + try { if let v = self._attributedAppName { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_StreamMetadata, rhs: Sharing_Nearby_StreamMetadata) -> Bool { + if lhs._description_p != rhs._description_p {return false} + if lhs._packageName != rhs._packageName {return false} + if lhs._payloadID != rhs._payloadID {return false} + if lhs._attributedAppName != rhs._attributedAppName {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_Frame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Frame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "version"), + 2: .same(proto: "v1"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._version) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._v1) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._version { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._v1 { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_Frame, rhs: Sharing_Nearby_Frame) -> Bool { + if lhs._version != rhs._version {return false} + if lhs._v1 != rhs._v1 {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_Frame.Version: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_VERSION"), + 1: .same(proto: "V1"), + ] +} + +extension Sharing_Nearby_V1Frame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".V1Frame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "introduction"), + 3: .standard(proto: "connection_response"), + 4: .standard(proto: "paired_key_encryption"), + 5: .standard(proto: "paired_key_result"), + 6: .standard(proto: "certificate_info"), + 7: .standard(proto: "progress_update"), + ] + + fileprivate class _StorageClass { + var _type: Sharing_Nearby_V1Frame.FrameType? = nil + var _introduction: Sharing_Nearby_IntroductionFrame? = nil + var _connectionResponse: Sharing_Nearby_ConnectionResponseFrame? = nil + var _pairedKeyEncryption: Sharing_Nearby_PairedKeyEncryptionFrame? = nil + var _pairedKeyResult: Sharing_Nearby_PairedKeyResultFrame? = nil + var _certificateInfo: Sharing_Nearby_CertificateInfoFrame? = nil + var _progressUpdate: Sharing_Nearby_ProgressUpdateFrame? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _type = source._type + _introduction = source._introduction + _connectionResponse = source._connectionResponse + _pairedKeyEncryption = source._pairedKeyEncryption + _pairedKeyResult = source._pairedKeyResult + _certificateInfo = source._certificateInfo + _progressUpdate = source._progressUpdate + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &_storage._type) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._introduction) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._connectionResponse) }() + case 4: try { try decoder.decodeSingularMessageField(value: &_storage._pairedKeyEncryption) }() + case 5: try { try decoder.decodeSingularMessageField(value: &_storage._pairedKeyResult) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._certificateInfo) }() + case 7: try { try decoder.decodeSingularMessageField(value: &_storage._progressUpdate) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = _storage._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._introduction { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._connectionResponse { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = _storage._pairedKeyEncryption { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try { if let v = _storage._pairedKeyResult { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } }() + try { if let v = _storage._certificateInfo { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._progressUpdate { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_V1Frame, rhs: Sharing_Nearby_V1Frame) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._type != rhs_storage._type {return false} + if _storage._introduction != rhs_storage._introduction {return false} + if _storage._connectionResponse != rhs_storage._connectionResponse {return false} + if _storage._pairedKeyEncryption != rhs_storage._pairedKeyEncryption {return false} + if _storage._pairedKeyResult != rhs_storage._pairedKeyResult {return false} + if _storage._certificateInfo != rhs_storage._certificateInfo {return false} + if _storage._progressUpdate != rhs_storage._progressUpdate {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_V1Frame.FrameType: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_FRAME_TYPE"), + 1: .same(proto: "INTRODUCTION"), + 2: .same(proto: "RESPONSE"), + 3: .same(proto: "PAIRED_KEY_ENCRYPTION"), + 4: .same(proto: "PAIRED_KEY_RESULT"), + 5: .same(proto: "CERTIFICATE_INFO"), + 6: .same(proto: "CANCEL"), + 7: .same(proto: "PROGRESS_UPDATE"), + ] +} + +extension Sharing_Nearby_IntroductionFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".IntroductionFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "file_metadata"), + 2: .standard(proto: "text_metadata"), + 3: .standard(proto: "required_package"), + 4: .standard(proto: "wifi_credentials_metadata"), + 5: .standard(proto: "app_metadata"), + 6: .standard(proto: "start_transfer"), + 7: .standard(proto: "stream_metadata"), + 8: .standard(proto: "use_case"), + 9: .standard(proto: "preview_payload_ids"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.fileMetadata) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.textMetadata) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._requiredPackage) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.wifiCredentialsMetadata) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.appMetadata) }() + case 6: try { try decoder.decodeSingularBoolField(value: &self._startTransfer) }() + case 7: try { try decoder.decodeRepeatedMessageField(value: &self.streamMetadata) }() + case 8: try { try decoder.decodeSingularEnumField(value: &self._useCase) }() + case 9: try { try decoder.decodeRepeatedInt64Field(value: &self.previewPayloadIds) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.fileMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.fileMetadata, fieldNumber: 1) + } + if !self.textMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.textMetadata, fieldNumber: 2) + } + try { if let v = self._requiredPackage { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } }() + if !self.wifiCredentialsMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.wifiCredentialsMetadata, fieldNumber: 4) + } + if !self.appMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.appMetadata, fieldNumber: 5) + } + try { if let v = self._startTransfer { + try visitor.visitSingularBoolField(value: v, fieldNumber: 6) + } }() + if !self.streamMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.streamMetadata, fieldNumber: 7) + } + try { if let v = self._useCase { + try visitor.visitSingularEnumField(value: v, fieldNumber: 8) + } }() + if !self.previewPayloadIds.isEmpty { + try visitor.visitRepeatedInt64Field(value: self.previewPayloadIds, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_IntroductionFrame, rhs: Sharing_Nearby_IntroductionFrame) -> Bool { + if lhs.fileMetadata != rhs.fileMetadata {return false} + if lhs.textMetadata != rhs.textMetadata {return false} + if lhs._requiredPackage != rhs._requiredPackage {return false} + if lhs.wifiCredentialsMetadata != rhs.wifiCredentialsMetadata {return false} + if lhs.appMetadata != rhs.appMetadata {return false} + if lhs._startTransfer != rhs._startTransfer {return false} + if lhs.streamMetadata != rhs.streamMetadata {return false} + if lhs._useCase != rhs._useCase {return false} + if lhs.previewPayloadIds != rhs.previewPayloadIds {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_IntroductionFrame.SharingUseCase: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "NEARBY_SHARE"), + 2: .same(proto: "REMOTE_COPY"), + ] +} + +extension Sharing_Nearby_ProgressUpdateFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ProgressUpdateFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "progress"), + 2: .standard(proto: "start_transfer"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularFloatField(value: &self._progress) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._startTransfer) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._progress { + try visitor.visitSingularFloatField(value: v, fieldNumber: 1) + } }() + try { if let v = self._startTransfer { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_ProgressUpdateFrame, rhs: Sharing_Nearby_ProgressUpdateFrame) -> Bool { + if lhs._progress != rhs._progress {return false} + if lhs._startTransfer != rhs._startTransfer {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_ConnectionResponseFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConnectionResponseFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "status"), + 2: .standard(proto: "attachment_details"), + 3: .standard(proto: "stream_metadata"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._status) }() + case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.attachmentDetails) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.streamMetadata) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._status { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + if !self.attachmentDetails.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.attachmentDetails, fieldNumber: 2) + } + if !self.streamMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.streamMetadata, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_ConnectionResponseFrame, rhs: Sharing_Nearby_ConnectionResponseFrame) -> Bool { + if lhs._status != rhs._status {return false} + if lhs.attachmentDetails != rhs.attachmentDetails {return false} + if lhs.streamMetadata != rhs.streamMetadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_ConnectionResponseFrame.Status: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "ACCEPT"), + 2: .same(proto: "REJECT"), + 3: .same(proto: "NOT_ENOUGH_SPACE"), + 4: .same(proto: "UNSUPPORTED_ATTACHMENT_TYPE"), + 5: .same(proto: "TIMED_OUT"), + ] +} + +extension Sharing_Nearby_AttachmentDetails: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AttachmentDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .standard(proto: "file_attachment_details"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._type) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._fileAttachmentDetails) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._fileAttachmentDetails { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_AttachmentDetails, rhs: Sharing_Nearby_AttachmentDetails) -> Bool { + if lhs._type != rhs._type {return false} + if lhs._fileAttachmentDetails != rhs._fileAttachmentDetails {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_AttachmentDetails.TypeEnum: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "FILE"), + 2: .same(proto: "TEXT"), + 3: .same(proto: "WIFI_CREDENTIALS"), + 4: .same(proto: "APP"), + 5: .same(proto: "STREAM"), + ] +} + +extension Sharing_Nearby_FileAttachmentDetails: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FileAttachmentDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "receiver_existing_file_size"), + 2: .standard(proto: "attachment_hash_payloads"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt64Field(value: &self._receiverExistingFileSize) }() + case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.attachmentHashPayloads) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._receiverExistingFileSize { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 1) + } }() + if !self.attachmentHashPayloads.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.attachmentHashPayloads, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_FileAttachmentDetails, rhs: Sharing_Nearby_FileAttachmentDetails) -> Bool { + if lhs._receiverExistingFileSize != rhs._receiverExistingFileSize {return false} + if lhs.attachmentHashPayloads != rhs.attachmentHashPayloads {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_PayloadsDetails: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PayloadsDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payload_details"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.payloadDetails) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.payloadDetails.isEmpty { + try visitor.visitRepeatedMessageField(value: self.payloadDetails, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_PayloadsDetails, rhs: Sharing_Nearby_PayloadsDetails) -> Bool { + if lhs.payloadDetails != rhs.payloadDetails {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_PayloadDetails: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PayloadDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .standard(proto: "creation_timestamp_millis"), + 3: .same(proto: "size"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt64Field(value: &self._id) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self._creationTimestampMillis) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &self._size) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._id { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._creationTimestampMillis { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 2) + } }() + try { if let v = self._size { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_PayloadDetails, rhs: Sharing_Nearby_PayloadDetails) -> Bool { + if lhs._id != rhs._id {return false} + if lhs._creationTimestampMillis != rhs._creationTimestampMillis {return false} + if lhs._size != rhs._size {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_PairedKeyEncryptionFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PairedKeyEncryptionFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "signed_data"), + 2: .standard(proto: "secret_id_hash"), + 3: .standard(proto: "optional_signed_data"), + 4: .standard(proto: "qr_code_handshake_data"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._signedData) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._secretIDHash) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._optionalSignedData) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self._qrCodeHandshakeData) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._signedData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._secretIDHash { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try { if let v = self._optionalSignedData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = self._qrCodeHandshakeData { + try visitor.visitSingularBytesField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_PairedKeyEncryptionFrame, rhs: Sharing_Nearby_PairedKeyEncryptionFrame) -> Bool { + if lhs._signedData != rhs._signedData {return false} + if lhs._secretIDHash != rhs._secretIDHash {return false} + if lhs._optionalSignedData != rhs._optionalSignedData {return false} + if lhs._qrCodeHandshakeData != rhs._qrCodeHandshakeData {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_PairedKeyResultFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PairedKeyResultFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "status"), + 2: .standard(proto: "os_type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._status) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self._osType) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._status { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } }() + try { if let v = self._osType { + try visitor.visitSingularEnumField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_PairedKeyResultFrame, rhs: Sharing_Nearby_PairedKeyResultFrame) -> Bool { + if lhs._status != rhs._status {return false} + if lhs._osType != rhs._osType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_PairedKeyResultFrame.Status: @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "SUCCESS"), + 2: .same(proto: "FAIL"), + 3: .same(proto: "UNABLE"), + ] +} + +extension Sharing_Nearby_CertificateInfoFrame: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CertificateInfoFrame" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "public_certificate"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.publicCertificate) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.publicCertificate.isEmpty { + try visitor.visitRepeatedMessageField(value: self.publicCertificate, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_CertificateInfoFrame, rhs: Sharing_Nearby_CertificateInfoFrame) -> Bool { + if lhs.publicCertificate != rhs.publicCertificate {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_PublicCertificate: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PublicCertificate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "secret_id"), + 2: .standard(proto: "authenticity_key"), + 3: .standard(proto: "public_key"), + 4: .standard(proto: "start_time"), + 5: .standard(proto: "end_time"), + 6: .standard(proto: "encrypted_metadata_bytes"), + 7: .standard(proto: "metadata_encryption_key_tag"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._secretID) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self._authenticityKey) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self._publicKey) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self._startTime) }() + case 5: try { try decoder.decodeSingularInt64Field(value: &self._endTime) }() + case 6: try { try decoder.decodeSingularBytesField(value: &self._encryptedMetadataBytes) }() + case 7: try { try decoder.decodeSingularBytesField(value: &self._metadataEncryptionKeyTag) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._secretID { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try { if let v = self._authenticityKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + } }() + try { if let v = self._publicKey { + try visitor.visitSingularBytesField(value: v, fieldNumber: 3) + } }() + try { if let v = self._startTime { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 4) + } }() + try { if let v = self._endTime { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 5) + } }() + try { if let v = self._encryptedMetadataBytes { + try visitor.visitSingularBytesField(value: v, fieldNumber: 6) + } }() + try { if let v = self._metadataEncryptionKeyTag { + try visitor.visitSingularBytesField(value: v, fieldNumber: 7) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_PublicCertificate, rhs: Sharing_Nearby_PublicCertificate) -> Bool { + if lhs._secretID != rhs._secretID {return false} + if lhs._authenticityKey != rhs._authenticityKey {return false} + if lhs._publicKey != rhs._publicKey {return false} + if lhs._startTime != rhs._startTime {return false} + if lhs._endTime != rhs._endTime {return false} + if lhs._encryptedMetadataBytes != rhs._encryptedMetadataBytes {return false} + if lhs._metadataEncryptionKeyTag != rhs._metadataEncryptionKeyTag {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_WifiCredentials: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WifiCredentials" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "password"), + 2: .standard(proto: "hidden_ssid"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._password) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._hiddenSsid) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._password { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } }() + try { if let v = self._hiddenSsid { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_WifiCredentials, rhs: Sharing_Nearby_WifiCredentials) -> Bool { + if lhs._password != rhs._password {return false} + if lhs._hiddenSsid != rhs._hiddenSsid {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Sharing_Nearby_StreamDetails: @preconcurrency SwiftProtobuf.Message, @preconcurrency SwiftProtobuf._MessageImplementationBase, @preconcurrency SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StreamDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "input_stream_parcel_file_descriptor_bytes"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self._inputStreamParcelFileDescriptorBytes) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._inputStreamParcelFileDescriptorBytes { + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Sharing_Nearby_StreamDetails, rhs: Sharing_Nearby_StreamDetails) -> Bool { + if lhs._inputStreamParcelFileDescriptorBytes != rhs._inputStreamParcelFileDescriptorBytes {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/airsync-mac/Core/QuickShare/QuickShareExtensions.swift b/airsync-mac/Core/QuickShare/QuickShareExtensions.swift new file mode 100644 index 00000000..f44d8968 --- /dev/null +++ b/airsync-mac/Core/QuickShare/QuickShareExtensions.swift @@ -0,0 +1,3 @@ +// +// QuickShareExtensions.swift +// diff --git a/airsync-mac/Core/QuickShare/QuickShareManager.swift b/airsync-mac/Core/QuickShare/QuickShareManager.swift new file mode 100644 index 00000000..b4751d15 --- /dev/null +++ b/airsync-mac/Core/QuickShare/QuickShareManager.swift @@ -0,0 +1,332 @@ +// +// QuickShareManager.swift +// AirSync +// + +import Foundation +import SwiftUI +import UserNotifications +@preconcurrency import Combine + +struct QuickShareTransferInfo { + let device: RemoteDeviceInfo + let transfer: TransferMetadata +} + +@MainActor +public class QuickShareManager: NSObject, ObservableObject, MainAppDelegate, ShareExtensionDelegate { + public static let shared = QuickShareManager() + @Published public var isEnabled: Bool = UserDefaults.standard.bool(forKey: "quickShareEnabled") { + didSet { + UserDefaults.standard.set(isEnabled, forKey: "quickShareEnabled") + if isEnabled { + startService() + } else { + stopService() + } + } + } + + @Published public var isRunning: Bool = false + @Published public var discoveredDevices: [RemoteDeviceInfo] = [] + @Published public var transferState: TransferState = .idle + @Published public var transferProgress: Double = 0 + @Published public var lastPinCode: String? + @Published public var transferURLs: [URL] = [] + @Published public var autoTargetDeviceName: String? + + public enum TransferState: Equatable { + case idle + case discovering + case connecting(String) // deviceID + case awaitingPin(String, String) // pin, deviceID + case sending(String) // deviceID + case receiving(String) // transferID + case incomingAwaitingConsent(TransferMetadata, RemoteDeviceInfo) + case finished + case failed(String) + } + + private var activeIncomingTransfers: [String: QuickShareTransferInfo] = [:] + + override private init() { + super.init() + NearbyConnectionManager.shared.mainAppDelegate = self + if isEnabled { + startService() + } + } + + public var deviceName: String { + return UserDefaults.standard.string(forKey: "deviceName") ?? Host.current().localizedName ?? "Mac" + } + + // MARK: - Lifecycle + + public func startService() { + guard !isRunning else { return } + registerNotificationCategories() + NearbyConnectionManager.shared.mainAppDelegate = self + NearbyConnectionManager.shared.becomeVisible() + isRunning = true + print("[quickshare] Service started — visible as '\(deviceName)'") + } + + public func stopService() { + isRunning = false + // Currently NearbyConnectionManager doesn't have a stopVisibility, + // but we can at least stop discovery and incoming handles + print("[quickshare] Service stopped") + } + + private func registerNotificationCategories() { + let center = UNUserNotificationCenter.current() + let acceptAction = UNNotificationAction( + identifier: "QUICKSHARE_ACCEPT", + title: Localizer.shared.text("quickshare.accept"), + options: .authenticationRequired + ) + let declineAction = UNNotificationAction( + identifier: "QUICKSHARE_DECLINE", + title: Localizer.shared.text("quickshare.decline") + ) + let incomingCategory = UNNotificationCategory( + identifier: "INCOMING_TRANSFERS", + actions: [acceptAction, declineAction], + intentIdentifiers: [] + ) + center.setNotificationCategories([incomingCategory]) + } + + // MARK: - Outbound Discovery + + public func startDiscovery(autoTargetName: String? = nil) { + discoveredDevices.removeAll() + transferURLs.removeAll() // Clear old URLs + self.autoTargetDeviceName = autoTargetName + transferState = .discovering + NearbyConnectionManager.shared.addShareExtensionDelegate(self) + NearbyConnectionManager.shared.startDeviceDiscovery() + } + + public func stopDiscovery() { + NearbyConnectionManager.shared.stopDeviceDiscovery() + NearbyConnectionManager.shared.removeShareExtensionDelegate(self) + discoveredDevices.removeAll() + self.autoTargetDeviceName = nil + + switch transferState { + case .discovering, .connecting, .awaitingPin, .sending, .receiving, .incomingAwaitingConsent: + cancelActiveTransfer() + default: + break + } + } + + public func cancelActiveTransfer() { + switch transferState { + case .connecting(let id), .awaitingPin(_, let id), .sending(let id): + NearbyConnectionManager.shared.cancelOutgoingTransfer(id: id) + transferState = .idle + AppState.shared.showingQuickShareTransfer = false + case .receiving(let id): + NearbyConnectionManager.shared.cancelIncomingTransfer(id: id) + transferState = .idle + AppState.shared.showingQuickShareTransfer = false + case let .incomingAwaitingConsent(meta, _): + NearbyConnectionManager.shared.cancelIncomingTransfer(id: meta.id) + transferState = .idle + AppState.shared.showingQuickShareTransfer = false + UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: ["transfer_" + meta.id]) + UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: ["transfer_" + meta.id]) + default: + transferState = .idle + AppState.shared.showingQuickShareTransfer = false + } + } + + public func sendFiles(urls: [URL], to device: RemoteDeviceInfo) { + guard let deviceID = device.id else { return } + transferState = .connecting(deviceID) + transferProgress = 0 + NearbyConnectionManager.shared.startOutgoingTransfer(deviceID: deviceID, delegate: self, urls: urls) + } + + public func generateQrCodeKey() -> String { + return NearbyConnectionManager.shared.generateQrCodeKey() + } + + public func clearQrCodeKey() { + NearbyConnectionManager.shared.clearQrCodeKey() + } + + // MARK: - MainAppDelegate (Incoming) + + public func obtainUserConsent(for transfer: TransferMetadata, from device: RemoteDeviceInfo) { + // Auto-accept if enabled and sender matches connected device + if AppState.shared.autoAcceptQuickShare, + let connectedDeviceName = AppState.shared.device?.name, + device.name == connectedDeviceName { + print("[quickshare] Auto-accepting transfer \(transfer.id) from \(device.name)") + handleUserConsent(transferID: transfer.id, accepted: true) + return + } + + let fileStr: String = { + if let textTitle = transfer.textDescription { + return textTitle + } else if transfer.files.count == 1 { + return transfer.files[0].name + } else { + return String(format: Localizer.shared.text("quickshare.n_files"), transfer.files.count) + } + }() + + self.transferState = .incomingAwaitingConsent(transfer, device) + AppState.shared.showingQuickShareTransfer = true + + let content = UNMutableNotificationContent() + content.title = Localizer.shared.text("app.name") + content.subtitle = String(format: Localizer.shared.text("quickshare.pin_code"), transfer.pinCode ?? "") + content.body = String(format: Localizer.shared.text("quickshare.device_sending_files"), device.name, fileStr) + content.sound = UNNotificationSound(named: UNNotificationSoundName("Submarine.aiff")) + content.categoryIdentifier = "INCOMING_TRANSFERS" + content.userInfo = [ + "type": "quickshare", + "transferID": transfer.id + ] + + content.setValue(false, forKey: "hasDefaultAction") + + let request = UNNotificationRequest(identifier: "transfer_" + transfer.id, content: content, trigger: nil) + UNUserNotificationCenter.current().add(request) + + self.activeIncomingTransfers[transfer.id] = QuickShareTransferInfo(device: device, transfer: transfer) + } + + public func incomingTransfer(id: String, didFinishWith error: Error?) { + if let error = error { + let content = UNMutableNotificationContent() + content.title = Localizer.shared.text("transfer_failed") + content.body = error.localizedDescription + content.sound = .default + let request = UNNotificationRequest(identifier: "transfer_error_" + id, content: content, trigger: nil) + UNUserNotificationCenter.current().add(request) + + self.transferState = .failed(error.localizedDescription) + + DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { + AppState.shared.showingQuickShareTransfer = false + self.transferState = .idle + } + } + + UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: ["transfer_" + id]) + UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: ["transfer_" + id]) + activeIncomingTransfers.removeValue(forKey: id) + } + + public func transferDidComplete(id: String) { + print("[quickshare] Transfer \(id) completed on disk") + self.transferState = .finished + self.transferProgress = 1.0 + + DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { + AppState.shared.showingQuickShareTransfer = false + self.transferState = .idle + } + } + + public func handleUserConsent(transferID: String, accepted: Bool) { + NearbyConnectionManager.shared.submitUserConsent(transferID: transferID, accept: accepted) + if !accepted { + activeIncomingTransfers.removeValue(forKey: transferID) + if case .incomingAwaitingConsent(let meta, _) = transferState, meta.id == transferID { + transferState = .idle + AppState.shared.showingQuickShareTransfer = false + UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: ["transfer_" + transferID]) + UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: ["transfer_" + transferID]) + } + } else { + if case .incomingAwaitingConsent(let meta, _) = transferState, meta.id == transferID { + transferState = .receiving(transferID) + transferProgress = 0 + UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: ["transfer_" + transferID]) + UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: ["transfer_" + transferID]) + } + } + } + + public func incomingTransferProgress(id: String, progress: Double) { + self.transferProgress = progress + if case .receiving(let activeID) = transferState, activeID == id { + // Already in receiving state + } else { + transferState = .receiving(id) + } + } + + // MARK: - ShareExtensionDelegate (Outgoing) + + public func addDevice(device: RemoteDeviceInfo) { + if !discoveredDevices.contains(where: { $0.id == device.id }) { + discoveredDevices.append(device) + + // If auto-targeting is active and name matches, start transfer + if let targetName = autoTargetDeviceName, device.name == targetName { + print("[quickshare] Auto-targeting found device '\(device.name)', starting transfer") + self.autoTargetDeviceName = nil // Clear so it doesn't trigger again + sendFiles(urls: self.transferURLs, to: device) + } + } + } + + public func removeDevice(id: String) { + discoveredDevices.removeAll(where: { $0.id == id }) + } + + public func startTransferWithQrCode(device: RemoteDeviceInfo) { + addDevice(device: device) + } + + public func connectionWasEstablished(pinCode: String) { + let deviceID = caseDiscoveryID() ?? "unknown" + lastPinCode = pinCode + transferState = .awaitingPin(pinCode, deviceID) + } + + private func caseDiscoveryID() -> String? { + switch transferState { + case .connecting(let id), .awaitingPin(_, let id), .sending(let id): + return id + default: + return nil + } + } + + public func connectionFailed(with error: Error) { + transferState = .failed(error.localizedDescription) + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { + AppState.shared.showingQuickShareTransfer = false + self.transferState = .idle + } + } + + public func transferAccepted() { + if let id = caseDiscoveryID() { + transferState = .sending(id) + } + } + + public func transferProgress(progress: Double) { + self.transferProgress = progress + } + + public func transferFinished() { + transferState = .finished + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + AppState.shared.showingQuickShareTransfer = false + self.transferState = .idle + } + } +} diff --git a/airsync-mac/Core/QuickShare/SymmetricKey+Extensions.swift b/airsync-mac/Core/QuickShare/SymmetricKey+Extensions.swift new file mode 100644 index 00000000..372a78b5 --- /dev/null +++ b/airsync-mac/Core/QuickShare/SymmetricKey+Extensions.swift @@ -0,0 +1,15 @@ +// +// SymmetricKey+Extensions.swift +// NearbyShare +// +// Created by Grishka on 06.08.2025. +// + +import Foundation +import CryptoKit + +extension SymmetricKey{ + func data() -> Data{ + return withUnsafeBytes({return Data(bytes: $0.baseAddress!, count: $0.count)}) + } +} diff --git a/airsync-mac/Core/Trial/TrialManager.swift b/airsync-mac/Core/Trial/TrialManager.swift index a49283ef..85b115bf 100644 --- a/airsync-mac/Core/Trial/TrialManager.swift +++ b/airsync-mac/Core/Trial/TrialManager.swift @@ -1,6 +1,6 @@ import Foundation import SwiftUI -internal import Combine +import Combine @MainActor final class TrialManager: ObservableObject { diff --git a/airsync-mac/Core/Util/FileTransfer/FileTransferUtil.swift b/airsync-mac/Core/Util/FileTransfer/FileTransferUtil.swift deleted file mode 100644 index 1f25bca6..00000000 --- a/airsync-mac/Core/Util/FileTransfer/FileTransferUtil.swift +++ /dev/null @@ -1,253 +0,0 @@ -// -// FileTransferUtil.swift -// AirSync -// -// Created by Sameera Sandakelum on 2025-08-16. -// - -import SwiftUI - -extension AppState { - enum TransferDirection: String, Codable { case outgoing, incoming } - enum TransferStatus: Equatable { - case inProgress - case completed(verified: Bool?) - case failed(reason: String) - } - - struct FileTransferSession: Identifiable, Equatable { - let id: String - let name: String - let size: Int - let mime: String - let direction: TransferDirection - var bytesTransferred: Int - var chunkSize: Int - let startedAt: Date - var estimatedTimeRemaining: TimeInterval? // smoothed - var smoothedSpeed: Double? - var lastUpdateTime: Date - var bytesSinceLastUpdate: Int - var status: TransferStatus - - var progress: Double { - guard size > 0 else { return 0 } - return min(1.0, Double(bytesTransferred) / Double(size)) - } - } - - func startOutgoingTransfer(id: String, name: String, size: Int, mime: String, chunkSize: Int) { - DispatchQueue.main.async { - self.transfers[id] = FileTransferSession( - id: id, - name: name, - size: size, - mime: mime, - direction: .outgoing, - bytesTransferred: 0, - chunkSize: chunkSize, - startedAt: Date(), - lastUpdateTime: Date(), - bytesSinceLastUpdate: 0, - status: .inProgress - ) - - // Auto-show dialog if enabled - if self.showFileShareDialog { - self.activeTransferId = id - self.transferDismissTimer?.invalidate() - self.transferDismissTimer = nil - } - } - } - - func startIncomingTransfer(id: String, name: String, size: Int, mime: String) { - DispatchQueue.main.async { - self.transfers[id] = FileTransferSession( - id: id, - name: name, - size: size, - mime: mime, - direction: .incoming, - bytesTransferred: 0, - chunkSize: 0, - startedAt: Date(), - lastUpdateTime: Date(), - bytesSinceLastUpdate: 0, - status: .inProgress - ) - - // Auto-show dialog if enabled - if self.showFileShareDialog { - self.activeTransferId = id - self.transferDismissTimer?.invalidate() - self.transferDismissTimer = nil - } - } - } - - func updateOutgoingProgress(id: String, bytesTransferred: Int) { - DispatchQueue.main.async { - guard var s = self.transfers[id] else { return } - let now = Date() - let timeDiff = now.timeIntervalSince(s.lastUpdateTime) - let bytesDiff = bytesTransferred - s.bytesTransferred - - s.bytesTransferred = min(bytesTransferred, s.size) - s.bytesSinceLastUpdate += bytesDiff - - // Update speed / ETA every 1 second - if timeDiff >= 1.0 { - let intervalSpeed = Double(s.bytesSinceLastUpdate) / timeDiff - - let alpha = 0.4 - if let oldSpeed = s.smoothedSpeed { - s.smoothedSpeed = alpha * intervalSpeed + (1.0 - alpha) * oldSpeed - } else { - s.smoothedSpeed = intervalSpeed - } - - s.lastUpdateTime = now - s.bytesSinceLastUpdate = 0 - - // Calculate ETA - if let speed = s.smoothedSpeed, speed > 0 { - let remainingBytes = Double(s.size - s.bytesTransferred) - let newEta = remainingBytes / speed - s.estimatedTimeRemaining = newEta - } - } - - self.transfers[id] = s - } - } - - func updateIncomingProgress(id: String, receivedBytes: Int) { - DispatchQueue.main.async { - guard var s = self.transfers[id] else { return } - let now = Date() - let timeDiff = now.timeIntervalSince(s.lastUpdateTime) - let bytesDiff = receivedBytes - s.bytesTransferred - - s.bytesTransferred = min(receivedBytes, s.size) - s.bytesSinceLastUpdate += bytesDiff - - // Update speed / ETA every 1 second - if timeDiff >= 1.0 { - let intervalSpeed = Double(s.bytesSinceLastUpdate) / timeDiff - - let alpha = 0.4 - if let oldSpeed = s.smoothedSpeed { - s.smoothedSpeed = alpha * intervalSpeed + (1.0 - alpha) * oldSpeed - } else { - s.smoothedSpeed = intervalSpeed - } - - s.lastUpdateTime = now - s.bytesSinceLastUpdate = 0 - - if let speed = s.smoothedSpeed, speed > 0 { - let remaining = Double(s.size - s.bytesTransferred) - s.estimatedTimeRemaining = remaining / speed - } - } - - self.transfers[id] = s - } - } - - func completeIncoming(id: String, verified: Bool?) { - DispatchQueue.main.async { - guard var s = self.transfers[id] else { return } - s.bytesTransferred = s.size - s.status = .completed(verified: verified) - self.transfers[id] = s - - // Auto-dismiss after 10s if this is the active one - if self.activeTransferId == id { - self.scheduleTransferDismiss() - } - } - } - - func completeOutgoingVerified(id: String, verified: Bool?) { - DispatchQueue.main.async { - guard var s = self.transfers[id] else { return } - s.status = .completed(verified: verified) - self.transfers[id] = s - - // Auto-dismiss after 10s if this is the active one - if self.activeTransferId == id { - self.scheduleTransferDismiss() - } - } - } - - func failTransfer(id: String, reason: String) { - DispatchQueue.main.async { - guard var s = self.transfers[id] else { return } - s.status = .failed(reason: reason) - self.transfers[id] = s - - // Auto-dismiss failed transfers after 10s too, to let user see error - if self.activeTransferId == id { - self.scheduleTransferDismiss() - } - } - } - - /// Remove transfers that are completed (either verified or not). Leaves in-progress and failed transfers. - func removeCompletedTransfers() { - DispatchQueue.main.async { - for (id, session) in self.transfers { - switch session.status { - case .completed(_): - self.transfers.removeValue(forKey: id) - default: - break - } - } - } - } - func scheduleTransferDismiss() { - self.transferDismissTimer?.invalidate() - self.transferDismissTimer = Timer.scheduledTimer(withTimeInterval: 10.0, repeats: false) { [weak self] _ in - DispatchQueue.main.async { - self?.clearActiveTransfer() - } - } - } - - func clearActiveTransfer() { - self.activeTransferId = nil - self.transferDismissTimer?.invalidate() - self.transferDismissTimer = nil - } - - func cancelTransfer(id: String) { - // Send cancel message to remote - WebSocketServer.shared.sendTransferCancel(id: id) - failTransfer(id: id, reason: "Cancelled by user") - } - - func stopTransferRemote(id: String) { - failTransfer(id: id, reason: "Cancelled by receiver") - } - - func stopAllTransfers(reason: String) { - DispatchQueue.main.async { - for (id, session) in self.transfers { - if case .inProgress = session.status { - var s = session - s.status = .failed(reason: reason) - self.transfers[id] = s - } - } - // Clear active if any - if self.activeTransferId != nil { - self.scheduleTransferDismiss() - } - } - } -} - diff --git a/airsync-mac/Core/Util/MacInfo/MacInfoSyncManager.swift b/airsync-mac/Core/Util/MacInfo/MacInfoSyncManager.swift index 9cda6e59..2f6a7861 100644 --- a/airsync-mac/Core/Util/MacInfo/MacInfoSyncManager.swift +++ b/airsync-mac/Core/Util/MacInfo/MacInfoSyncManager.swift @@ -5,7 +5,7 @@ // Created by Sameera Sandakelum on 2025-09-17. // import Foundation -internal import Combine +import Combine import CryptoKit class MacInfoSyncManager: ObservableObject { diff --git a/airsync-mac/Core/Util/NotificationDelegate.swift b/airsync-mac/Core/Util/NotificationDelegate.swift index c28e0bca..b2a51ccb 100644 --- a/airsync-mac/Core/Util/NotificationDelegate.swift +++ b/airsync-mac/Core/Util/NotificationDelegate.swift @@ -8,6 +8,7 @@ import SwiftUI import UserNotifications +@MainActor class NotificationDelegate: NSObject, UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, didRemoveDeliveredNotifications identifiers: [String]) { @@ -48,6 +49,15 @@ class NotificationDelegate: NSObject, UNUserNotificationCenterDelegate { AppState.shared.removeCallEventById(eventId) } } + // Handle Quick Share notification actions + else if notificationType == "quickshare" { + let transferID = userInfo["transferID"] as? String ?? "" + if response.actionIdentifier == "QUICKSHARE_ACCEPT" { + QuickShareManager.shared.handleUserConsent(transferID: transferID, accepted: true) + } else if response.actionIdentifier == "QUICKSHARE_DECLINE" { + QuickShareManager.shared.handleUserConsent(transferID: transferID, accepted: false) + } + } // Handle link open else if response.actionIdentifier == "OPEN_LINK" { if let urlString = userInfo["url"] as? String, let url = URL(string: urlString) { diff --git a/airsync-mac/Core/Util/Remote/MacRemoteManager.swift b/airsync-mac/Core/Util/Remote/MacRemoteManager.swift index 88c360f3..37c8fe6e 100644 --- a/airsync-mac/Core/Util/Remote/MacRemoteManager.swift +++ b/airsync-mac/Core/Util/Remote/MacRemoteManager.swift @@ -10,7 +10,7 @@ import Cocoa import Carbon import AudioToolbox import CoreGraphics -internal import Combine +import Combine class MacRemoteManager: ObservableObject { static let shared = MacRemoteManager() diff --git a/airsync-mac/Core/WebSocket/WebSocketServer+Handlers.swift b/airsync-mac/Core/WebSocket/WebSocketServer+Handlers.swift index 7a18b38e..40ab86d1 100644 --- a/airsync-mac/Core/WebSocket/WebSocketServer+Handlers.swift +++ b/airsync-mac/Core/WebSocket/WebSocketServer+Handlers.swift @@ -351,17 +351,13 @@ extension WebSocketServer { FileManager.default.createFile(atPath: tempFile.path, contents: nil, attributes: nil) let handle = try? FileHandle(forWritingTo: tempFile) - let io = IncomingFileIO(tempUrl: tempFile, fileHandle: handle, chunkSize: chunkSize) + let io = IncomingFileIO(id: id, name: name, size: size, mime: mime, tempUrl: tempFile, fileHandle: handle, chunkSize: chunkSize) self.lock.lock() incomingFiles[id] = io if let checksum = checksum { incomingFilesChecksum[id] = checksum } self.lock.unlock() - - DispatchQueue.main.async { - AppState.shared.startIncomingTransfer(id: id, name: name, size: size, mime: mime) - } } } @@ -377,7 +373,7 @@ extension WebSocketServer { let io = incomingFiles[id] self.lock.unlock() - if let io = io, let data = Data(base64Encoded: chunkBase64, options: .ignoreUnknownCharacters) { + if var io = io, let data = Data(base64Encoded: chunkBase64, options: .ignoreUnknownCharacters) { fileQueue.async { let offset = UInt64(index * io.chunkSize) if let fh = io.fileHandle { @@ -389,11 +385,11 @@ extension WebSocketServer { } } } - DispatchQueue.main.async { - let prev = AppState.shared.transfers[id]?.bytesTransferred ?? 0 - let newBytes = prev + data.count - AppState.shared.updateIncomingProgress(id: id, receivedBytes: newBytes) - } + + self.lock.lock() + io.bytesReceived += data.count + incomingFiles[id] = io + self.lock.unlock() } let ackMsg = FileTransferProtocol.buildChunkAck(id: id, index: index) @@ -421,19 +417,11 @@ extension WebSocketServer { print("[websocket] (file-transfer) Failed to get size for validation: \(error)") } - var expectedSize: Int = 0 - var resolvedName = state.tempUrl.lastPathComponent - DispatchQueue.main.sync { - if let t = AppState.shared.transfers[id] { - expectedSize = t.size - resolvedName = t.name - } - } + let expectedSize = state.size + let resolvedName = state.name if Int(totalBytes) != expectedSize { - DispatchQueue.main.async { - AppState.shared.failTransfer(id: id, reason: "Size mismatch: \(totalBytes)/\(expectedSize)") - } + print("[websocket] (file-transfer) Size mismatch for \(resolvedName): \(totalBytes)/\(expectedSize)") try? FileManager.default.removeItem(at: state.tempUrl) self.lock.lock() self.incomingFiles.removeValue(forKey: id) @@ -482,7 +470,6 @@ extension WebSocketServer { try FileManager.default.moveItem(at: state.tempUrl, to: finalDest) DispatchQueue.main.async { - AppState.shared.completeIncoming(id: id, verified: nil) AppState.shared.postNativeNotification( id: "incoming_file_\(id)", appName: "AirSync", @@ -680,7 +667,6 @@ extension WebSocketServer { if let dict = message.data.value as? [String: Any], let id = dict["id"] as? String, let verified = dict["verified"] as? Bool { - AppState.shared.completeOutgoingVerified(id: id, verified: verified) AppState.shared.postNativeNotification( id: "transfer_verified_\(id)", appName: "AirSync", @@ -693,9 +679,7 @@ extension WebSocketServer { private func handleFileTransferCancel(_ message: Message) { if let dict = message.data.value as? [String: Any], let id = dict["id"] as? String { - DispatchQueue.main.async { - AppState.shared.stopTransferRemote(id: id) - } + print("[websocket] Transfer \(id) cancelled by remote.") } } diff --git a/airsync-mac/Core/WebSocket/WebSocketServer+Models.swift b/airsync-mac/Core/WebSocket/WebSocketServer+Models.swift index 7c9dbdc0..f2fb37a4 100644 --- a/airsync-mac/Core/WebSocket/WebSocketServer+Models.swift +++ b/airsync-mac/Core/WebSocket/WebSocketServer+Models.swift @@ -15,8 +15,13 @@ enum WebSocketStatus { extension WebSocketServer { struct IncomingFileIO { + var id: String + var name: String + var size: Int + var mime: String var tempUrl: URL var fileHandle: FileHandle? var chunkSize: Int + var bytesReceived: Int = 0 } } diff --git a/airsync-mac/Core/WebSocket/WebSocketServer+Outgoing.swift b/airsync-mac/Core/WebSocket/WebSocketServer+Outgoing.swift index 1ff38a03..cf485a60 100644 --- a/airsync-mac/Core/WebSocket/WebSocketServer+Outgoing.swift +++ b/airsync-mac/Core/WebSocket/WebSocketServer+Outgoing.swift @@ -225,7 +225,6 @@ extension WebSocketServer { try? fileHandle.seek(toOffset: 0) let transferId = UUID().uuidString - AppState.shared.startOutgoingTransfer(id: transferId, name: fileName, size: totalSize, mime: mime, chunkSize: chunkSize) let initMessage = FileTransferProtocol.buildInit(id: transferId, name: fileName, size: Int64(totalSize), mime: mime, chunkSize: chunkSize, checksum: checksum, isClipboard: isClipboard) self.sendToFirstAvailable(message: initMessage) @@ -252,24 +251,11 @@ extension WebSocketServer { baseIndex += 1 } - let bytesAcked = min(baseIndex * chunkSize, totalSize) - DispatchQueue.main.async { - AppState.shared.updateOutgoingProgress(id: transferId, bytesTransferred: bytesAcked) - } + let _ = min(baseIndex * chunkSize, totalSize) if baseIndex >= totalChunks { break } while nextIndexToSend < totalChunks && (nextIndexToSend - baseIndex) < windowSize { - var isCancelled = false - DispatchQueue.main.sync { - if let t = AppState.shared.transfers[transferId], t.status != .inProgress { - isCancelled = true - } - } - if isCancelled { - transferFailed = true - break - } // sendChunkAt logic let offset = UInt64(nextIndexToSend * chunkSize) @@ -292,13 +278,7 @@ extension WebSocketServer { if acked.contains(idx) { continue } let elapsedMs = now.timeIntervalSince(entry.lastSent) * 1000.0 if elapsedMs > Double(self.ackWaitMs) { - if entry.attempts >= self.maxChunkRetries { - DispatchQueue.main.async { - AppState.shared.failTransfer(id: transferId, reason: "Multiple retries failed for chunk \(idx)") - } - transferFailed = true - break - } + print("[websocket] Multiple retries failed for chunk \(idx)") let chunkMessage = FileTransferProtocol.buildChunk(id: transferId, index: idx, base64Chunk: entry.payload) self.sendToFirstAvailable(message: chunkMessage) sentBuffer[idx] = (payload: entry.payload, attempts: entry.attempts + 1, lastSent: Date()) @@ -310,9 +290,6 @@ extension WebSocketServer { try? fileHandle.close() if !transferFailed { - DispatchQueue.main.async { - AppState.shared.updateOutgoingProgress(id: transferId, bytesTransferred: totalSize) - } let completeMessage = FileTransferProtocol.buildComplete(id: transferId, name: fileName, size: Int64(totalSize), checksum: checksum) self.sendToFirstAvailable(message: completeMessage) } diff --git a/airsync-mac/Core/WebSocket/WebSocketServer.swift b/airsync-mac/Core/WebSocket/WebSocketServer.swift index d96a5df3..daf151e4 100644 --- a/airsync-mac/Core/WebSocket/WebSocketServer.swift +++ b/airsync-mac/Core/WebSocket/WebSocketServer.swift @@ -9,7 +9,7 @@ import Foundation import Swifter import CryptoKit import UserNotifications -internal import Combine +import Combine class WebSocketServer: ObservableObject { static let shared = WebSocketServer() diff --git a/airsync-mac/Localization/Localizer.swift b/airsync-mac/Localization/Localizer.swift index 96489015..b2513b91 100644 --- a/airsync-mac/Localization/Localizer.swift +++ b/airsync-mac/Localization/Localizer.swift @@ -1,6 +1,6 @@ import Foundation import SwiftUI -internal import Combine +import Combine /// Simple JSON-based localization loader. /// Loads `en.json` as base and overlays with current locale file if available. @@ -35,7 +35,7 @@ final class Localizer: ObservableObject { } } - func text(_ key: String) -> String { strings[key] ?? key } + public func text(_ key: String) -> String { strings[key] ?? key } } /// Convenience SwiftUI helper @@ -44,4 +44,4 @@ extension Text { } /// Helper function -func L(_ key: String) -> String { Localizer.shared.text(key) } +public func L(_ key: String) -> String { Localizer.shared.text(key) } diff --git a/airsync-mac/Localization/en.json b/airsync-mac/Localization/en.json index 2d79eb0c..b7932f93 100644 --- a/airsync-mac/Localization/en.json +++ b/airsync-mac/Localization/en.json @@ -26,5 +26,34 @@ "status.volume": "Volume", "media.play": "Play", "media.pause": "Pause", - "settings.wiredAdb": "Wired ADB support" + "settings.wiredAdb": "Wired ADB support", + "quickshare.title": "Quick Share", + "quickshare.button": "Quick Share", + "quickshare.settings.title": "Quick Share Settings", + "quickshare.settings.enabled": "Enable Quick Share", + "quickshare.settings.discoverable": "Discoverable as %@", + "quickshare.accept": "Accept", + "quickshare.decline": "Decline", + "quickshare.deviceSending": "%1$@ is sending %2$@", + "quickshare.error.protocol": "Protocol error", + "quickshare.error.crypto": "Encryption error", + "quickshare.transferError": "Transfer error with %@", + "quickshare.settings.autoAccept": "Auto accept from my device", + "quickshare.waiting_for": "Waiting for %1$@...", + "quickshare.select_device": "Select a device", + "quickshare.searching": "Searching for nearby devices...", + "quickshare.more_devices": "More devices", + "quickshare.cancel": "Cancel", + "quickshare.done": "Done", + "quickshare.sending": "Sending...", + "quickshare.receiving": "Receiving...", + "quickshare.confirm_pin": "Confirm PIN on your device", + "quickshare.finished": "Transfer Finished!", + "quickshare.failed": "Transfer Failed", + "quickshare.pin_code": "PIN: %@", + "quickshare.device_sending_files": "%1$@ is sending %2$@", + "quickshare.n_files": "%d files", + "quickshare.drop.send_to": "Send to %@", + "quickshare.drop.pick_device": "Pick a device to send", + "settings.quickshare": "Quick Share" } diff --git a/airsync-mac/Model/TabIdentifier.swift b/airsync-mac/Model/TabIdentifier.swift index 4d2e3ce1..89326c06 100644 --- a/airsync-mac/Model/TabIdentifier.swift +++ b/airsync-mac/Model/TabIdentifier.swift @@ -10,7 +10,6 @@ import SwiftUI enum TabIdentifier: String, CaseIterable, Identifiable { case notifications = "notifications.tab" case apps = "apps.tab" - case transfers = "transfers.tab" case settings = "settings.tab" case qr = "qr.tab" @@ -20,7 +19,6 @@ enum TabIdentifier: String, CaseIterable, Identifiable { switch self { case .notifications: return "bell.badge" case .apps: return "app" - case .transfers: return "tray.and.arrow.up" case .settings: return "gear" case .qr: return "qrcode" } @@ -30,7 +28,6 @@ enum TabIdentifier: String, CaseIterable, Identifiable { switch self { case .notifications: return "1" case .apps: return "2" - case .transfers: return "3" case .settings: return "," case .qr: return "." } @@ -42,7 +39,6 @@ enum TabIdentifier: String, CaseIterable, Identifiable { tabs.remove(at: 0) tabs.insert(.notifications, at: 0) tabs.insert(.apps, at: 1) - tabs.insert(.transfers, at: 2) } return tabs } diff --git a/airsync-mac/Screens/HomeScreen/AppContentView.swift b/airsync-mac/Screens/HomeScreen/AppContentView.swift index 32c37141..90dbd6f2 100644 --- a/airsync-mac/Screens/HomeScreen/AppContentView.swift +++ b/airsync-mac/Screens/HomeScreen/AppContentView.swift @@ -82,24 +82,6 @@ struct AppContentView: View { } .tag(TabIdentifier.apps) - // Transfers Tab - TransfersView() - .tabItem { - Image(systemName: "tray.and.arrow.up") - // Label("Transfers", systemImage: "tray.and.arrow.up") - } - .tag(TabIdentifier.transfers) - .toolbar { - ToolbarItem(placement: .primaryAction) { - Button { - AppState.shared.removeCompletedTransfers() - } label: { - Label("Clear completed", systemImage: "trash") - } - .help("Remove all completed transfers from the list") - .keyboardShortcut(.delete, modifiers: .command) - } - } } // Settings Tab diff --git a/airsync-mac/Screens/HomeScreen/Components/FileTransferWindowView.swift b/airsync-mac/Screens/HomeScreen/Components/FileTransferWindowView.swift deleted file mode 100644 index bd9d2f91..00000000 --- a/airsync-mac/Screens/HomeScreen/Components/FileTransferWindowView.swift +++ /dev/null @@ -1,213 +0,0 @@ -import SwiftUI - -struct FileTransferWindowView: View { - @EnvironmentObject var appState: AppState - @Environment(\.dismissWindow) var dismissWindow - - private var session: AppState.FileTransferSession? { - guard let id = appState.activeTransferId else { return nil } - return appState.transfers[id] - } - - private var isCompleted: Bool { - if let status = session?.status { - if case .completed = status { return true } - } - return false - } - - private var isFailed: Bool { - if let status = session?.status { - if case .failed = status { return true } - } - return false - } - - private var progress: Double { - session?.progress ?? 0 - } - - var body: some View { - ZStack { - if let session = session { - VStack(spacing: 24) { - - // Header removed - set as window title instead - - // Circular Progress Area - ZStack { - // Background Ring - Circle() - .stroke(lineWidth: 8) - .opacity(0.15) - .foregroundColor(isFailed ? .red : .primary) - - // Progress Ring - Circle() - .trim(from: 0.0, to: CGFloat(progress)) - .stroke(style: StrokeStyle(lineWidth: 8, lineCap: .round, lineJoin: .round)) - .foregroundColor(isFailed ? .red : .blue) - .rotationEffect(Angle(degrees: 270.0)) - .animation(.linear, value: progress) - - // Center Content - ZStack(alignment: .bottom) { - Image(systemName: "doc.fill") - .font(.system(size: 42)) - .foregroundColor(isFailed ? .red : .primary.opacity(0.8)) - .offset(y: -4) - - HStack(spacing: 4) { - Image(systemName: session.direction == .outgoing ? "arrow.up" : "arrow.down") - .font(.system(size: 10, weight: .bold)) - Text("\(Int(progress * 100))%") - .font(.system(size: 11, weight: .bold)) - .monospacedDigit() - } - .padding(.horizontal, 8) - .padding(.vertical, 4) - .background(.thinMaterial) - .clipShape(Capsule()) - .shadow(radius: 2) - .offset(y: 20) - } - } - .frame(width: 140, height: 140) - - // File Name - VStack(spacing: 6) { - Text(session.name) - .font(.system(size: 14, weight: .regular)) - .lineLimit(1) - .truncationMode(.middle) - .padding(.horizontal) - .opacity(0.8) - - if !isCompleted && !isFailed { - if let eta = session.estimatedTimeRemaining { - Text(formatTime(eta)) - .font(.caption) - .foregroundStyle(.secondary) - } else { - Text("Calculating...") - .font(.caption) - .foregroundStyle(.tertiary) - } - } - } - - // Actions - HStack(spacing: 12) { - if isCompleted { - if session.direction == .incoming { - GlassButtonView(label: "Open", systemImage: "arrow.up.forward.app", size:.large) { - openFile(session.name) - } - GlassButtonView(label: "Locate", systemImage: "folder", size:.large) { - locateFile(session.name) - } - } - - GlassButtonView( - label: "Done", - systemImage: "checkmark", - size:.large, - primary: true - ) { - appState.clearActiveTransfer() - } - } else if isFailed { - GlassButtonView(label: "Close", systemImage: "xmark", size:.large) { - appState.clearActiveTransfer() - } - } else { - // In Progress - GlassButtonView(label: "Hide", systemImage: "eye.slash", size:.large) { - appState.activeTransferId = nil - } - - GlassButtonView(label: "Cancel", systemImage: "xmark.circle.fill", size:.large) { - appState.cancelTransfer(id: session.id) - } - .foregroundStyle(.red) - } - } - .padding(.bottom, 20) - } - .padding(24) - } else { - Color.clear - .onAppear { - dismissWindow() - } - } - } - .onAppear { - NSWindow.allowsAutomaticWindowTabbing = false - } - .onChange(of: appState.activeTransferId) { _, newValue in - if newValue == nil { - dismissWindow() - } - } - .background(FileTransferWindowAccessor(title: headerText, callback: { window in - window.level = .floating - window.collectionBehavior = [.moveToActiveSpace, .fullScreenAuxiliary, .transient] - window.isReleasedWhenClosed = false - window.titleVisibility = .visible - window.title = headerText - })) - } - - private var headerText: String { - guard let s = session, let deviceName = appState.device?.name else { return "File Transfer" } - return s.direction == .outgoing ? "Sending to \(deviceName)..." : "Receiving from \(deviceName)..." - } - - private func formatTime(_ seconds: TimeInterval) -> String { - if seconds < 60 { - return String(format: "%.0fs remaining", seconds) - } else { - let mins = Int(seconds / 60) - let secs = Int(seconds.truncatingRemainder(dividingBy: 60)) - return String(format: "%dm %02ds remaining", mins, secs) - } - } - - private func openFile(_ filename: String) { - if let downloads = FileManager.default.urls(for: .downloadsDirectory, in: .userDomainMask).first { - let fileURL = downloads.appendingPathComponent(filename) - NSWorkspace.shared.open(fileURL) - } - // Dismiss after action? User might want to locate too. Keep open. - } - - private func locateFile(_ filename: String) { - if let downloads = FileManager.default.urls(for: .downloadsDirectory, in: .userDomainMask).first { - let fileURL = downloads.appendingPathComponent(filename) - NSWorkspace.shared.activateFileViewerSelecting([fileURL]) - } - } -} - -struct FileTransferWindowAccessor: NSViewRepresentable { - var title: String - var callback: (NSWindow) -> Void - - func makeNSView(context: Context) -> NSView { - let nsView = NSView() - DispatchQueue.main.async { - if let window = nsView.window { - self.callback(window) - } - } - return nsView - } - - func updateNSView(_ nsView: NSView, context: Context) { - DispatchQueue.main.async { - nsView.window?.title = title - } - } -} - diff --git a/airsync-mac/Screens/HomeScreen/PhoneView/ConnectionStatusPill.swift b/airsync-mac/Screens/HomeScreen/PhoneView/ConnectionStatusPill.swift index d8610772..32bc5357 100644 --- a/airsync-mac/Screens/HomeScreen/PhoneView/ConnectionStatusPill.swift +++ b/airsync-mac/Screens/HomeScreen/PhoneView/ConnectionStatusPill.swift @@ -46,6 +46,16 @@ struct ConnectionStatusPill: View { removal: .opacity )) } + + if QuickShareManager.shared.isEnabled && QuickShareManager.shared.isRunning { + Image(systemName: "laptopcomputer.and.arrow.down") + .contentTransition(.symbolEffect(.replace)) + .help("Quick Share Ready") + .transition(.asymmetric( + insertion: .scale.combined(with: .opacity), + removal: .opacity + )) + } } } .padding(.horizontal, 10) @@ -56,6 +66,7 @@ struct ConnectionStatusPill: View { .animation(.spring(response: 0.4, dampingFraction: 0.8), value: appState.adbConnected) .animation(.spring(response: 0.4, dampingFraction: 0.8), value: appState.adbConnectionMode) .animation(.spring(response: 0.4, dampingFraction: 0.8), value: appState.isConnectedOverLocalNetwork) + .animation(.spring(response: 0.4, dampingFraction: 0.8), value: QuickShareManager.shared.isRunning) } .buttonStyle(.plain) .onHover { hovering in @@ -89,6 +100,7 @@ struct ConnectionStatusPill: View { struct ConnectionPillPopover: View { @ObservedObject var appState = AppState.shared + @ObservedObject var quickShareManager = QuickShareManager.shared @State private var currentIPAddress: String = "N/A" var body: some View { @@ -118,6 +130,13 @@ struct ConnectionPillPopover: View { text: appState.adbConnectionMode == .wired ? "Wired (USB)" : "Wireless" ) } + + HStack { + Label("QuickShare", systemImage: "laptopcomputer.and.arrow.down") + Spacer() + Toggle("", isOn: $quickShareManager.isEnabled) + .toggleStyle(.switch) + } } .padding(.bottom, 4) diff --git a/airsync-mac/Screens/HomeScreen/PhoneView/QuickShareTransferSheet.swift b/airsync-mac/Screens/HomeScreen/PhoneView/QuickShareTransferSheet.swift new file mode 100644 index 00000000..30fb59c3 --- /dev/null +++ b/airsync-mac/Screens/HomeScreen/PhoneView/QuickShareTransferSheet.swift @@ -0,0 +1,204 @@ +import SwiftUI +import AppKit +import Foundation + +@MainActor +struct QuickShareTransferSheet: View { + @ObservedObject var manager = QuickShareManager.shared + @ObservedObject var appState = AppState.shared + + var body: some View { + ZStack { + VisualEffectBlur(material: NSVisualEffectView.Material.hudWindow, blendingMode: NSVisualEffectView.BlendingMode.behindWindow) + .edgesIgnoringSafeArea(Edge.Set.all) + + VStack(spacing: 20) { + + if manager.transferState == .discovering { + VStack(alignment: .leading, spacing: 10) { + if let targetName = manager.autoTargetDeviceName { + // Special Auto-Targeting UI for Menubar/Drop + VStack(spacing: 20) { + HStack { + VStack(alignment: .leading, spacing: 4) { + Text(String(format: Localizer.shared.text("quickshare.waiting_for"), targetName)) + .font(.subheadline).bold() + Text(Localizer.shared.text("quickshare.searching")) + .font(.caption) + .foregroundStyle(.secondary) + } + Spacer() + ProgressView() + .controlSize(.small) + } + + HStack(spacing: 12) { + GlassButtonView(label: Localizer.shared.text("quickshare.more_devices"), size: .regular) { + manager.autoTargetDeviceName = nil + } + + GlassButtonView(label: Localizer.shared.text("quickshare.cancel"), size: .regular) { + manager.stopDiscovery() + appState.showingQuickShareTransfer = false + } + } + } + // .frame(minHeight: 150) + } else { + // Default Device Selection UI + HStack { + Text(Localizer.shared.text("quickshare.select_device")) + .font(.subheadline) + Spacer() + ProgressView() + .controlSize(.small) + } + + RadarView(devices: manager.discoveredDevices) { device in + manager.sendFiles(urls: manager.transferURLs, to: device) + } + .frame(height: 250) + + GlassButtonView(label: Localizer.shared.text("quickshare.cancel"), size: .large) { + manager.stopDiscovery() + appState.showingQuickShareTransfer = false + } + } + } + } else { + transferStatusView + } + } + .padding(20) + } + + .frame(minWidth: 350) + .animation(.default, value: manager.transferState) + } + + private var transferStatusView: some View { + VStack(spacing: 15) { + + if case .awaitingPin(let pin, _) = manager.transferState { + VStack(spacing: 5) { + Text(Localizer.shared.text("quickshare.confirm_pin")) + .font(.subheadline) + Text(pin) + .font(.system(size: 32, weight: .bold, design: .monospaced)) + .padding() + .background(Color.secondary.opacity(0.1)) + .cornerRadius(10) + } + } else if case .receiving = manager.transferState { + VStack(spacing: 8) { + Text(Localizer.shared.text("quickshare.receiving")) + .font(.headline) + ProgressView(value: manager.transferProgress) + Text("\(Int(manager.transferProgress * 100))%") + .font(.caption) + } + } else if case .incomingAwaitingConsent(let metadata, let device) = manager.transferState { + VStack(spacing: 15) { + VStack(spacing: 5) { + Image(systemName: iconForDeviceType(device.type)) + .font(.system(size: 40)) + .padding(.bottom, 5) + Text(device.name) + .font(.subheadline).bold() + + let fileStr: String = { + if let textTitle = metadata.textDescription { + return textTitle + } else if metadata.files.count == 1 { + return metadata.files[0].name + } else { + return String(format: Localizer.shared.text("n_files"), metadata.files.count) + } + }() + + Text(fileStr) + .font(.caption) + .foregroundStyle(.secondary) + .multilineTextAlignment(.center) + } + + if let pin = metadata.pinCode { + Text(pin) + .font(.system(size: 24, weight: .bold, design: .monospaced)) + .padding(.horizontal, 15) + .padding(.vertical, 8) + .background(Color.secondary.opacity(0.1)) + .cornerRadius(8) + } + + HStack(spacing: 15) { + GlassButtonView(label: Localizer.shared.text("quickshare.decline"), size: .large) { + manager.handleUserConsent(transferID: metadata.id, accepted: false) + } + .foregroundStyle(.red) + + GlassButtonView(label: Localizer.shared.text("quickshare.accept"), size: .large, primary: true) { + manager.handleUserConsent(transferID: metadata.id, accepted: true) + } + .foregroundStyle(.green) + } + } + } else if case .sending = manager.transferState { + VStack(spacing: 8) { + Text(Localizer.shared.text("quickshare.sending")) + .font(.headline) + ProgressView(value: manager.transferProgress) + Text("\(Int(manager.transferProgress * 100))%") + .font(.caption) + } + } else if case .connecting = manager.transferState { + VStack(spacing: 8) { + ProgressView() + Text(Localizer.shared.text("quickshare.connecting")) + .font(.caption) + } + } else if manager.transferState == .finished { + VStack(spacing: 10) { + Image(systemName: "checkmark.circle.fill") + .font(.system(size: 48)) + .foregroundStyle(.green) + Text(Localizer.shared.text("quickshare.finished")) + .font(.headline) + } + } else if case .failed(let error) = manager.transferState { + VStack(spacing: 10) { + Image(systemName: "exclamationmark.triangle.fill") + .font(.system(size: 48)) + .foregroundStyle(.red) + Text(Localizer.shared.text("quickshare.failed")) + .font(.headline) + Text(error) + .font(.caption) + .foregroundStyle(.secondary) + .multilineTextAlignment(.center) + } + } + + if manager.transferState == .finished { + GlassButtonView(label: Localizer.shared.text("quickshare.done"), size: .large, primary: true) { + manager.stopDiscovery() + appState.showingQuickShareTransfer = false + } + } else if manager.transferState != .idle && manager.transferState != .finished { + GlassButtonView(label: Localizer.shared.text("quickshare.cancel"), size: .large) { + manager.stopDiscovery() + appState.showingQuickShareTransfer = false + } + } + } + } + + private func iconForDeviceType(_ type: RemoteDeviceInfo.DeviceType) -> String { + switch type { + case .phone: return "iphone" + case .tablet: return "ipad" + case .computer: return "macbook" + default: return "questionmark.circle" + } + } +} diff --git a/airsync-mac/Screens/HomeScreen/PhoneView/ScreenView.swift b/airsync-mac/Screens/HomeScreen/PhoneView/ScreenView.swift index 2a2f03b4..c455c670 100644 --- a/airsync-mac/Screens/HomeScreen/PhoneView/ScreenView.swift +++ b/airsync-mac/Screens/HomeScreen/PhoneView/ScreenView.swift @@ -39,19 +39,18 @@ struct ScreenView: View { HStack(spacing: 10){ GlassButtonView( label: "Send", - systemImage: "square.and.arrow.up", + systemImage: "paperplane.fill", iconOnly: appState.adbConnected, action: { let panel = NSOpenPanel() - panel.canChooseFiles = true + panel.allowsMultipleSelection = true panel.canChooseDirectories = false - panel.allowsMultipleSelection = false - panel.begin { response in - if response == .OK, let url = panel.url { - DispatchQueue.global(qos: .userInitiated).async { - WebSocketServer.shared.sendFile(url: url) - } - } + panel.canChooseFiles = true + + if panel.runModal() == .OK { + QuickShareManager.shared.transferURLs = panel.urls + QuickShareManager.shared.startDiscovery() + appState.showingQuickShareTransfer = true } } ) diff --git a/airsync-mac/Screens/HomeScreen/PhoneView/TimeView.swift b/airsync-mac/Screens/HomeScreen/PhoneView/TimeView.swift index 6feebeb6..3ef25219 100644 --- a/airsync-mac/Screens/HomeScreen/PhoneView/TimeView.swift +++ b/airsync-mac/Screens/HomeScreen/PhoneView/TimeView.swift @@ -6,7 +6,7 @@ // import SwiftUI -internal import Combine +import Combine import CoreText // MARK: - CoreText -> Path helper (macOS-safe) diff --git a/airsync-mac/Screens/HomeScreen/SidebarView.swift b/airsync-mac/Screens/HomeScreen/SidebarView.swift index 4c4f4a66..3b9a76ce 100644 --- a/airsync-mac/Screens/HomeScreen/SidebarView.swift +++ b/airsync-mac/Screens/HomeScreen/SidebarView.swift @@ -7,15 +7,12 @@ import SwiftUI - struct SidebarView: View { - @ObservedObject var appState = AppState.shared @State private var isExpandedAllSeas: Bool = false var body: some View { - VStack{ - + VStack { HStack(alignment: .center) { let name = appState.device?.name ?? "AirSync" let truncated = name.count > 20 @@ -27,34 +24,29 @@ struct SidebarView: View { } .padding(8) - - if let deviceVersion = appState.device?.version, isVersion(deviceVersion, lessThan: appState.minAndroidVersion) { Label("Your Android app is outdated", systemImage: "iphone.badge.exclamationmark") .padding(4) } - PhoneView() .transition(.scale) .opacity(appState.device != nil ? 1 : 0.5) - - .animation(.easeInOut(duration: 0.5), value: appState.status != nil) - .frame(minWidth: 280, minHeight: 400) - .safeAreaInset(edge: .bottom) { - HStack{ - if appState.device == nil { - Label("Connect your device", systemImage: "arrow.2.circlepath.circle") - } + Spacer() + } + .animation(.easeInOut(duration: 0.5), value: appState.status != nil) + .frame(minWidth: 280, minHeight: 400) + .safeAreaInset(edge: .bottom) { + HStack{ + if appState.device == nil { + Label("Connect your device", systemImage: "arrow.2.circlepath.circle") } - .padding(16) } + .padding(16) } - } - } #Preview { diff --git a/airsync-mac/Screens/MenubarView/MenubarView.swift b/airsync-mac/Screens/MenubarView/MenubarView.swift index 520f130d..f3838e8b 100644 --- a/airsync-mac/Screens/MenubarView/MenubarView.swift +++ b/airsync-mac/Screens/MenubarView/MenubarView.swift @@ -103,20 +103,20 @@ struct MenubarView: View { GlassButtonView( label: "Send", - systemImage: "square.and.arrow.up", + systemImage: "paperplane.fill", iconOnly: true, circleSize: toolButtonSize, action: { let panel = NSOpenPanel() + panel.allowsMultipleSelection = true panel.canChooseFiles = true panel.canChooseDirectories = false - panel.allowsMultipleSelection = false - panel.begin { response in - if response == .OK, let url = panel.url { - DispatchQueue.global(qos: .userInitiated).async { - WebSocketServer.shared.sendFile(url: url) - } - } + + if panel.runModal() == .OK { + let targetName = appState.device?.name + QuickShareManager.shared.startDiscovery(autoTargetName: targetName) + QuickShareManager.shared.transferURLs = panel.urls + appState.showingQuickShareTransfer = true } } ) @@ -226,7 +226,7 @@ struct MenubarView: View { } .frame(minWidth: minWidthTabs) .frame(maxWidth: .infinity) - .dropTarget(appState: appState) + .dropTarget(appState: appState, autoTargetName: appState.device?.name) .onAppear { appState.isMenubarWindowOpen = true } diff --git a/airsync-mac/Screens/Settings/Components/AboutView.swift b/airsync-mac/Screens/Settings/Components/AboutView.swift index 6aed9219..a3c3be13 100644 --- a/airsync-mac/Screens/Settings/Components/AboutView.swift +++ b/airsync-mac/Screens/Settings/Components/AboutView.swift @@ -142,25 +142,3 @@ struct AboutView: View { } } - -struct ExpandableLicenseSection: View { - let title: String - let content: String - @State private var isExpanded: Bool = false - - var body: some View { - DisclosureGroup(isExpanded: $isExpanded) { - Text(content) - .font(.footnote) - .multilineTextAlignment(.leading) - .padding() - .background(Color.secondary.opacity(0.1)) - .cornerRadius(8) - } label: { - Text(title) - .font(.subheadline) - .bold() - } - .focusEffectDisabled() - } -} diff --git a/airsync-mac/Screens/Settings/Components/ExpandableLicenseSection.swift b/airsync-mac/Screens/Settings/Components/ExpandableLicenseSection.swift new file mode 100644 index 00000000..9cef303b --- /dev/null +++ b/airsync-mac/Screens/Settings/Components/ExpandableLicenseSection.swift @@ -0,0 +1,30 @@ +// +// ExpandableLicenseSection.swift +// airsync-mac +// +// Created by AI Assistant on 2026-03-12. +// + +import SwiftUI + +struct ExpandableLicenseSection: View { + let title: String + let content: String + @State private var isExpanded: Bool = false + + var body: some View { + DisclosureGroup(isExpanded: $isExpanded) { + Text(content) + .font(.footnote) + .multilineTextAlignment(.leading) + .padding() + .background(Color.secondary.opacity(0.1)) + .cornerRadius(8) + } label: { + Text(title) + .font(.subheadline) + .bold() + } + .focusEffectDisabled() + } +} diff --git a/airsync-mac/Screens/Settings/Components/LicenseView.swift b/airsync-mac/Screens/Settings/Components/LicenseView.swift index 4204cc4e..db4e5d37 100644 --- a/airsync-mac/Screens/Settings/Components/LicenseView.swift +++ b/airsync-mac/Screens/Settings/Components/LicenseView.swift @@ -88,6 +88,10 @@ For commercial licensing inquiries or special use cases, contact: mail@sameerasw © 2025 sameerasw.com. All Rights Reserved. """) + ExpandableLicenseSection(title: "Library: QuickShare", content: """ +Huge thanks to the NearDrop project (https://github.com/grishka/NearDrop) for providing the foundation and implementation ideas that made Quick Share possible in AirSync. We are grateful for this amazing project! +""") + ExpandableLicenseSection(title: "Library: QRCode License", content: """ MIT License diff --git a/airsync-mac/Screens/Settings/Components/TrialActivationSheet.swift b/airsync-mac/Screens/Settings/Components/TrialActivationSheet.swift index 745c8182..ae0267e8 100644 --- a/airsync-mac/Screens/Settings/Components/TrialActivationSheet.swift +++ b/airsync-mac/Screens/Settings/Components/TrialActivationSheet.swift @@ -1,5 +1,5 @@ import SwiftUI -internal import Combine +import Combine struct TrialActivationSheet: View { @ObservedObject var manager: TrialManager diff --git a/airsync-mac/Screens/Settings/RemotePermissionView.swift b/airsync-mac/Screens/Settings/RemotePermissionView.swift index 5b6d940c..7772a308 100644 --- a/airsync-mac/Screens/Settings/RemotePermissionView.swift +++ b/airsync-mac/Screens/Settings/RemotePermissionView.swift @@ -6,7 +6,7 @@ // import SwiftUI -internal import Combine +import Combine struct RemotePermissionView: View { @Environment(\.dismiss) var dismiss diff --git a/airsync-mac/Screens/Settings/SettingsFeaturesView.swift b/airsync-mac/Screens/Settings/SettingsFeaturesView.swift index 60dcb3a7..a1f920c6 100644 --- a/airsync-mac/Screens/Settings/SettingsFeaturesView.swift +++ b/airsync-mac/Screens/Settings/SettingsFeaturesView.swift @@ -111,7 +111,6 @@ struct SettingsFeaturesView: View { VStack(alignment: .leading, spacing: 6) { ExpandableLicenseSection(title: "ADB Console", content: "[" + (UserDefaults.standard.lastADBCommand ?? "[]") + "] " + result) } - .transition(.opacity) } HStack { diff --git a/airsync-mac/Screens/Settings/SettingsView.swift b/airsync-mac/Screens/Settings/SettingsView.swift index be9db17e..a7a8ce9b 100644 --- a/airsync-mac/Screens/Settings/SettingsView.swift +++ b/airsync-mac/Screens/Settings/SettingsView.swift @@ -119,19 +119,37 @@ struct SettingsView: View { RemotePermissionView() } - VStack{ - HStack{ - Label("Show File Share Dialog", systemImage: "doc.on.doc") + + // 3. Quick Share + headerSection(title: "Quick Share", icon: "laptopcomputer.and.arrow.down") + VStack { + HStack { + Label(Localizer.shared.text("quickshare.title"), systemImage: "bolt.horizontal.circle") Spacer() - Toggle("", isOn: $appState.showFileShareDialog) + Toggle("", isOn: $appState.quickShareEnabled) .toggleStyle(.switch) } + + if appState.quickShareEnabled { + Text(String(format: Localizer.shared.text("quickshare.settings.discoverable"), QuickShareManager.shared.deviceName)) + .font(.caption) + .foregroundColor(.secondary) + .frame(maxWidth: .infinity, alignment: .leading) + + HStack { + Label(Localizer.shared.text("quickshare.settings.autoAccept"), systemImage: "checkmark.shield") + Spacer() + Toggle("", isOn: $appState.autoAcceptQuickShare) + .toggleStyle(.switch) + } + + } } .padding() .background(.background.opacity(0.3)) .cornerRadius(12.0) - // 3. Appearance + // 4. Appearance headerSection(title: "Appearance", icon: "paintbrush") VStack(spacing: 12) { HStack{ diff --git a/airsync-mac/Screens/TransfersView/TransfersView.swift b/airsync-mac/Screens/TransfersView/TransfersView.swift deleted file mode 100644 index 0051384c..00000000 --- a/airsync-mac/Screens/TransfersView/TransfersView.swift +++ /dev/null @@ -1,120 +0,0 @@ -import SwiftUI - -/// A compact SwiftUI view that lists current file transfers tracked in `AppState.transfers`. -/// Displays name, direction, progress bar, byte counters and status. -struct TransfersView: View { - @ObservedObject private var appState = AppState.shared - - private var sessions: [AppState.FileTransferSession] { - Array(appState.transfers.values).sorted { $0.startedAt > $1.startedAt } - } - - var body: some View { - VStack(alignment: .leading, spacing: 8) { - if sessions.isEmpty { - VStack { - - if !UIStyle.pretendOlderOS, #available(macOS 26.0, *) { - Text("BETA") - .padding(8) - .background(.clear) - .glassEffect(in: .rect(cornerRadius: 10)) - .padding(8) - } else { - Text("BETA") - .padding(8) - .background(.thinMaterial, in: .rect(cornerRadius: 10)) - .padding(8) - } - - Label(L("transfers.empty"), systemImage: "tray.and.arrow.up") - .padding() - - } - } else { - List { - ForEach(sessions) { session in - TransferRow(session: session) - .padding(.vertical, 6) - } - } - .scrollContentBackground(.hidden) - .background(.clear) - .transition(.blurReplace) - .listStyle(.sidebar) - } - } - .frame(minWidth: 360, minHeight: 160) - } -} - -private struct TransferRow: View { - let session: AppState.FileTransferSession - - var body: some View { - HStack(alignment: .top, spacing: 12) { - Image(systemName: session.direction == .incoming ? "arrow.down.circle.fill" : "arrow.up.circle.fill") - .foregroundColor(session.direction == .incoming ? .blue : .green) - .font(.title2) - .frame(width: 36) - - VStack(alignment: .leading, spacing: 6) { - HStack { - Text(session.name) - .font(.headline) - .lineLimit(1) - Spacer() - Text(statusText) - .font(.subheadline) - .foregroundColor(.secondary) - } - - ProgressView(value: session.progress) - .progressViewStyle(LinearProgressViewStyle()) - - HStack { - Text(bytesText) - .font(.caption) - .foregroundColor(.secondary) - Spacer() - Text(String(format: "%.0f%%", session.progress * 100)) - .font(.caption) - .foregroundColor(.secondary) - } - } - } - .padding() - .applyGlassViewIfAvailable() - } - - private var bytesText: String { - if session.size == 0 { return "--" } - return "\(formatBytes(session.bytesTransferred)) / \(formatBytes(session.size))" - } - - private var statusText: String { - switch session.status { - case .inProgress: - return "In progress" - case .completed(let verified): - if let v = verified { - return v ? "Completed ✓" : "Completed (checksum mismatch)" - } else { - return "Completed" - } - case .failed(let reason): - return "Failed: \(reason)" - } - } - - private func formatBytes(_ bytes: Int) -> String { - let b = Double(bytes) - if b < 1024 { return "\(bytes) B" } - let kb = b / 1024 - if kb < 1024 { return String(format: "%.1f KB", kb) } - let mb = kb / 1024 - if mb < 1024 { return String(format: "%.1f MB", mb) } - let gb = mb / 1024 - return String(format: "%.1f GB", gb) - } -} diff --git a/airsync-mac/Screens/Updater/CheckForUpdateView.swift b/airsync-mac/Screens/Updater/CheckForUpdateView.swift index c10b3ddd..67426174 100644 --- a/airsync-mac/Screens/Updater/CheckForUpdateView.swift +++ b/airsync-mac/Screens/Updater/CheckForUpdateView.swift @@ -7,7 +7,7 @@ import SwiftUI import Sparkle -internal import Combine +import Combine final class CheckForUpdatesViewModel: ObservableObject { @Published var canCheckForUpdates = false diff --git a/airsync-mac/airsync_macApp.swift b/airsync-mac/airsync_macApp.swift index eaef9681..66832d88 100644 --- a/airsync-mac/airsync_macApp.swift +++ b/airsync-mac/airsync_macApp.swift @@ -93,11 +93,11 @@ struct airsync_macApp: App { dismissWindow(id: "callWindow") } } - .onChange(of: appState.activeTransferId) { oldValue, newValue in - if newValue != nil { - openWindow(id: "fileTransferWindow") + .onChange(of: appState.showingQuickShareTransfer) { oldValue, newValue in + if newValue { + openWindow(id: "quickShareWindow") } else { - dismissWindow(id: "fileTransferWindow") + dismissWindow(id: "quickShareWindow") } } .commands { @@ -171,22 +171,34 @@ struct airsync_macApp: App { .defaultSize(width: 320, height: 480) .windowStyle(.hiddenTitleBar) - // File Transfer Utility Window - Window("File Transfer", id: "fileTransferWindow") { - if #available(macOS 15.0, *) { - FileTransferWindowView() - .environmentObject(appState) - .frame(minWidth: 320, maxWidth: 320, minHeight: 300, maxHeight: 300) - .containerBackground(.ultraThinMaterial, for: .window) - } else { - FileTransferWindowView() - .environmentObject(appState) - .frame(minWidth: 320, maxWidth: 320, minHeight: 300, maxHeight: 300) - } + // Standalone Tool Window for Quick Share + Window("Quick Share", id: "quickShareWindow") { + QuickShareTransferSheet() + .fixedSize() + .background(WindowAccessor(callback: { window in + window.level = .floating + window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary] + window.titleVisibility = .visible + window.title = Localizer.shared.text("quickshare.title") + window.titlebarAppearsTransparent = true + window.isMovableByWindowBackground = true + window.styleMask.remove(.resizable) + window.standardWindowButton(.closeButton)?.isHidden = false + window.standardWindowButton(.miniaturizeButton)?.isHidden = true + window.standardWindowButton(.zoomButton)?.isHidden = true + window.backgroundColor = .clear + window.isOpaque = false + + NotificationCenter.default.addObserver(forName: NSWindow.willCloseNotification, object: window, queue: .main) { _ in + AppState.shared.showingQuickShareTransfer = false + QuickShareManager.shared.stopDiscovery() + } + })) } + .defaultPosition(.topTrailing) .windowStyle(.hiddenTitleBar) .windowResizability(.contentSize) - .defaultPosition(.center) + } }