Merge multiple image uploading

kernelkind (1):
      allow multiple media uploads per selection
This commit is contained in:
William Casarin
2025-02-06 14:29:22 -08:00

View File

@@ -321,18 +321,20 @@ impl<'a> PostView<'a> {
if ui.add(media_upload_button()).clicked() { if ui.add(media_upload_button()).clicked() {
#[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))] #[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))]
{ {
if let Some(file) = rfd::FileDialog::new().pick_file() { if let Some(files) = rfd::FileDialog::new().pick_files() {
match MediaPath::new(file) { for file in files {
Ok(media_path) => { match MediaPath::new(file) {
let promise = nostrbuild_nip96_upload( Ok(media_path) => {
self.poster.secret_key.secret_bytes(), let promise = nostrbuild_nip96_upload(
media_path, self.poster.secret_key.secret_bytes(),
); media_path,
self.draft.uploading_media.push(promise); );
} self.draft.uploading_media.push(promise);
Err(e) => { }
error!("{e}"); Err(e) => {
self.draft.upload_errors.push(e.to_string()); error!("{e}");
self.draft.upload_errors.push(e.to_string());
}
} }
} }
} }