#pragma once // Spec: FR-MEDIA-01, FR-UP-01. Native open and save file dialogs (SDL_ShowOpenFileDialog, SDL_ShowSaveFileDialog). // The SDL callbacks arrive on another thread; the results are marshalled to the UI thread with UiQueue. #include #include #include namespace dp { class AttachmentFileDialogs { public: // path is empty when the user cancelled or no dialog is available. // mediaOnly restricts the dialog to image and video extensions (Photo Library source). static void openFile(bool mediaOnly, std::function done); static void saveFile(const std::string& defaultName, std::function done); // Reads at most maxBytes; nullopt when missing, unreadable or larger. static std::optional readFile(const std::string& path, std::size_t maxBytes); static bool writeFile(const std::string& path, const std::string& bytes); static std::string lastPathComponent(const std::string& path); }; } // namespace dp