Fix File Importer

This commit is contained in:
Stossy11 2025-03-28 07:59:25 +11:00
parent f468d03e4b
commit 984a43ba47
3 changed files with 12 additions and 3 deletions

View file

@ -7,6 +7,7 @@
import SwiftUI
import em_proxy
import UniformTypeIdentifiers
@main
struct HeartbeatApp: App {
@ -40,7 +41,7 @@ struct HeartbeatApp: App {
startHeartbeatInBackground()
}
}
.fileImporter(isPresented: $isPairing, allowedContentTypes: [.item]) {result in
.fileImporter(isPresented: $isPairing, allowedContentTypes: [UTType(filenameExtension: "mobiledevicepairing", conformingTo: .data)!, .propertyList]) {result in
switch result {
case .success(let url):

View file

@ -6,6 +6,13 @@
//
import SwiftUI
import UniformTypeIdentifiers
extension UIDocumentPickerViewController {
@objc func fix_init(forOpeningContentTypes contentTypes: [UTType], asCopy: Bool) -> UIDocumentPickerViewController {
return fix_init(forOpeningContentTypes: contentTypes, asCopy: true)
}
}
struct HomeView: View {
@AppStorage("username") private var username = "User"
@ -61,7 +68,7 @@ struct HomeView: View {
.onReceive(timer) { _ in
refreshBackground()
}
.fileImporter(isPresented: $isShowingPairingFilePicker, allowedContentTypes: [.item]) {result in
.fileImporter(isPresented: $isShowingPairingFilePicker, allowedContentTypes: [UTType(filenameExtension: "mobiledevicepairing", conformingTo: .data)!, .propertyList]) {result in
switch result {
case .success(let url):

View file

@ -6,6 +6,7 @@
//
import SwiftUI
import UniformTypeIdentifiers
struct SettingsView: View {
@AppStorage("username") private var username = "User"
@ -111,7 +112,7 @@ struct SettingsView: View {
.font(.bodyFont)
.accentColor(.accentColor)
}
.fileImporter(isPresented: $isShowingPairingFilePicker, allowedContentTypes: [.item]) {result in
.fileImporter(isPresented: $isShowingPairingFilePicker, allowedContentTypes: [UTType(filenameExtension: "mobiledevicepairing", conformingTo: .data)!, .propertyList]) {result in
switch result {
case .success(let url):