forked from organicmaps/organicmaps
[android] Fixed show banner redundant event
This commit is contained in:
parent
de6432bef0
commit
353685701f
1 changed files with 12 additions and 6 deletions
|
@ -106,7 +106,7 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
{
|
||||
updateStateInternal(shouldAutoDownload);
|
||||
|
||||
if (mPromoBanner == null || mCurrentCountry == null)
|
||||
if (mPromoBanner == null || !hasMapDownloading(mCurrentCountry))
|
||||
return;
|
||||
|
||||
Statistics.ParameterBuilder builder =
|
||||
|
@ -116,6 +116,16 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
Statistics.INSTANCE.trackEvent(Statistics.EventName.DOWNLOADER_BANNER_SHOW, builder);
|
||||
}
|
||||
|
||||
private static boolean hasMapDownloading(@Nullable CountryItem country)
|
||||
{
|
||||
if (country == null) return false;
|
||||
|
||||
boolean enqueued = country.status == CountryItem.STATUS_ENQUEUED;
|
||||
boolean progress = country.status == CountryItem.STATUS_PROGRESS;
|
||||
boolean applying = country.status == CountryItem.STATUS_APPLYING;
|
||||
return enqueued || progress || applying;
|
||||
}
|
||||
|
||||
private void updateProgressState(boolean shouldAutoDownload)
|
||||
{
|
||||
updateStateInternal(shouldAutoDownload);
|
||||
|
@ -293,11 +303,7 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
|
||||
mPromoBanner = Framework.nativeGetDownloaderPromoBanner(mCurrentCountry.id);
|
||||
boolean isPromoFound = mPromoBanner != null;
|
||||
|
||||
boolean enqueued = mCurrentCountry.status == CountryItem.STATUS_ENQUEUED;
|
||||
boolean progress = mCurrentCountry.status == CountryItem.STATUS_PROGRESS;
|
||||
boolean applying = mCurrentCountry.status == CountryItem.STATUS_APPLYING;
|
||||
boolean isDownloading = enqueued || progress || applying;
|
||||
boolean isDownloading = hasMapDownloading(mCurrentCountry);
|
||||
|
||||
if (!isDownloading || !isPromoFound)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue