[ios] PP title fix

This commit is contained in:
Igor Khmurets 2014-07-01 00:53:50 +03:00 committed by Alex Zolotarev
parent 461292281d
commit 5f7b5ff89a
3 changed files with 11 additions and 10 deletions

View file

@ -710,19 +710,12 @@ typedef NS_ENUM(NSUInteger, CellRow)
}
else
{
_title = [self nonEmptyTitle:[self addressInfo].GetPinName()];
_title = [[self nonEmptyTitle:[self addressInfo].GetPinName()] capitalizedStringWithLocale:[NSLocale currentLocale]];
}
NSString * droppedPinTitle = NSLocalizedString(@"dropped_pin", nil);
if (![_title length])
{
if ([_title isEqualToString:droppedPinTitle])
self.temporaryTitle = droppedPinTitle;
_title = [[self types] capitalizedString];
}
else if ([_title isEqualToString:droppedPinTitle])
{
self.temporaryTitle = droppedPinTitle;
}
}
return _title;
}

View file

@ -168,14 +168,21 @@ void AddressInfo::SetPinName(string const & name)
m_name = name;
}
bool AddressInfo::IsEmptyName() const { return m_name.empty() && m_house.empty(); }
string AddressInfo::GetPinName() const
{
return m_name.empty() ? m_house : m_name;
if (IsEmptyName() && !m_types.empty())
return m_types[0];
else
return m_name.empty() ? m_house : m_name;
}
string AddressInfo::GetPinType() const
{
char const * type = GetBestType();
if (IsEmptyName())
return "";
return (type ? type : "");
}

View file

@ -163,6 +163,7 @@ struct AddressInfo
string FormatTypes() const; // clothes shop
string FormatNameAndAddress() const; // Caroline, 7 vulica Frunze, Belarus
char const * GetBestType() const;
bool IsEmptyName() const;
void Clear();
};