Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)

To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
This commit is contained in:
Konstantin Pastbin
2025-04-13 16:37:30 +07:00
commit e3e4a1985a
12931 changed files with 13195100 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
typealias URLsCompletionHandler = ([URL]) -> Void
final class DocumentPicker: NSObject {
static let shared = DocumentPicker()
private var completionHandler: URLsCompletionHandler?
func present(from rootViewController: UIViewController,
fileTypes: [FileType] = [.kml, .kmz, .gpx],
completionHandler: @escaping URLsCompletionHandler) {
self.completionHandler = completionHandler
let documentPickerViewController: UIDocumentPickerViewController
if #available(iOS 14.0, *) {
documentPickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: fileTypes.map(\.utType), asCopy: true)
} else {
documentPickerViewController = UIDocumentPickerViewController(documentTypes: fileTypes.map(\.typeIdentifier), in: .import)
}
documentPickerViewController.delegate = self
// TODO: Enable multiple selection when the multiple files parsing support will be added to the bookmark_manager.
documentPickerViewController.allowsMultipleSelection = false
rootViewController.present(documentPickerViewController, animated: true)
}
}
// MARK: - UIDocumentPickerDelegate
extension DocumentPicker: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
completionHandler?(urls)
}
}

View File

@@ -0,0 +1,22 @@
import UniformTypeIdentifiers
// TODO: (KK) Remove this type-wrapper and use custom UTTypeIdentifier that is registered into the Info.plist after updating to the iOS >= 14.0.
struct FileType {
let fileExtension: String
let typeIdentifier: String
}
extension FileType {
static let kml = FileType(fileExtension: "kml", typeIdentifier: "com.google.earth.kml")
static let kmz = FileType(fileExtension: "kmz", typeIdentifier: "com.google.earth.kmz")
static let gpx = FileType(fileExtension: "gpx", typeIdentifier: "com.topografix.gpx")
}
// MARK: - FileType + UTType
extension FileType {
@available(iOS 14.0, *)
var utType: UTType {
UTType(filenameExtension: fileExtension)!
}
}