mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-08 16:18:48 +01:00
Pass all UTI types associated with OPML to the document picker for OPML imports. Issue #1684
This commit is contained in:
parent
050434023e
commit
f5c2fc4813
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Account
|
import Account
|
||||||
|
import CoreServices
|
||||||
import SafariServices
|
import SafariServices
|
||||||
|
|
||||||
class SettingsViewController: UITableViewController {
|
class SettingsViewController: UITableViewController {
|
||||||
@ -383,7 +384,17 @@ private extension SettingsViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func importOPMLDocumentPicker() {
|
func importOPMLDocumentPicker() {
|
||||||
let docPicker = UIDocumentPickerViewController(documentTypes: ["public.text"], in: .import)
|
|
||||||
|
let utiArray = UTTypeCreateAllIdentifiersForTag(kUTTagClassFilenameExtension, "opml" as NSString, nil)?.takeRetainedValue() as? [String] ?? [String]()
|
||||||
|
|
||||||
|
var opmlUTIs = utiArray
|
||||||
|
.compactMap({ UTTypeCopyDeclaration($0 as NSString)?.takeUnretainedValue() as? [String: Any] })
|
||||||
|
.reduce([String]()) { (result, dict) in
|
||||||
|
return result + dict.values.compactMap({ $0 as? String })
|
||||||
|
}
|
||||||
|
opmlUTIs.append("public.xml")
|
||||||
|
|
||||||
|
let docPicker = UIDocumentPickerViewController(documentTypes: opmlUTIs, in: .import)
|
||||||
docPicker.delegate = self
|
docPicker.delegate = self
|
||||||
docPicker.modalPresentationStyle = .formSheet
|
docPicker.modalPresentationStyle = .formSheet
|
||||||
self.present(docPicker, animated: true)
|
self.present(docPicker, animated: true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user