diff --git a/damus/Info.plist b/damus/Info.plist
index 0f1867e6..a0d03416 100644
--- a/damus/Info.plist
+++ b/damus/Info.plist
@@ -46,5 +46,9 @@
NSAllowsArbitraryLoads
+ NSCameraUsageDescription
+ Damus needs access to your camera if you want to upload photos from it
+ NSMicrophoneUsageDescription
+ Damus needs access to your microphone if you want to upload recorded videos from it
diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift
index f4fef622..5ad1d78d 100644
--- a/damus/Views/PostView.swift
+++ b/damus/Views/PostView.swift
@@ -19,6 +19,7 @@ struct PostView: View {
@FocusState var focus: Bool
@State var showPrivateKeyWarning: Bool = false
@State var attach_media: Bool = false
+ @State var attach_camera: Bool = false
@State var error: String? = nil
@StateObject var image_upload: ImageUploadModel = ImageUploadModel()
@@ -80,11 +81,20 @@ struct PostView: View {
})
}
+ var CameraButton: some View {
+ Button(action: {
+ attach_camera = true
+ }, label: {
+ Image(systemName: "camera")
+ })
+ }
+
var AttachmentBar: some View {
HStack(alignment: .center) {
ImageButton
- .disabled(image_upload.progress != nil)
+ CameraButton
}
+ .disabled(image_upload.progress != nil)
}
var PostButton: some View {
@@ -221,6 +231,13 @@ struct PostView: View {
handle_upload(media: .video(url))
}
}
+ .sheet(isPresented: $attach_camera) {
+ ImagePicker(sourceType: .camera, damusState: damus_state) { img in
+ handle_upload(media: .image(img))
+ } onVideoPicked: { url in
+ handle_upload(media: .video(url))
+ }
+ }
.onAppear() {
if let replying_to {
if damus_state.drafts.replies[replying_to] == nil {