forked from organicmaps/organicmaps
[BM] Added web editor link
This commit is contained in:
parent
5028dbb86d
commit
dbe193dff0
4 changed files with 35 additions and 4 deletions
|
@ -858,6 +858,15 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCatalogDownload
|
|||
return ToJavaString(env, bm.GetCatalog().GetDownloadUrl(ToNativeString(env, serverId)));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetWebEditorUrl(
|
||||
JNIEnv * env, jobject, jstring serverId)
|
||||
{
|
||||
auto & bm = frm()->GetBookmarkManager();
|
||||
return ToJavaString(env, bm.GetCatalog().GetWebEditorUrl(ToNativeString(env, serverId),
|
||||
languages::GetCurrentNorm()));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCatalogFrontendUrl(
|
||||
JNIEnv * env, jobject)
|
||||
|
|
|
@ -619,6 +619,12 @@ public enum BookmarkManager
|
|||
return nativeGetCatalogDownloadUrl(serverId);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getWebEditorUrl(@NonNull String serverId)
|
||||
{
|
||||
return nativeGetWebEditorUrl(serverId);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getCatalogFrontendUrl()
|
||||
{
|
||||
|
@ -765,6 +771,9 @@ public enum BookmarkManager
|
|||
@NonNull
|
||||
private static native String nativeGetCatalogDownloadUrl(@NonNull String serverId);
|
||||
|
||||
@NonNull
|
||||
private static native String nativeGetWebEditorUrl(@NonNull String serverId);
|
||||
|
||||
@NonNull
|
||||
private static native String nativeGetCatalogFrontendUrl();
|
||||
|
||||
|
|
|
@ -63,6 +63,13 @@ std::string BuildUploadUrl()
|
|||
return kCatalogFrontendServer + "storage/upload";
|
||||
}
|
||||
|
||||
std::string BuildWebEditorUrl(std::string const & serverId, std::string const & language)
|
||||
{
|
||||
if (kCatalogDownloadServer.empty())
|
||||
return {};
|
||||
return kCatalogDownloadServer + "webeditor/" + language + "/edit/" + serverId;
|
||||
}
|
||||
|
||||
struct SubtagData
|
||||
{
|
||||
std::string m_name;
|
||||
|
@ -268,6 +275,12 @@ std::string BookmarkCatalog::GetDownloadUrl(std::string const & serverId) const
|
|||
return BuildCatalogDownloadUrl(serverId);
|
||||
}
|
||||
|
||||
std::string BookmarkCatalog::GetWebEditorUrl(std::string const & serverId,
|
||||
std::string const & language) const
|
||||
{
|
||||
return BuildWebEditorUrl(serverId, language);
|
||||
}
|
||||
|
||||
std::string BookmarkCatalog::GetFrontendUrl() const
|
||||
{
|
||||
return kCatalogFrontendServer + languages::GetCurrentNorm() + "/v2/mobilefront/";
|
||||
|
@ -428,13 +441,12 @@ void BookmarkCatalog::Upload(UploadData uploadData, std::string const & accessTo
|
|||
return;
|
||||
}
|
||||
|
||||
if (fileData->m_categoryData.m_accessRules == kml::AccessRules::Public &&
|
||||
uploadData.m_accessRules != kml::AccessRules::Public)
|
||||
if (!fileData->m_categoryData.m_authorId.empty() &&
|
||||
fileData->m_categoryData.m_authorId != uploadData.m_userId)
|
||||
{
|
||||
if (uploadErrorCallback)
|
||||
{
|
||||
uploadErrorCallback(UploadResult::AccessError, "Could not upload public bookmarks with " +
|
||||
DebugPrint(uploadData.m_accessRules) + " access.");
|
||||
uploadErrorCallback(UploadResult::AccessError, "Could not upload not own bookmarks.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
std::vector<std::string> GetDownloadingNames() const;
|
||||
|
||||
std::string GetDownloadUrl(std::string const & serverId) const;
|
||||
std::string GetWebEditorUrl(std::string const & serverId, std::string const & language) const;
|
||||
std::string GetFrontendUrl() const;
|
||||
|
||||
void RequestTagGroups(std::string const & language, TagGroupsCallback && callback) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue