From c6c151b3bd6f4e2fa6befcecc4125eacda3972f0 Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Wed, 6 Dec 2017 18:51:44 +0300 Subject: [PATCH] Fixed local experts showing and added rating rescaling --- iphone/Maps/UI/Discovery/DiscoveryLocalExpertCell.swift | 6 +++++- iphone/Maps/UI/Discovery/MWMDiscoveryController.mm | 2 +- partners_api/locals_api.cpp | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/iphone/Maps/UI/Discovery/DiscoveryLocalExpertCell.swift b/iphone/Maps/UI/Discovery/DiscoveryLocalExpertCell.swift index 3b8518ac7f..068ffc0a94 100644 --- a/iphone/Maps/UI/Discovery/DiscoveryLocalExpertCell.swift +++ b/iphone/Maps/UI/Discovery/DiscoveryLocalExpertCell.swift @@ -21,7 +21,11 @@ final class DiscoveryLocalExpertCell: UICollectionViewCell { price: Double, currency: String, tap: @escaping Tap) { - avatar.af_setImage(withURL: URL(string: avatarURL)!) + if avatarURL.count > 0 { + avatar.af_setImage(withURL: URL(string: avatarURL)!, imageTransition: .crossDissolve(kDefaultAnimationDuration)) + } else { + avatar.image = nil + } self.name.text = name rating.value = ratingValue rating.type = ratingType diff --git a/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm b/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm index 6b8330dd21..15db9f50e6 100644 --- a/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm +++ b/iphone/Maps/UI/Discovery/MWMDiscoveryController.mm @@ -118,7 +118,7 @@ struct Callback auto getTypes = [](MWMDiscoveryMode m) -> vector { if (m == MWMDiscoveryModeOnline) - return {ItemType::Viator, ItemType::Attractions, ItemType::Cafes}; + return {ItemType::Viator, ItemType::Attractions, ItemType::Cafes, ItemType::LocalExperts}; return {ItemType::Attractions, ItemType::Cafes}; }; diff --git a/partners_api/locals_api.cpp b/partners_api/locals_api.cpp index 3df6e1790d..f7ecc6112a 100644 --- a/partners_api/locals_api.cpp +++ b/partners_api/locals_api.cpp @@ -70,6 +70,10 @@ void ParseLocals(std::string const & src, std::vector & locals, FromJSONObject(item, "currency", local.m_currency); FromJSONObject(item, "about_me", local.m_aboutExpert); FromJSONObject(item, "i_will_show_you", local.m_offerDescription); + + // Rescale rating to [0.0; 10.0] range. + local.m_rating *= 2; + locals.push_back(move(local)); } }