Review fixes

This commit is contained in:
r.kuznetsov 2019-05-28 11:17:52 +03:00 committed by Arsentiy Milchakov
parent b3618bd893
commit d7bae8db7b
3 changed files with 30 additions and 32 deletions

View file

@ -41,7 +41,7 @@ BOOL canAutoDownload(storage::CountryId const & countryId)
return !platform::migrate::NeedMigrate();
}
promo::DownloaderPromoBanner getPromoBanner(std::string const & mwmId)
promo::DownloaderPromo::Banner getPromoBanner(std::string const & mwmId)
{
auto const & purchase = GetFramework().GetPurchase();
bool const hasRemoveAdsSubscription = purchase && purchase->IsSubscriptionActive(SubscriptionType::RemoveAds);
@ -77,7 +77,7 @@ using namespace storage;
{
CountryId m_countryId;
CountryId m_autoDownloadCountryId;
promo::DownloaderPromoBanner m_promoBanner;
promo::DownloaderPromo::Banner m_promoBanner;
}
+ (instancetype)dialogForController:(MapViewController *)controller
@ -287,7 +287,7 @@ using namespace storage;
{
m_promoBanner = getPromoBanner(m_countryId);
// TODO: implement other banner types.
if (m_promoBanner.m_type == promo::DownloaderPromoType::Megafon && self.bannerView.hidden)
if (m_promoBanner.m_type == promo::DownloaderPromo::Type::Megafon && self.bannerView.hidden)
{
[self layoutIfNeeded];
self.bannerVisibleConstraint.priority = UILayoutPriorityDefaultHigh;

View file

@ -5,13 +5,13 @@
namespace promo
{
// static
DownloaderPromoBanner DownloaderPromo::GetBanner(storage::Storage const & storage,
std::string const & mwmId,
std::string const & currentLocale,
bool hasRemoveAdsSubscription)
DownloaderPromo::Banner DownloaderPromo::GetBanner(storage::Storage const & storage,
std::string const & mwmId,
std::string const & currentLocale,
bool hasRemoveAdsSubscription)
{
if (!hasRemoveAdsSubscription && ads::HasMegafonDownloaderBanner(storage, mwmId, currentLocale))
return {DownloaderPromoType::Megafon, ads::GetMegafonDownloaderBannerUrl()};
return {DownloaderPromo::Type::Megafon, ads::GetMegafonDownloaderBannerUrl()};
// TODO: add bookmark catalog banner.

View file

@ -7,32 +7,30 @@
namespace promo
{
// Do not change the order.
enum class DownloaderPromoType : uint8_t
{
NoPromo = 0,
BookmarkCatalog = 1,
Megafon = 2
};
struct DownloaderPromoBanner
{
DownloaderPromoBanner() = default;
DownloaderPromoBanner(DownloaderPromoType type, std::string const & url)
: m_type(type)
, m_url(url)
{}
DownloaderPromoType m_type = DownloaderPromoType::NoPromo;
std::string m_url;
};
class DownloaderPromo
{
public:
static DownloaderPromoBanner GetBanner(storage::Storage const & storage,
std::string const & mwmId,
std::string const & currentLocale,
bool hasRemoveAdsSubscription);
// Do not change the order.
enum class Type : uint8_t
{
NoPromo = 0,
BookmarkCatalog = 1,
Megafon = 2
};
struct Banner
{
Banner() = default;
Banner(Type type, std::string const & url)
: m_type(type)
, m_url(url)
{}
Type m_type = Type::NoPromo;
std::string m_url;
};
static Banner GetBanner(storage::Storage const & storage, std::string const & mwmId,
std::string const & currentLocale, bool hasRemoveAdsSubscription);
};
} // namespace promo