From 31a4e2f0f12f9de109f7353869c50fe60aea19dc Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Wed, 16 Jan 2019 16:53:36 +0300 Subject: [PATCH] [KML] Added new access rules AuthorOnly for web edited bookmarks. --- .../com/mapswithme/maps/bookmarks/data/BookmarkCategory.java | 4 +++- iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm | 1 + kml/pykmlib/bindings.cpp | 2 ++ kml/serdes.cpp | 2 ++ kml/types.hpp | 4 +++- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java index 0cc332fa251..b5f8655eba4 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java @@ -400,7 +400,9 @@ public enum AccessRules ACCESS_RULES_PUBLIC(R.string.public_access, R.drawable.ic_public_inline), ACCESS_RULES_DIRECT_LINK(R.string.limited_access, R.drawable.ic_link_inline), ACCESS_RULES_P2P(R.string.access_rules_p_to_p, R.drawable.ic_public_inline), - ACCESS_RULES_PAID(R.string.access_rules_paid, R.drawable.ic_public_inline); + ACCESS_RULES_PAID(R.string.access_rules_paid, R.drawable.ic_public_inline), + //TODO(@alexzatsepin): Set correct resources. + ACCESS_RULES_AUTHOR_ONLY(R.string.access_rules_p_to_p, R.drawable.ic_public_inline); private final int mResId; private final int mDrawableResId; diff --git a/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm b/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm index 9be494cfa74..5a78881e0f9 100644 --- a/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm +++ b/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm @@ -322,6 +322,7 @@ - (MWMCategoryAccessStatus)getCategoryAccessStatus:(MWMMarkGroupID)groupId return MWMCategoryAccessStatusPrivate; case kml::AccessRules::P2P: case kml::AccessRules::Paid: + case kml::AccessRules::AuthorOnly: case kml::AccessRules::Count: return MWMCategoryAccessStatusOther; } diff --git a/kml/pykmlib/bindings.cpp b/kml/pykmlib/bindings.cpp index b948b487faf..fcd6eee3f60 100644 --- a/kml/pykmlib/bindings.cpp +++ b/kml/pykmlib/bindings.cpp @@ -313,6 +313,7 @@ std::string AccessRulesToString(AccessRules accessRules) case AccessRules::P2P: return "P2P"; case AccessRules::Paid: return "PAID"; case AccessRules::Public: return "PUBLIC"; + case AccessRules::AuthorOnly: return "AUTHOR_ONLY"; case AccessRules::Count: CHECK(false, ("Unknown access rules")); return {}; } } @@ -666,6 +667,7 @@ BOOST_PYTHON_MODULE(pykmlib) .value(AccessRulesToString(AccessRules::P2P).c_str(), AccessRules::P2P) .value(AccessRulesToString(AccessRules::Paid).c_str(), AccessRules::Paid) .value(AccessRulesToString(AccessRules::Public).c_str(), AccessRules::Public) + .value(AccessRulesToString(AccessRules::AuthorOnly).c_str(), AccessRules::AuthorOnly) .export_values(); enum_("BookmarkIcon") diff --git a/kml/serdes.cpp b/kml/serdes.cpp index 9c8f0be2b88..49493617229 100644 --- a/kml/serdes.cpp +++ b/kml/serdes.cpp @@ -817,6 +817,8 @@ void KmlParser::CharData(std::string value) m_data.m_categoryData.m_accessRules = AccessRules::Paid; else if (value == "Public") m_data.m_categoryData.m_accessRules = AccessRules::Public; + else if (value == "AuthorOnly") + m_data.m_categoryData.m_accessRules = AccessRules::AuthorOnly; } else if (currTag == "mwm:imageUrl") { diff --git a/kml/types.hpp b/kml/types.hpp index 484e27c6dbc..f55ea64eb20 100644 --- a/kml/types.hpp +++ b/kml/types.hpp @@ -55,6 +55,7 @@ enum class AccessRules : uint8_t DirectLink, P2P, Paid, + AuthorOnly, Count }; @@ -64,10 +65,11 @@ inline std::string DebugPrint(AccessRules accessRules) switch (accessRules) { case AccessRules::Local: return "Local"; + case AccessRules::Public: return "Public"; case AccessRules::DirectLink: return "DirectLink"; case AccessRules::P2P: return "P2P"; case AccessRules::Paid: return "Paid"; - case AccessRules::Public: return "Public"; + case AccessRules::AuthorOnly: return "AuthorOnly"; case AccessRules::Count: return {}; } UNREACHABLE();