From fb011eac33face499290b67953279fc12108e782 Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Wed, 31 Jul 2024 22:29:05 +0200 Subject: [PATCH] [android] Fixed invalid mime types for gpx and kmz Signed-off-by: Alexander Borsuk --- .../src/main/java/app/organicmaps/util/SharingUtils.java | 6 +++++- map/bookmark_manager.cpp | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/app/organicmaps/util/SharingUtils.java b/android/app/src/main/java/app/organicmaps/util/SharingUtils.java index abf400c366..99fa24e5e8 100644 --- a/android/app/src/main/java/app/organicmaps/util/SharingUtils.java +++ b/android/app/src/main/java/app/organicmaps/util/SharingUtils.java @@ -25,11 +25,14 @@ import app.organicmaps.R; import app.organicmaps.SplashActivity; import app.organicmaps.bookmarks.data.BookmarkInfo; import app.organicmaps.bookmarks.data.MapObject; +import app.organicmaps.util.log.Logger; public class SharingUtils { + private static final String TAG = SharingUtils.class.getSimpleName(); + private static final String KML_MIME_TYPE = "application/vnd.google-earth.kml+xml"; private static final String KMZ_MIME_TYPE = "application/vnd.google-earth.kmz"; - private static final String GPX_MIME_TYPE = "application/gpx"; + private static final String GPX_MIME_TYPE = "application/gpx+xml"; private static final String TEXT_MIME_TYPE = "text/plain"; public static class ShareInfo { @@ -224,6 +227,7 @@ public class SharingUtils if (!info.mFileName.isEmpty()) { final Uri fileUri = StorageUtils.getUriForFilePath(context, info.mFileName); + Logger.i(TAG, "Sharing file " + info.mMimeType + " " + info.mFileName + " with URI " + fileUri); intent.putExtra(Intent.EXTRA_STREAM, fileUri); intent.setDataAndType(fileUri, info.mMimeType); diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index ab42e98000..de04d1a0b9 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -45,9 +45,9 @@ size_t const kMinCommonTypesCount = 3; double const kNearDistanceInMeters = 20 * 1000.0; double const kMyPositionTrackSnapInMeters = 20.0; -std::string const kKMLMimeType = "application/vnd.google-earth.kml"; +std::string const kKMLMimeType = "application/vnd.google-earth.kml+xml"; std::string const kKMZMimeType = "application/vnd.google-earth.kmz"; -std::string const kGPXMimeType = "application/gpx"; +std::string const kGPXMimeType = "application/gpx+xml"; class FindMarkFunctor { @@ -105,7 +105,7 @@ BookmarkManager::SharingResult ExportSingleFileKml(BookmarkManager::KMLDataColle if (!CreateZipFromFiles({filePath}, tmpFilePath)) return {{categoryId}, BookmarkManager::SharingResult::Code::ArchiveError, "Could not create archive."}; - return {{categoryId}, std::move(tmpFilePath), kKMLMimeType}; + return {{categoryId}, std::move(tmpFilePath), kKMZMimeType}; } BookmarkManager::SharingResult ExportSingleFileGpx(BookmarkManager::KMLDataCollectionPtr::element_type::value_type const & kmlToShare)