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:
Diffstat (limited to 'map/framework.cpp')
-rw-r--r--map/framework.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/map/framework.cpp b/map/framework.cpp
index 5223d64195..6d1df75387 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -3338,3 +3338,26 @@ void Framework::UploadUGC(User::CompleteUploadingHandler const & onCompleteUploa
}
});
}
+
+void Framework::GetUGC(FeatureID const & id, ugc::Api::UGCCallback const & callback)
+{
+ m_ugcApi->GetUGC(id, [this, callback](ugc::UGC const & ugc, ugc::UGCUpdate const & update)
+ {
+ ugc::UGC filteredUGC = ugc;
+ filteredUGC.m_reviews = FilterUGCReviews(ugc.m_reviews);
+ callback(filteredUGC, update);
+ });
+}
+
+ugc::Reviews Framework::FilterUGCReviews(ugc::Reviews const & reviews) const
+{
+ ugc::Reviews result;
+ auto const details = m_user.GetDetails();
+ ASSERT(std::is_sorted(details.m_reviewIds.begin(), details.m_reviewIds.end()), ());
+ for (auto const & review : reviews)
+ {
+ if (!std::binary_search(details.m_reviewIds.begin(), details.m_reviewIds.end(), review.m_id))
+ result.push_back(review);
+ }
+ return result;
+}