forked from organicmaps/organicmaps
Review fixes
This commit is contained in:
parent
905310204d
commit
8d2c6f9381
5 changed files with 57 additions and 0 deletions
|
@ -462,6 +462,14 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryTags(
|
|||
categoryTags);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeSetCategoryAccessRules(
|
||||
JNIEnv * env, jobject, jlong catId, jint accessRules)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().SetCategoryAccessRules(
|
||||
static_cast<kml::MarkGroupId>(catId), static_cast<kml::AccessRules>(accessRules));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCategoryName(
|
||||
JNIEnv * env, jobject thiz, jlong catId)
|
||||
|
@ -479,6 +487,15 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCategoryAuthor(
|
|||
return ToJavaString(env, data.m_authorName);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCategoryAccessRules(
|
||||
JNIEnv * env, jobject thiz, jlong catId)
|
||||
{
|
||||
auto const & data = frm()->GetBookmarkManager().GetCategoryData(
|
||||
static_cast<kml::MarkGroupId>(catId));
|
||||
return static_cast<jint>(data.m_accessRules);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetBookmarksCount(
|
||||
JNIEnv * env, jobject thiz, jlong catId)
|
||||
|
|
|
@ -47,6 +47,16 @@ public enum BookmarkManager
|
|||
|
||||
public static final List<Icon> ICONS = new ArrayList<>();
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({ ACCESS_RULES_LOCAL, ACCESS_RULES_PUBLIC, ACCESS_RULES_DIRECT_LINK,
|
||||
ACCESS_RULES_P2P, ACCESS_RULES_PAID })
|
||||
public @interface AccessRules {}
|
||||
public static final int ACCESS_RULES_LOCAL = 0;
|
||||
public static final int ACCESS_RULES_PUBLIC = 1;
|
||||
public static final int ACCESS_RULES_DIRECT_LINK = 2;
|
||||
public static final int ACCESS_RULES_P2P = 3;
|
||||
public static final int ACCESS_RULES_PAID = 4;
|
||||
|
||||
@NonNull
|
||||
private final List<BookmarksLoadingListener> mListeners = new ArrayList<>();
|
||||
|
||||
|
@ -587,9 +597,14 @@ public enum BookmarkManager
|
|||
|
||||
private native void nativeSetCategoryTags(long catId, @NonNull String[] tagsIds);
|
||||
|
||||
private native void nativeSetCategoryAccessRules(long catId, @AccessRules int accessRules);
|
||||
|
||||
@NonNull
|
||||
private native String nativeGetCategoryAuthor(long catId);
|
||||
|
||||
@AccessRules
|
||||
private native int nativeGetCategoryAccessRules(long catId);
|
||||
|
||||
private static native void nativeLoadBookmarks();
|
||||
|
||||
private native boolean nativeDeleteCategory(long catId);
|
||||
|
|
|
@ -174,10 +174,19 @@ void BookmarkCatalog::RequestTagGroups(std::string const & language,
|
|||
if (resultCode >= 200 && resultCode < 300) // Ok.
|
||||
{
|
||||
TagsResponseData tagsResponseData;
|
||||
try
|
||||
{
|
||||
coding::DeserializerJson des(request.ServerResponse());
|
||||
des(tagsResponseData);
|
||||
}
|
||||
catch (coding::DeserializerJson::Exception const & ex)
|
||||
{
|
||||
LOG(LWARNING, ("Tags request deserialization error:", ex.Msg()));
|
||||
if (callback)
|
||||
callback(false /* success */, {});
|
||||
return;
|
||||
}
|
||||
|
||||
TagGroups result;
|
||||
result.reserve(tagsResponseData.m_tags.size());
|
||||
for (auto const & t : tagsResponseData.m_tags)
|
||||
|
|
|
@ -819,6 +819,14 @@ void BookmarkManager::SetCategoryTags(kml::MarkGroupId categoryId, std::vector<s
|
|||
category->SetTags(tags);
|
||||
}
|
||||
|
||||
void BookmarkManager::SetCategoryAccessRules(kml::MarkGroupId categoryId, kml::AccessRules accessRules)
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
auto category = GetBmCategory(categoryId);
|
||||
CHECK(category != nullptr, ());
|
||||
category->SetAccessRules(accessRules);
|
||||
}
|
||||
|
||||
std::string BookmarkManager::GetCategoryFileName(kml::MarkGroupId categoryId) const
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
|
@ -2523,6 +2531,12 @@ void BookmarkManager::EditSession::SetCategoryTags(kml::MarkGroupId categoryId,
|
|||
m_bmManager.SetCategoryTags(categoryId, tags);
|
||||
}
|
||||
|
||||
void BookmarkManager::EditSession::SetCategoryAccessRules(kml::MarkGroupId categoryId, kml::AccessRules accessRules)
|
||||
{
|
||||
CHECK(m_bmManager.IsEditableCategory(categoryId), ());
|
||||
m_bmManager.SetCategoryAccessRules(categoryId, accessRules);
|
||||
}
|
||||
|
||||
bool BookmarkManager::EditSession::DeleteBmCategory(kml::MarkGroupId groupId)
|
||||
{
|
||||
return m_bmManager.DeleteBmCategory(groupId);
|
||||
|
|
|
@ -126,6 +126,7 @@ public:
|
|||
|
||||
void SetCategoryName(kml::MarkGroupId categoryId, std::string const & name);
|
||||
void SetCategoryTags(kml::MarkGroupId categoryId, std::vector<std::string> const & tags);
|
||||
void SetCategoryAccessRules(kml::MarkGroupId categoryId, kml::AccessRules accessRules);
|
||||
bool DeleteBmCategory(kml::MarkGroupId groupId);
|
||||
|
||||
void NotifyChanges();
|
||||
|
@ -427,6 +428,7 @@ private:
|
|||
|
||||
void SetCategoryName(kml::MarkGroupId categoryId, std::string const & name);
|
||||
void SetCategoryTags(kml::MarkGroupId categoryId, std::vector<std::string> const & tags);
|
||||
void SetCategoryAccessRules(kml::MarkGroupId categoryId, kml::AccessRules accessRules);
|
||||
bool DeleteBmCategory(kml::MarkGroupId groupId);
|
||||
void ClearCategories();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue