[core] Better check whether showing brand is redundant in subtitle

Previous implementation checked if brand was equal to name, better to check if it's located in name

Signed-off-by: eisa01 <eisa01@gmail.com>
This commit is contained in:
eisa01
2025-08-24 21:53:00 +02:00
committed by Konstantin Pastbin
parent fbc844b19e
commit 7088489814
2 changed files with 5 additions and 3 deletions

View File

@@ -165,7 +165,7 @@ std::string Info::FormatSubtitle(bool withTypes, bool withMainType) const
auto const locBrand = platform::GetLocalizedBrandName(std::string(brand));
// Do not duplicate for commonly used titles like McDonald's, Starbucks, etc.
if (locBrand != m_uiTitle && locBrand != m_uiSecondaryTitle)
if (m_uiTitle.find(locBrand) == std::string::npos && m_uiSecondaryTitle.find(locBrand) == std::string::npos)
append(locBrand);
}

View File

@@ -250,10 +250,12 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d
std::string brand{ft.GetMetadata(feature::Metadata::FMD_BRAND)};
if (!brand.empty())
{
brand = platform::GetLocalizedBrandName(brand);
if (name == brand)
brand.clear();
if (name.find(brand) != std::string::npos)
brand.clear();
}
/// @todo Avoid temporary string when OpeningHours (boost::spirit) will allow string_view.
std::string const openHours(ft.GetMetadata(feature::Metadata::FMD_OPEN_HOURS));