Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI to export bookmarks as GPX #8137

Merged
merged 2 commits into from
May 30, 2024
Merged

Conversation

cyber-toad
Copy link
Contributor

@cyber-toad cyber-toad commented May 10, 2024

Once code change are completed I'll create translations & generate strings.
Also iOS changes will be required.
@biodranik WDYT about the implementation?

Closes #5271

@Jean-BaptisteC
Copy link
Member

FIY, app crash when you press button to export bookmarks :)

@cyber-toad
Copy link
Contributor Author

cyber-toad commented May 12, 2024

FIY, app crash when you press button to export bookmarks :)

Do you mean "Export all" button? I tried different exports and was not able to reproduce, is there a log available? Also do you build from latest source, there was an issue with accidental file removal, but I fixed it couple of days ago.

@cyber-toad
Copy link
Contributor Author

@Jean-BaptisteC could you please help me to reproduce the crash that you mentioned, what are the steps?

Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirylkaveryn can you please review and fix failing iOS code? And maybe add iOS buttons to export? :)

@Jean-BaptisteC
Copy link
Member

Do you mean "Export all" button? I tried different exports and was not able to reproduce, is there a log available? Also do you build from latest source, there was an issue with accidental file removal, but I fixed it couple of days ago.

Not able to reproduce crash

@kirylkaveryn
Copy link
Contributor

@cyber-toad I've updated the ios part.
Please, grab the last commit from here.
And add the ios tag for the generation of the string.
https://github.com/organicmaps/organicmaps/tree/ios/gpx-file-export-for-ios

Simulator Screen Recording - iPhone 15 Pro - 2024-05-20 at 18 47 28
Simulator Screen Recording - iPhone 15 Pro - 2024-05-20 at 18 49 02

@cyber-toad
Copy link
Contributor Author

cyber-toad commented May 26, 2024

@biodranik please have a look at this PR. I included ios changes, added translations (without regeneration of string files for now). Let me know if something else except translation verification & string regeneration is required. It is not clear what should be done with #8137 (comment), other items are implemented.

@cyber-toad cyber-toad marked this pull request as ready for review May 26, 2024 21:01
Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks. A menu item on ios is not translated, does the key matches the android one?

@rtsisyk can you please help and release an alpha today with all PRs marked in the milestone including this one?

@cyber-toad unrelated question: what's missing in the core to export/import timestamps for each point of a track for both kml and gpx?

Any other data that should be saved for recorded tracks?

map/bookmark_manager.cpp Outdated Show resolved Hide resolved
map/map_tests/bookmarks_test.cpp Outdated Show resolved Hide resolved
map/map_tests/bookmarks_test.cpp Outdated Show resolved Hide resolved
auto checker = [](BookmarkManager::SharingResult const & result)
{
auto fileName = result.m_sharingPath;
TEST(fileName.find("Some random route.gpx") != std::string::npos, ());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEST_EQUAL 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get what should be compared with 0? fileName is "/tmp/Some random route.gpx" in this test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that's confusing, then it should be renamed to filePath.

map/map_tests/bookmarks_test.cpp Outdated Show resolved Hide resolved
map/map_tests/bookmarks_test.cpp Show resolved Hide resolved
@biodranik biodranik added this to the Needs alpha/beta testing milestone May 26, 2024
@kirylkaveryn
Copy link
Contributor

A menu item on ios is not translated, does the key matches the android one?

I've made the screen records before the string was translated and regenerated.

I will make an additional recordings soon and will add here.

@biodranik
Copy link
Member

Thanks! These two strings should be replaced:
image

@biodranik
Copy link
Member

biodranik commented May 27, 2024

@kirylkaveryn another issue I saw in iOS simulator when saving a GPX to Files, do we need to somehow specify/add a definition for the saved/exported .gpx file extension/mime type?

2024-05-27 08:52:12.309440+0200 Organic Maps (Debug)[8222:3200376] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement `+_allowedItemPayloadClasses`. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error. Extension: <EXConcreteExtension: 0x600003347c00> {id = com.apple.DocumentManagerUICore.SaveToFiles} Items: (
    "<NSExtensionItem: 0x6000004fe070> - userInfo: {\n    NSExtensionItemAttachmentsKey =     (\n        \"<NSItemProvider: 0x600002d72680> {types = (\\n    \\\"public.plain-text\\\"\\n)}\",\n        \"<NSItemProvider: 0x600002d7a530> {types = (\\n    \\\"com.topografix.gpx\\\",\\n    \\\"public.file-url\\\"\\n)}\"\n    );\n    \"com.apple.UIKit.NSExtensionItemUserInfoIsContentManagedKey\" = 0;\n}"
)

@kirylkaveryn
Copy link
Contributor

kirylkaveryn commented May 27, 2024

Thanks! These two strings should be replaced:

The strings were added correctly into the ios (check the export_file_gpx localized strings). But they are still not generated.

(after regen)
image

@kirylkaveryn
Copy link
Contributor

kirylkaveryn commented May 27, 2024

@kirylkaveryn another issue I saw in iOS simulator when saving a GPX to Files, do we need to somehow specify/add a definition for the saved/exported .gpx file extension/mime type?

2024-05-27 08:52:12.309440+0200 Organic Maps (Debug)[8222:3200376] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement `+_allowedItemPayloadClasses`. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error. Extension: <EXConcreteExtension: 0x600003347c00> {id = com.apple.DocumentManagerUICore.SaveToFiles} Items: (
    "<NSExtensionItem: 0x6000004fe070> - userInfo: {\n    NSExtensionItemAttachmentsKey =     (\n        \"<NSItemProvider: 0x600002d72680> {types = (\\n    \\\"public.plain-text\\\"\\n)}\",\n        \"<NSItemProvider: 0x600002d7a530> {types = (\\n    \\\"com.topografix.gpx\\\",\\n    \\\"public.file-url\\\"\\n)}\"\n    );\n    \"com.apple.UIKit.NSExtensionItemUserInfoIsContentManagedKey\" = 0;\n}"
)

Hmm... I can't catch such warnings on either the device and the simulator. And we haven't any extensions.
There are some other internal warnings but they do not affect the functionality.

And we already have all related type...

@cyber-toad
Copy link
Contributor Author

@cyber-toad unrelated question: what's missing in the core to export/import timestamps for each point of a track for both kml and gpx?

kml::MultiGeometry that is used in TrackData uses PointWithAltitude that is (x, y, h) without timestamp. Once there is a timestamp there we can update parsers to populate.

Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! @cyber-toad can you please squash all commits, and make a separate strings regeneration commit, that will also include iOS strings?

auto checker = [](BookmarkManager::SharingResult const & result)
{
auto fileName = result.m_sharingPath;
TEST(fileName.find("Some random route.gpx") != std::string::npos, ());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that's confusing, then it should be renamed to filePath.

@cyber-toad
Copy link
Contributor Author

Thanks! @cyber-toad can you please squash all commits, and make a separate strings regeneration commit, that will also include iOS strings?

Done

Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A few nits before merge.

@@ -662,7 +662,8 @@
<string name="bookmarks_empty_list_title">This list is empty</string>
<string name="bookmarks_empty_list_message">To add a bookmark, tap a place on the map and then tap the star icon</string>
<string name="category_desc_more">…more</string>
<string name="export_file">Export file</string>
<string name="export_file">Export KML/KMZ file</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the regenerated commit to avoid conflicts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like strings.xml is still modified here. Can it be moved to another commit?

data/strings/strings.txt Show resolved Hide resolved
map/bookmark_manager.cpp Outdated Show resolved Hide resolved
map/bookmark_manager.cpp Outdated Show resolved Hide resolved
Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the changes were not pushed yet...

@@ -662,7 +662,8 @@
<string name="bookmarks_empty_list_title">This list is empty</string>
<string name="bookmarks_empty_list_message">To add a bookmark, tap a place on the map and then tap the star icon</string>
<string name="category_desc_more">…more</string>
<string name="export_file">Export file</string>
<string name="export_file">Export KML/KMZ file</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like strings.xml is still modified here. Can it be moved to another commit?

data/strings/strings.txt Show resolved Hide resolved
@cyber-toad
Copy link
Contributor Author

Looks like the changes were not pushed yet...

yep, I replied during applying changes should be pushed now

Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and a few (hopefully final!) nits.

map/bookmark_manager.cpp Outdated Show resolved Hide resolved
map/bookmark_manager.cpp Outdated Show resolved Hide resolved
Signed-off-by: cyber-toad <the.cyber.toad@proton.me>
Signed-off-by: cyber-toad <the.cyber.toad@proton.me>
Copy link
Member

@biodranik biodranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your patience and for finishing a new feature!

@biodranik biodranik merged commit 9af27a3 into organicmaps:master May 30, 2024
14 of 16 checks passed
@rtsisyk
Copy link
Contributor

rtsisyk commented May 30, 2024

I was in the middle of testing this feature... Have you got at least one review from anybody who works on Android?

@biodranik
Copy link
Member

The author tested it on Android, JB has tested it on Android, and I have tested it on Android.

Any discovered issues can be fixed.

@rtsisyk
Copy link
Contributor

rtsisyk commented May 30, 2024

The author tested it on Android, JB has tested it on Android, and I have tested it on Android.

#8332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to export in GPX
5 participants