Merge branch 'master' into feat/localize

merge(master): Fix for fileImporter before iOS/macOS 27
This commit is contained in:
2026-07-20 18:25:06 +02:00

View File

@@ -31,20 +31,27 @@ struct SendPickers: ViewModifier {
@ObservedObject var model: SendModel @ObservedObject var model: SendModel
func body(content: Content) -> some View { func body(content: Content) -> some View {
// A single .fileImporter, switched between files and folders. Stacking two
// .fileImporter modifiers on one view silently breaks on iOS/macOS < 27:
// the second shadows the first, so "Choose files" never presents.
content content
.fileImporter( .fileImporter(
isPresented: Binding(get: { model.pendingFilePick }, set: { model.pendingFilePick = $0 }), isPresented: Binding(
allowedContentTypes: [.item], get: { model.pendingFilePick || model.pendingFolderPick },
allowsMultipleSelection: true set: { presented in
if !presented {
model.pendingFilePick = false
model.pendingFolderPick = false
}
}
),
allowedContentTypes: model.pendingFolderPick ? [.folder] : [.item],
allowsMultipleSelection: !model.pendingFolderPick
) { result in ) { result in
handleShareSelection(result, isDirectory: false) let isDirectory = model.pendingFolderPick
} model.pendingFilePick = false
.fileImporter( model.pendingFolderPick = false
isPresented: Binding(get: { model.pendingFolderPick }, set: { model.pendingFolderPick = $0 }), handleShareSelection(result, isDirectory: isDirectory)
allowedContentTypes: [.folder],
allowsMultipleSelection: false
) { result in
handleShareSelection(result, isDirectory: true)
} }
} }