mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 17:05:19 +00:00
Enable mac attachment importers
This commit is contained in:
@@ -75,9 +75,6 @@ struct ContentView: View {
|
|||||||
@State private var selectedPhotoPickerItem: PhotosPickerItem?
|
@State private var selectedPhotoPickerItem: PhotosPickerItem?
|
||||||
#endif
|
#endif
|
||||||
@State private var showAttachmentActions = false
|
@State private var showAttachmentActions = false
|
||||||
#if os(macOS)
|
|
||||||
@State private var showAttachmentUnavailableAlert = false
|
|
||||||
#endif
|
|
||||||
@ScaledMetric(relativeTo: .body) private var headerHeight: CGFloat = 44
|
@ScaledMetric(relativeTo: .body) private var headerHeight: CGFloat = 44
|
||||||
@ScaledMetric(relativeTo: .subheadline) private var headerPeerIconSize: CGFloat = 11
|
@ScaledMetric(relativeTo: .subheadline) private var headerPeerIconSize: CGFloat = 11
|
||||||
@ScaledMetric(relativeTo: .subheadline) private var headerPeerCountFontSize: CGFloat = 12
|
@ScaledMetric(relativeTo: .subheadline) private var headerPeerCountFontSize: CGFloat = 12
|
||||||
@@ -211,11 +208,12 @@ struct ContentView: View {
|
|||||||
handleImportResult(result, handler: handleImportedFile)
|
handleImportResult(result, handler: handleImportedFile)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
.alert("Attachments Unavailable", isPresented: $showAttachmentUnavailableAlert, actions: {
|
.fileImporter(isPresented: $showImageImporter, allowedContentTypes: [.image], allowsMultipleSelection: false) { result in
|
||||||
Button("OK", role: .cancel) {}
|
handleImportResult(result, handler: handleImportedImage)
|
||||||
}, message: {
|
}
|
||||||
Text("File and photo pickers require additional entitlements on macOS preview builds.")
|
.fileImporter(isPresented: $showFileImporter, allowedContentTypes: [.data], allowsMultipleSelection: false) { result in
|
||||||
})
|
handleImportResult(result, handler: handleImportedFile)
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
.sheet(isPresented: Binding(
|
.sheet(isPresented: Binding(
|
||||||
get: { imagePreviewURL != nil },
|
get: { imagePreviewURL != nil },
|
||||||
@@ -234,7 +232,7 @@ struct ContentView: View {
|
|||||||
#else
|
#else
|
||||||
Button("Image") {
|
Button("Image") {
|
||||||
showAttachmentActions = false
|
showAttachmentActions = false
|
||||||
showAttachmentUnavailableAlert = true
|
DispatchQueue.main.async { showImageImporter = true }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Button("File") {
|
Button("File") {
|
||||||
@@ -242,7 +240,7 @@ struct ContentView: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
DispatchQueue.main.async { showFileImporter = true }
|
DispatchQueue.main.async { showFileImporter = true }
|
||||||
#else
|
#else
|
||||||
showAttachmentUnavailableAlert = true
|
DispatchQueue.main.async { showFileImporter = true }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Button("Cancel", role: .cancel) {}
|
Button("Cancel", role: .cancel) {}
|
||||||
|
|||||||
@@ -16,5 +16,7 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.network.server</key>
|
<key>com.apple.security.network.server</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.files.user-selected.read-only</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
Reference in New Issue
Block a user