From bd54e3bca387886303351559f222f9b139458dcb Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 16 Sep 2022 21:58:50 -0400 Subject: [PATCH] Fix building for Catalyst --- OTP/Views/AddKeyButton.swift | 6 ++++++ OTP/Views/AddQRView.swift | 2 ++ 2 files changed, 8 insertions(+) diff --git a/OTP/Views/AddKeyButton.swift b/OTP/Views/AddKeyButton.swift index 21d2f2d..3d98eb8 100644 --- a/OTP/Views/AddKeyButton.swift +++ b/OTP/Views/AddKeyButton.swift @@ -24,11 +24,13 @@ struct AddKeyButton: View { var body: some View { Menu { Section { + #if !targetEnvironment(macCatalyst) Button { isPresentingScanner = true } label: { Label("Scan QR", systemImage: "qrcode.viewfinder") } + #endif Button { isPresentingAddURLSheet = true } label: { @@ -55,11 +57,14 @@ struct AddKeyButton: View { } .menuStyle(.borderlessButton) .accessibilityLabel("Add Key") + #if !targetEnvironment(macCatalyst) .sheet(isPresented: $isPresentingScanner, content: self.scannerSheet) + #endif .sheet(isPresented: $isPresentingManualAddFormSheet, content: self.manualAddFormSheet) .sheet(isPresented: $isPresentingAddURLSheet, content: self.addURLSheet) } + #if !targetEnvironment(macCatalyst) private func scannerSheet() -> some View { AddQRView() { (action) in self.isPresentingScanner = false @@ -71,6 +76,7 @@ struct AddKeyButton: View { } } } + #endif private func addURLSheet() -> some View { NavigationView { diff --git a/OTP/Views/AddQRView.swift b/OTP/Views/AddQRView.swift index 50e0b36..0444583 100644 --- a/OTP/Views/AddQRView.swift +++ b/OTP/Views/AddQRView.swift @@ -5,6 +5,7 @@ // Created by Shadowfacts on 8/22/21. // +#if !targetEnvironment(macCatalyst) import SwiftUI import CodeScanner import OTPKit @@ -93,3 +94,4 @@ struct AddQRView_Previews: PreviewProvider { AddQRView() { (_) in } } } +#endif