import SwiftUI
import UIKit

/// Thin `UIViewControllerRepresentable` wrapper around `UIActivityViewController`,
/// used by `ExportSheet` to hand an exported file off to Mail, Files,
/// AirDrop, etc.
struct ShareSheet: UIViewControllerRepresentable {
    let activityItems: [Any]
    var excludedActivityTypes: [UIActivity.ActivityType]?

    func makeUIViewController(context: Context) -> UIActivityViewController {
        let controller = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
        controller.excludedActivityTypes = excludedActivityTypes
        return controller
    }

    func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {
        // Nothing to update — the activity items are fixed for the sheet's lifetime.
    }
}
