diff --git a/GeoTrackKitExample/GeoTrackKitExample/Info.plist b/GeoTrackKitExample/GeoTrackKitExample/Info.plist index ddb50df..92f0feb 100644 --- a/GeoTrackKitExample/GeoTrackKitExample/Info.plist +++ b/GeoTrackKitExample/GeoTrackKitExample/Info.plist @@ -2,6 +2,45 @@ + CFBundleDocumentTypes + + + CFBundleTypeRole + Editor + LSItemContentTypes + + com.icolasoft.GeoTrackKit.track.file + + CFBundleTypeExtensions + + + + CFBundleTypeName + Track File + LSHandlerRank + Owner + + + UTExportedTypeDeclarations + + + UTTypeDescription + GeoTrackKit Track File + UTTypeConformsTo + + public.data + + UTTypeIdentifier + com.icolasoft.GeoTrackKit.track.file + UTTypeTagSpecification + + public.filename-extension + gtj + public.mime-type + application/geotrack-json + + + CFBundleDevelopmentRegion en CFBundleDisplayName diff --git a/GeoTrackKitExample/GeoTrackKitExample/Views/ReferenceTrack/TrackMapViewController.swift b/GeoTrackKitExample/GeoTrackKitExample/Views/ReferenceTrack/TrackMapViewController.swift index 924e705..452b4ea 100644 --- a/GeoTrackKitExample/GeoTrackKitExample/Views/ReferenceTrack/TrackMapViewController.swift +++ b/GeoTrackKitExample/GeoTrackKitExample/Views/ReferenceTrack/TrackMapViewController.swift @@ -108,7 +108,7 @@ private extension TrackMapViewController { } let documentsFolder = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true) let fileName = model.track.name.trackNameToFileSystemName - let fileUrl = documentsFolder.appendingPathComponent("\(fileName).json") + let fileUrl = documentsFolder.appendingPathComponent("\(fileName).gtj") do { try jsonString.write(to: fileUrl, atomically: false, encoding: .utf8) } catch { @@ -164,7 +164,7 @@ private extension TrackMapViewController { let dialog = UIAlertController(title: "Share", message: "How would you like to share?", preferredStyle: .actionSheet) dialog.addAction(UIAlertAction(title: "JSON", style: .default) { [weak self] _ in - self?.shareJsonFile() + self?.shareGeoTrackJsonFile() dialog.dismiss(animated: true) }) dialog.addAction(UIAlertAction(title: "GPX", style: .default) { [weak self] _ in @@ -185,8 +185,8 @@ private extension TrackMapViewController { present(activityVC, animated: true, completion: nil) } - /// Shares the track as a JSON file - func shareJsonFile() { + /// Shares the track as a GeoTrack-JSON file + func shareGeoTrackJsonFile() { guard let trackWrittenToJsonFile = trackWrittenToJsonFile else { return } diff --git a/GeoTrackKitExample/GeoTrackKitExample/Views/TrackList/TrackListTableViewController.swift b/GeoTrackKitExample/GeoTrackKitExample/Views/TrackList/TrackListTableViewController.swift index 8a463b3..5fdcde8 100644 --- a/GeoTrackKitExample/GeoTrackKitExample/Views/TrackList/TrackListTableViewController.swift +++ b/GeoTrackKitExample/GeoTrackKitExample/Views/TrackList/TrackListTableViewController.swift @@ -57,6 +57,11 @@ class TrackListTableViewController: UITableViewController { guard let track = load(trackUrl: tracks[indexPath.row]) else { return } + if track.track.name.isEmpty { + track.track.name = tracks[indexPath.row].filenameNoExtension ?? "" + } + + // swiftlint:disable:next force_cast let mapVC = UIStoryboard(name: "TrackView", bundle: nil).instantiateViewController(withIdentifier: "TrackMapViewController") as! TrackMapViewController mapVC.useDemoTrack = false