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 {
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 {

View File

@ -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