Skip to content

Commit

Permalink
[KML] Added new access rules AuthorOnly for web edited bookmarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
r.kuznetsov authored and Arsentiy Milchakov committed Jan 17, 2019
1 parent c8a0af2 commit 31a4e2f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions kml/pykmlib/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
}
}
Expand Down Expand Up @@ -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>("BookmarkIcon")
Expand Down
2 changes: 2 additions & 0 deletions kml/serdes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand Down
4 changes: 3 additions & 1 deletion kml/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum class AccessRules : uint8_t
DirectLink,
P2P,
Paid,
AuthorOnly,

Count
};
Expand All @@ -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();
Expand Down

0 comments on commit 31a4e2f

Please sign in to comment.