Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/jni/CMakeLists.txt1
-rw-r--r--indexer/feature_utils.cpp7
-rw-r--r--indexer/feature_utils.hpp11
-rw-r--r--iphone/Maps/Maps.xcodeproj/project.pbxproj4
-rw-r--r--map/framework.cpp17
-rw-r--r--map/framework.hpp9
-rw-r--r--map/map_tests/CMakeLists.txt1
-rw-r--r--map/place_page_info.cpp2
-rw-r--r--map/place_page_info.hpp4
-rw-r--r--openlr/openlr_match_quality/openlr_assessment_tool/CMakeLists.txt1
-rw-r--r--qt/CMakeLists.txt1
-rw-r--r--routing/routing_tests/CMakeLists.txt1
-rw-r--r--search/search_quality/assessment_tool/CMakeLists.txt1
-rw-r--r--storage/storage_integration_tests/CMakeLists.txt1
14 files changed, 60 insertions, 1 deletions
diff --git a/android/jni/CMakeLists.txt b/android/jni/CMakeLists.txt
index d44c588dc6..6acc2974e0 100644
--- a/android/jni/CMakeLists.txt
+++ b/android/jni/CMakeLists.txt
@@ -115,6 +115,7 @@ target_link_libraries(
shaders
search
storage
+ descriptions
ugc
drape
kml
diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp
index b073749ca7..c0d0c0146d 100644
--- a/indexer/feature_utils.cpp
+++ b/indexer/feature_utils.cpp
@@ -15,7 +15,6 @@
#include <unordered_map>
#include <utility>
-#include <vector>
using namespace std;
@@ -367,4 +366,10 @@ bool GetPreferredName(StringUtf8Multilang const & src, int8_t deviceLang, string
auto const priorityList = MakePrimaryNamePriorityList(deviceLang, true /* preferDefault */);
return GetBestName(src, priorityList, out);
}
+
+vector<int8_t> GetDescriptionLangPriority(RegionData const & regionData, int8_t const deviceLang)
+{
+ bool const preferDefault = IsNativeLang(regionData, deviceLang);
+ return MakePrimaryNamePriorityList(deviceLang, preferDefault);
+}
} // namespace feature
diff --git a/indexer/feature_utils.hpp b/indexer/feature_utils.hpp
index ac45f932e2..719fa908a4 100644
--- a/indexer/feature_utils.hpp
+++ b/indexer/feature_utils.hpp
@@ -4,6 +4,8 @@
#include "base/base.hpp"
+#include <vector>
+
struct FeatureID;
class StringUtf8Multilang;
@@ -64,4 +66,13 @@ namespace feature
/// Returns preferred name when only the device language is available.
bool GetPreferredName(StringUtf8Multilang const & src, int8_t deviceLang, string & out);
+
+ /// Returns priority list of language codes for feature description,
+ /// the priority is the following:
+ /// - device language code;
+ /// - default language code if MWM contains user's language (or similar to device languages if provided);
+ /// - similar to device languages if provided;
+ /// - international language code;
+ /// - english language code;
+ std::vector<int8_t> GetDescriptionLangPriority(RegionData const & regionData, int8_t const deviceLang);
} // namespace feature
diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj
index 5d0be170cc..cb5a0da089 100644
--- a/iphone/Maps/Maps.xcodeproj/project.pbxproj
+++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj
@@ -546,6 +546,7 @@
B3E3B4FD20D463B700DA8C13 /* BMCCategoriesHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = B3E3B4FC20D463B700DA8C13 /* BMCCategoriesHeader.xib */; };
B3E3B50220D485FA00DA8C13 /* DownloadedBookmarksDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3E3B50120D485FA00DA8C13 /* DownloadedBookmarksDataSource.swift */; };
BB25B1A71FB32767007276FA /* transit_colors.txt in Resources */ = {isa = PBXBuildFile; fileRef = BB25B1A51FB32767007276FA /* transit_colors.txt */; };
+ BB2C99B021B6AB4500F7371C /* libdescriptions.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BB2C99AF21B6AB4500F7371C /* libdescriptions.a */; };
BB7626B61E85599C0031D71C /* icudt57l.dat in Resources */ = {isa = PBXBuildFile; fileRef = BB7626B41E8559980031D71C /* icudt57l.dat */; };
BB8123CF212C264700ADE512 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB8123CD212C264700ADE512 /* Metal.framework */; };
BB8123D0212C264700ADE512 /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB8123CE212C264700ADE512 /* MetalKit.framework */; };
@@ -1551,6 +1552,7 @@
B3E3B4FC20D463B700DA8C13 /* BMCCategoriesHeader.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BMCCategoriesHeader.xib; sourceTree = "<group>"; };
B3E3B50120D485FA00DA8C13 /* DownloadedBookmarksDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadedBookmarksDataSource.swift; sourceTree = "<group>"; };
BB25B1A51FB32767007276FA /* transit_colors.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = transit_colors.txt; path = ../../data/transit_colors.txt; sourceTree = "<group>"; };
+ BB2C99AF21B6AB4500F7371C /* libdescriptions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libdescriptions.a; sourceTree = BUILT_PRODUCTS_DIR; };
BB7626B41E8559980031D71C /* icudt57l.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = icudt57l.dat; path = ../../data/icudt57l.dat; sourceTree = "<group>"; };
BB8123CD212C264700ADE512 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
BB8123CE212C264700ADE512 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; };
@@ -1967,6 +1969,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ BB2C99B021B6AB4500F7371C /* libdescriptions.a in Frameworks */,
3D1958EB213804B6009A83EC /* libmetrics.a in Frameworks */,
4598438621394CFD00F8CAB2 /* MetalPerformanceShaders.framework in Frameworks */,
BB8123CF212C264700ADE512 /* Metal.framework in Frameworks */,
@@ -2142,6 +2145,7 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
+ BB2C99AF21B6AB4500F7371C /* libdescriptions.a */,
474C9F59213FF75800369009 /* StoreKit.framework */,
3D1958EA213804B6009A83EC /* libmetrics.a */,
4598438521394CFD00F8CAB2 /* MetalPerformanceShaders.framework */,
diff --git a/map/framework.cpp b/map/framework.cpp
index c3c665c1bc..7816218f4f 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -45,6 +45,8 @@
#include "editor/editable_data_source.hpp"
+#include "descriptions/loader.hpp"
+
#include "indexer/categories_holder.hpp"
#include "indexer/classificator.hpp"
#include "indexer/classificator_loader.hpp"
@@ -426,6 +428,7 @@ Framework::Framework(FrameworkParams const & params)
})
, m_lastReportedCountry(kInvalidCountryId)
, m_popularityLoader(m_model.GetDataSource())
+ , m_descriptionsLoader(std::make_unique<descriptions::Loader>(m_model.GetDataSource()))
, m_purchase(std::make_unique<Purchase>())
, m_tipsApi(static_cast<TipsApi::Delegate &>(*this))
, m_notificationManager(static_cast<notifications::NotificationManager::Delegate &>(*this))
@@ -947,6 +950,7 @@ void Framework::FillInfoFromFeatureType(FeatureType & ft, place_page::Info & inf
}
FillLocalExperts(ft, info);
+ FillDescription(ft, info);
auto const mwmInfo = ft.GetID().m_mwmId.GetInfo();
bool const isMapVersionEditable = mwmInfo && mwmInfo->m_version.IsEditableMap();
@@ -3685,6 +3689,19 @@ void Framework::FillLocalExperts(FeatureType & ft, place_page::Info & info) cons
info.SetLocalsPageUrl(locals::Api::GetLocalsPageUrl());
}
+void Framework::FillDescription(FeatureType & ft, place_page::Info & info) const
+{
+ if (!ft.GetID().m_mwmId.IsAlive())
+ return;
+ auto const & regionData = ft.GetID().m_mwmId.GetInfo()->GetRegionData();
+ auto const deviceLang = StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm());
+ auto const langPriority = feature::GetDescriptionLangPriority(regionData, deviceLang);
+
+ std::string description;
+ if (m_descriptionsLoader->GetDescription(ft.GetID(), langPriority, description))
+ info.SetDescription(std::move(description));
+}
+
void Framework::UploadUGC(User::CompleteUploadingHandler const & onCompleteUploading)
{
if (GetPlatform().ConnectionStatus() == Platform::EConnectionType::CONNECTION_NONE ||
diff --git a/map/framework.hpp b/map/framework.hpp
index 40493529ff..8a6fca894b 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -119,6 +119,11 @@ namespace ads
class Engine;
}
+namespace descriptions
+{
+class Loader;
+}
+
/// Uncomment line to make fixed position settings and
/// build version for screenshots.
//#define FIXED_LOCATION
@@ -542,6 +547,8 @@ private:
CachingPopularityLoader m_popularityLoader;
+ unique_ptr<descriptions::Loader> m_descriptionsLoader;
+
public:
using TSearchRequest = search::QuerySaver::TSearchRequest;
@@ -875,6 +882,8 @@ private:
void FillLocalExperts(FeatureType & ft, place_page::Info & info) const;
+ void FillDescription(FeatureType & ft, place_page::Info & info) const;
+
public:
// UGC.
void UploadUGC(User::CompleteUploadingHandler const & onCompleteUploading);
diff --git a/map/map_tests/CMakeLists.txt b/map/map_tests/CMakeLists.txt
index dbc90c26f8..43d0254706 100644
--- a/map/map_tests/CMakeLists.txt
+++ b/map/map_tests/CMakeLists.txt
@@ -50,6 +50,7 @@ omim_link_libraries(
metrics
mwm_diff
bsdiff
+ descriptions
ugc
partners_api
local_ads
diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp
index ad42265fef..279657ac3a 100644
--- a/map/place_page_info.cpp
+++ b/map/place_page_info.cpp
@@ -2,6 +2,8 @@
#include "map/bookmark_helpers.hpp"
#include "map/reachable_by_taxi_checker.hpp"
+#include "descriptions/loader.hpp"
+
#include "partners_api/ads_engine.hpp"
#include "partners_api/banner.hpp"
#include "partners_api/partners.hpp"
diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp
index acfb1d8262..80c468a691 100644
--- a/map/place_page_info.hpp
+++ b/map/place_page_info.hpp
@@ -105,6 +105,7 @@ public:
/// Convenient wrapper for type, cuisines, elevation, stars, wifi etc.
std::string const & GetSubtitle() const { return m_uiSubtitle; };
std::string const & GetAddress() const { return m_uiAddress; }
+ std::string const & GetDescription() const { return m_description; }
/// @returns coordinate in DMS format if isDMS is true
std::string GetFormattedCoordinate(bool isDMS) const;
/// @return rating raw value or kInvalidRating if there is no data.
@@ -212,6 +213,8 @@ public:
/// MapObject
void SetFromFeatureType(FeatureType & ft);
+ void SetDescription(std::string && description) { m_description = std::move(description); }
+
void SetMercator(m2::PointD const & mercator) { m_mercator = mercator; }
std::vector<std::string> GetRawTypes() const { return m_types.ToObjectNames(); }
@@ -234,6 +237,7 @@ private:
std::string m_uiSubtitle;
std::string m_uiSecondaryTitle;
std::string m_uiAddress;
+ std::string m_description;
// TODO(AlexZ): Temporary solution. It's better to use a wifi icon in UI instead of text.
std::string m_localizedWifiString;
/// Booking rating string
diff --git a/openlr/openlr_match_quality/openlr_assessment_tool/CMakeLists.txt b/openlr/openlr_match_quality/openlr_assessment_tool/CMakeLists.txt
index 183d191dfe..e33ffe9733 100644
--- a/openlr/openlr_match_quality/openlr_assessment_tool/CMakeLists.txt
+++ b/openlr/openlr_match_quality/openlr_assessment_tool/CMakeLists.txt
@@ -44,6 +44,7 @@ omim_link_libraries(
traffic
routing_common
transit
+ descriptions
ugc
drape
partners_api
diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt
index 941ff9e7cb..c4662fceca 100644
--- a/qt/CMakeLists.txt
+++ b/qt/CMakeLists.txt
@@ -73,6 +73,7 @@ omim_link_libraries(
traffic
routing_common
transit
+ descriptions
ugc
drape
partners_api
diff --git a/routing/routing_tests/CMakeLists.txt b/routing/routing_tests/CMakeLists.txt
index a16e3c88ab..03d9d637d4 100644
--- a/routing/routing_tests/CMakeLists.txt
+++ b/routing/routing_tests/CMakeLists.txt
@@ -47,6 +47,7 @@ omim_link_libraries(
routing_common
transit
kml
+ descriptions
indexer
platform
geometry
diff --git a/search/search_quality/assessment_tool/CMakeLists.txt b/search/search_quality/assessment_tool/CMakeLists.txt
index 1e72459d11..2a1bc29b4c 100644
--- a/search/search_quality/assessment_tool/CMakeLists.txt
+++ b/search/search_quality/assessment_tool/CMakeLists.txt
@@ -49,6 +49,7 @@ omim_link_libraries(
traffic
routing_common
transit
+ descriptions
ugc
drape
partners_api
diff --git a/storage/storage_integration_tests/CMakeLists.txt b/storage/storage_integration_tests/CMakeLists.txt
index 1810e3db41..9c13ed606d 100644
--- a/storage/storage_integration_tests/CMakeLists.txt
+++ b/storage/storage_integration_tests/CMakeLists.txt
@@ -31,6 +31,7 @@ omim_link_libraries(
storage
tracking
traffic
+ descriptions
ugc
drape
partners_api