Allow the mac app to chose room avatars directly from files instead of the photo library

This commit is contained in:
Stefan Ceriu
2026-04-25 11:46:40 +03:00
parent 0ec114d2f3
commit 53a54c1b90
20 changed files with 56 additions and 8 deletions
@@ -7,6 +7,7 @@
//
import SwiftUI
import UniformTypeIdentifiers
enum DocumentPickerAction {
case selectedMediaAtURLs([URL])
@@ -16,19 +17,22 @@ enum DocumentPickerAction {
struct DocumentPicker: UIViewControllerRepresentable {
private let selectionType: MediaPickerScreenSelectionType
private let contentTypes: [UTType]
private let userIndicatorController: UserIndicatorControllerProtocol
private let callback: (DocumentPickerAction) -> Void
init(selectionType: MediaPickerScreenSelectionType,
contentTypes: [UTType],
userIndicatorController: UserIndicatorControllerProtocol,
callback: @escaping (DocumentPickerAction) -> Void) {
self.selectionType = selectionType
self.contentTypes = contentTypes
self.userIndicatorController = userIndicatorController
self.callback = callback
}
func makeUIViewController(context: Context) -> UIDocumentPickerViewController {
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [.data])
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: contentTypes)
documentPicker.delegate = context.coordinator
documentPicker.allowsMultipleSelection = switch selectionType {