From 962177cbef910ebbd3c613eb9159d9d757d7bd9c Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 5 Dec 2025 09:15:44 -0800 Subject: [PATCH] =?UTF-8?q?Get=20the=20OPML=20UTI=20by=20filename=20extens?= =?UTF-8?q?ion,=20to=20handle=20the=20cases=20where=20it=E2=80=99s=20regis?= =?UTF-8?q?tered=20as=20something=20other=20than=20org.opml.opml.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/Settings/SettingsViewController.swift | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 737530e66..39a87e808 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -415,11 +415,27 @@ private extension SettingsViewController { } func importOPMLDocumentPicker() { + var contentTypes: [UTType] = [] - let docPicker = UIDocumentPickerViewController(forOpeningContentTypes: [UTType.opml, UTType.xml], asCopy: true) - docPicker.delegate = self - docPicker.modalPresentationStyle = .formSheet - self.present(docPicker, animated: true) + // Create UTType for .opml files by extension, without requiring conformance. + // This ensures files ending in .opml can be selected no matter how OPML is registered. + // + if let opmlByExtension = UTType(filenameExtension: "opml") { + contentTypes.append(opmlByExtension) + } + + // Also try the registered org.opml.opml UTI if it exists + if let registeredOPML = UTType("org.opml.opml") { + contentTypes.append(registeredOPML) + } + + // Include XML as a fallback + contentTypes.append(.xml) + + let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: contentTypes, asCopy: true) + documentPicker.delegate = self + documentPicker.modalPresentationStyle = .formSheet + self.present(documentPicker, animated: true) } func exportOPML(sourceView: UIView, sourceRect: CGRect) {