Fix building for Catalyst

This commit is contained in:
Shadowfacts 2022-09-16 21:58:50 -04:00
parent 07f9619217
commit bd54e3bca3
2 changed files with 8 additions and 0 deletions

View File

@ -24,11 +24,13 @@ struct AddKeyButton: View {
var body: some View { var body: some View {
Menu { Menu {
Section { Section {
#if !targetEnvironment(macCatalyst)
Button { Button {
isPresentingScanner = true isPresentingScanner = true
} label: { } label: {
Label("Scan QR", systemImage: "qrcode.viewfinder") Label("Scan QR", systemImage: "qrcode.viewfinder")
} }
#endif
Button { Button {
isPresentingAddURLSheet = true isPresentingAddURLSheet = true
} label: { } label: {
@ -55,11 +57,14 @@ struct AddKeyButton: View {
} }
.menuStyle(.borderlessButton) .menuStyle(.borderlessButton)
.accessibilityLabel("Add Key") .accessibilityLabel("Add Key")
#if !targetEnvironment(macCatalyst)
.sheet(isPresented: $isPresentingScanner, content: self.scannerSheet) .sheet(isPresented: $isPresentingScanner, content: self.scannerSheet)
#endif
.sheet(isPresented: $isPresentingManualAddFormSheet, content: self.manualAddFormSheet) .sheet(isPresented: $isPresentingManualAddFormSheet, content: self.manualAddFormSheet)
.sheet(isPresented: $isPresentingAddURLSheet, content: self.addURLSheet) .sheet(isPresented: $isPresentingAddURLSheet, content: self.addURLSheet)
} }
#if !targetEnvironment(macCatalyst)
private func scannerSheet() -> some View { private func scannerSheet() -> some View {
AddQRView() { (action) in AddQRView() { (action) in
self.isPresentingScanner = false self.isPresentingScanner = false
@ -71,6 +76,7 @@ struct AddKeyButton: View {
} }
} }
} }
#endif
private func addURLSheet() -> some View { private func addURLSheet() -> some View {
NavigationView { NavigationView {

View File

@ -5,6 +5,7 @@
// Created by Shadowfacts on 8/22/21. // Created by Shadowfacts on 8/22/21.
// //
#if !targetEnvironment(macCatalyst)
import SwiftUI import SwiftUI
import CodeScanner import CodeScanner
import OTPKit import OTPKit
@ -93,3 +94,4 @@ struct AddQRView_Previews: PreviewProvider {
AddQRView() { (_) in } AddQRView() { (_) in }
} }
} }
#endif