Enable mac attachment importers

This commit is contained in:
jack
2025-10-14 22:21:17 +02:00
parent c75f32da2c
commit d8e8703a5f
2 changed files with 10 additions and 10 deletions
+8 -10
View File
@@ -75,9 +75,6 @@ struct ContentView: View {
@State private var selectedPhotoPickerItem: PhotosPickerItem?
#endif
@State private var showAttachmentActions = false
#if os(macOS)
@State private var showAttachmentUnavailableAlert = false
#endif
@ScaledMetric(relativeTo: .body) private var headerHeight: CGFloat = 44
@ScaledMetric(relativeTo: .subheadline) private var headerPeerIconSize: CGFloat = 11
@ScaledMetric(relativeTo: .subheadline) private var headerPeerCountFontSize: CGFloat = 12
@@ -211,11 +208,12 @@ struct ContentView: View {
handleImportResult(result, handler: handleImportedFile)
}
#else
.alert("Attachments Unavailable", isPresented: $showAttachmentUnavailableAlert, actions: {
Button("OK", role: .cancel) {}
}, message: {
Text("File and photo pickers require additional entitlements on macOS preview builds.")
})
.fileImporter(isPresented: $showImageImporter, allowedContentTypes: [.image], allowsMultipleSelection: false) { result in
handleImportResult(result, handler: handleImportedImage)
}
.fileImporter(isPresented: $showFileImporter, allowedContentTypes: [.data], allowsMultipleSelection: false) { result in
handleImportResult(result, handler: handleImportedFile)
}
#endif
.sheet(isPresented: Binding(
get: { imagePreviewURL != nil },
@@ -234,7 +232,7 @@ struct ContentView: View {
#else
Button("Image") {
showAttachmentActions = false
showAttachmentUnavailableAlert = true
DispatchQueue.main.async { showImageImporter = true }
}
#endif
Button("File") {
@@ -242,7 +240,7 @@ struct ContentView: View {
#if os(iOS)
DispatchQueue.main.async { showFileImporter = true }
#else
showAttachmentUnavailableAlert = true
DispatchQueue.main.async { showFileImporter = true }
#endif
}
Button("Cancel", role: .cancel) {}
+2
View File
@@ -16,5 +16,7 @@
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>