mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-24 22:45:19 +00:00
Limit PhotosPicker to iOS only to fix CI
PhotosPickerItem has SDK availability issues on macOS in CI. Change PhotosPicker from canImport(PhotosUI) to os(iOS) only. macOS users can still import images via file importer (.fileImporter). This is actually cleaner as macOS file picker is more familiar to users. Fixes CI build failures.
This commit is contained in:
@@ -73,7 +73,7 @@ struct ContentView: View {
|
||||
@State private var recordingTimer: Timer?
|
||||
@State private var recordingStartDate: Date?
|
||||
@State private var showFileImporter = false
|
||||
#if canImport(PhotosUI) && ((os(iOS) && compiler(>=5.7)) || (os(macOS) && compiler(>=5.7)))
|
||||
#if os(iOS)
|
||||
@State private var showPhotoPicker = false
|
||||
@State private var selectedPhotoPickerItem: PhotosPickerItem?
|
||||
#endif
|
||||
@@ -210,7 +210,7 @@ struct ContentView: View {
|
||||
FingerprintView(viewModel: viewModel, peerID: peerID)
|
||||
}
|
||||
}
|
||||
#if canImport(PhotosUI) && ((os(iOS) && compiler(>=5.7)) || (os(macOS) && compiler(>=5.7)))
|
||||
#if os(iOS)
|
||||
.photosPicker(isPresented: $showPhotoPicker, selection: $selectedPhotoPickerItem, matching: .images)
|
||||
.onChange(of: selectedPhotoPickerItem) { newItem in
|
||||
guard let item = newItem else { return }
|
||||
@@ -229,7 +229,7 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
.confirmationDialog("Attach", isPresented: $showAttachmentActions, titleVisibility: .visible) {
|
||||
#if canImport(PhotosUI) && ((os(iOS) && compiler(>=5.7)) || (os(macOS) && compiler(>=5.7)))
|
||||
#if os(iOS)
|
||||
Button("Image") {
|
||||
showAttachmentActions = false
|
||||
DispatchQueue.main.async { showPhotoPicker = true }
|
||||
@@ -1982,7 +1982,7 @@ private extension ContentView {
|
||||
}
|
||||
}
|
||||
|
||||
#if canImport(PhotosUI) && ((os(iOS) && compiler(>=5.7)) || (os(macOS) && compiler(>=5.7)))
|
||||
#if os(iOS)
|
||||
func handlePhotoSelection(_ item: PhotosPickerItem) async {
|
||||
defer { Task { @MainActor in selectedPhotoPickerItem = nil } }
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user