forked from organicmaps/organicmaps
Added RuTaxi banner checker
This commit is contained in:
parent
4279c198d3
commit
afadfe7f83
4 changed files with 27 additions and 0 deletions
|
@ -1749,6 +1749,12 @@ Java_com_mapswithme_maps_Framework_nativeHasMegafonDownloaderBanner(JNIEnv * env
|
|||
languages::GetCurrentNorm()));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeHasRuTaxiCategoryBanner(JNIEnv * env, jclass)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->HasRuTaxiCategoryBanner());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeGetMegafonDownloaderBannerUrl(JNIEnv * env, jclass)
|
||||
{
|
||||
|
|
|
@ -475,6 +475,8 @@ public class Framework
|
|||
@NonNull
|
||||
public static native String nativeGetMegafonDownloaderBannerUrl();
|
||||
|
||||
public static native boolean nativeHasRuTaxiCategoryBanner();
|
||||
|
||||
public static native void nativeMakeCrash();
|
||||
|
||||
public static native void nativeValidatePurchase(@NonNull String serverId,
|
||||
|
|
|
@ -3379,6 +3379,24 @@ void Framework::DisableAdProvider(ads::Banner::Type const type, ads::Banner::Pla
|
|||
m_adsEngine.get()->DisableAdProvider(type, place);
|
||||
}
|
||||
|
||||
bool Framework::HasRuTaxiCategoryBanner()
|
||||
{
|
||||
auto const & purchase = GetPurchase();
|
||||
if (purchase && purchase->IsSubscriptionActive(SubscriptionType::RemoveAds))
|
||||
return false;
|
||||
|
||||
auto const position = GetCurrentPosition();
|
||||
if (!position)
|
||||
return false;
|
||||
|
||||
auto const taxiEngine = GetTaxiEngine(platform::GetCurrentNetworkPolicy());
|
||||
if (!taxiEngine)
|
||||
return false;
|
||||
|
||||
auto const providers = taxiEngine->GetProvidersAtPos(MercatorBounds::ToLatLon(position.get()));
|
||||
return std::find(providers.begin(), providers.end(), taxi::Provider::Rutaxi) != providers.end();
|
||||
}
|
||||
|
||||
void Framework::RunUITask(function<void()> fn)
|
||||
{
|
||||
GetPlatform().RunTask(Platform::Thread::Gui, move(fn));
|
||||
|
|
|
@ -355,6 +355,7 @@ public:
|
|||
|
||||
ads::Engine const & GetAdsEngine() const;
|
||||
void DisableAdProvider(ads::Banner::Type const type, ads::Banner::Place const place);
|
||||
bool HasRuTaxiCategoryBanner();
|
||||
|
||||
public:
|
||||
// SearchAPI::Delegate overrides:
|
||||
|
|
Loading…
Add table
Reference in a new issue