forked from organicmaps/organicmaps
Megafon only for russians
This commit is contained in:
parent
be33f936d2
commit
8b03f2d8de
4 changed files with 13 additions and 5 deletions
|
@ -1636,7 +1636,8 @@ Java_com_mapswithme_maps_Framework_nativeHasMegafonDownloaderBanner(JNIEnv * env
|
|||
jstring mwmId)
|
||||
{
|
||||
return static_cast<jboolean>(ads::HasMegafonDownloaderBanner(frm()->GetStorage(),
|
||||
jni::ToNativeString(env, mwmId)));
|
||||
jni::ToNativeString(env, mwmId),
|
||||
languages::GetCurrentNorm()));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
|
|
|
@ -51,8 +51,12 @@ storage::TCountriesVec const kCountries = {
|
|||
};
|
||||
} // namespace
|
||||
|
||||
bool HasMegafonDownloaderBanner(storage::Storage const & storage, std::string const & mwmId)
|
||||
bool HasMegafonDownloaderBanner(storage::Storage const & storage, std::string const & mwmId,
|
||||
std::string const & currentLocale)
|
||||
{
|
||||
if (currentLocale.find("ru") == std::string::npos)
|
||||
return false;
|
||||
|
||||
storage::TCountriesVec countries;
|
||||
storage.GetTopmostNodesFor(mwmId, countries);
|
||||
for (auto const & c : countries)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace ads
|
||||
{
|
||||
extern bool HasMegafonDownloaderBanner(storage::Storage const & storage, std::string const & mwmId);
|
||||
extern bool HasMegafonDownloaderBanner(storage::Storage const & storage, std::string const & mwmId,
|
||||
std::string const & currentLocale);
|
||||
extern std::string GetMegafonDownloaderBannerUrl();
|
||||
} // namespace ads
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
UNIT_TEST(MegafonCountriesTest_ExistedCountry)
|
||||
{
|
||||
storage::Storage storage;
|
||||
TEST(ads::HasMegafonDownloaderBanner(storage, "Germany_Baden-Wurttemberg_Regierungsbezirk Freiburg"), ());
|
||||
TEST(ads::HasMegafonDownloaderBanner(storage, "Germany_Baden-Wurttemberg_Regierungsbezirk Freiburg", "ru"), ());
|
||||
|
||||
TEST(!ads::HasMegafonDownloaderBanner(storage, "Germany_Baden-Wurttemberg_Regierungsbezirk Freiburg", "en"), ());
|
||||
}
|
||||
|
||||
UNIT_TEST(MegafonCountriesTest_NotExistedCountry)
|
||||
{
|
||||
storage::Storage storage;
|
||||
TEST(!ads::HasMegafonDownloaderBanner(storage, "Russia_Altai Krai"), ());
|
||||
TEST(!ads::HasMegafonDownloaderBanner(storage, "Russia_Altai Krai", "ru"), ());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue