[partners] Fixed local ads stats for hidden campaigns

This commit is contained in:
r.kuznetsov 2019-05-27 10:40:30 +03:00 committed by Aleksandr Zatsepin
parent c0719b452d
commit d5914cbce6
6 changed files with 20 additions and 8 deletions

View file

@ -197,7 +197,7 @@ public class Framework
@NonNull MapObject mapObject)
{
LocalAdInfo info = mapObject.getLocalAdInfo();
if (info == null || !info.isCustomer())
if (info == null || (!info.isCustomer() && !info.isHidden()))
return;
Location location = LocationHelper.INSTANCE.getLastKnownLocation();

View file

@ -11,13 +11,14 @@ import java.lang.annotation.RetentionPolicy;
public class LocalAdInfo implements Parcelable
{
@Retention(RetentionPolicy.SOURCE)
@IntDef({ STATUS_NOT_AVAILABLE, STATUS_CANDIDATE, STATUS_CUSTOMER})
@IntDef({ STATUS_NOT_AVAILABLE, STATUS_CANDIDATE, STATUS_CUSTOMER, STATUS_HIDDEN})
public @interface Status {}
private static final int STATUS_NOT_AVAILABLE = 0;
private static final int STATUS_CANDIDATE = 1;
private static final int STATUS_CUSTOMER = 2;
private static final int STATUS_HIDDEN = 3;
@Status
private final int mStatus;
@ -40,6 +41,11 @@ public class LocalAdInfo implements Parcelable
return mStatus == STATUS_CUSTOMER;
}
public boolean isHidden()
{
return mStatus == STATUS_HIDDEN;
}
@Nullable
public String getUrl()
{

View file

@ -1439,7 +1439,7 @@ public class PlacePageView extends NestedScrollView
{
LocalAdInfo localAdInfo = mapObject.getLocalAdInfo();
boolean isLocalAdAvailable = localAdInfo != null && localAdInfo.isAvailable();
if (isLocalAdAvailable && !TextUtils.isEmpty(localAdInfo.getUrl()))
if (isLocalAdAvailable && !TextUtils.isEmpty(localAdInfo.getUrl()) && !localAdInfo.isHidden())
{
mTvLocalAd.setText(localAdInfo.isCustomer() ? R.string.view_campaign_button
: R.string.create_campaign_button);

View file

@ -321,6 +321,9 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
m_metainfoRows.push_back(MetainfoRows::LocalAdsCustomer);
[self logLocalAdsEvent:local_ads::EventType::OpenInfo];
break;
case place_page::LocalAdsStatus::Hidden:
[self logLocalAdsEvent:local_ads::EventType::OpenInfo];
break;
}
}
@ -734,7 +737,8 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
- (NSString *)localAdsURL { return @(m_info.GetLocalAdsUrl().c_str()); }
- (void)logLocalAdsEvent:(local_ads::EventType)type
{
if (m_info.GetLocalAdsStatus() != place_page::LocalAdsStatus::Customer)
auto const status = m_info.GetLocalAdsStatus();
if (status != place_page::LocalAdsStatus::Customer && status != place_page::LocalAdsStatus::Hidden)
return;
auto const featureID = m_info.GetID();
auto const & mwmInfo = featureID.m_mwmId.GetInfo();

View file

@ -985,9 +985,10 @@ void Framework::FillInfoFromFeatureType(FeatureType & ft, place_page::Info & inf
if (m_localAdsManager.IsSupportedType(info.GetTypes()))
{
info.SetLocalAdsUrl(m_localAdsManager.GetCompanyUrl(ft.GetID()));
auto const status = m_localAdsManager.HasVisualization(ft.GetID())
? place_page::LocalAdsStatus::Customer
: place_page::LocalAdsStatus::Candidate;
auto status = m_localAdsManager.HasAds(ft.GetID()) ? place_page::LocalAdsStatus::Customer
: place_page::LocalAdsStatus::Candidate;
if (status == place_page::LocalAdsStatus::Customer && !m_localAdsManager.HasVisualization(ft.GetID()))
status = place_page::LocalAdsStatus::Hidden;
info.SetLocalAdsStatus(status);
}
else

View file

@ -53,7 +53,8 @@ enum class LocalAdsStatus
{
NotAvailable,
Candidate,
Customer
Customer,
Hidden
};
enum class LocalsStatus