mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Get the OPML UTI by filename extension, to handle the cases where it’s registered as something other than org.opml.opml.
This commit is contained in:
1 parent
72a8592caa
commit
962177cbef
1 file changed
+20
-4
@@ -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.
|
||||
// <https://github.com/Ranchero-Software/NetNewsWire/issues/4858>
|
||||
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) {
|
||||
|
||||
Reference in new issue
Block a user