[ios][editor] Removed duplicated floors and zip code cells

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2023-02-18 13:31:15 +01:00 committed by Alexander Borsuk
parent 9b0359d2bb
commit e300de6766

View file

@ -37,8 +37,8 @@ NSString * const kCategoryEditorSegue = @"Editor2CategoryEditorSegue";
NSString * const kUDEditorPersonalInfoWarninWasShown = @"PersonalInfoWarningAlertWasShown";
CGFloat const kDefaultHeaderHeight = 28.;
CGFloat const kDefaultFooterHeight = 32.;
CGFloat constexpr kDefaultHeaderHeight = 28.;
CGFloat constexpr kDefaultFooterHeight = 32.;
typedef NS_ENUM(NSUInteger, MWMEditorSection) {
MWMEditorSectionCategory,
@ -57,8 +57,7 @@ std::vector<MWMEditorCellID> const kSectionAddressCellTypes {
std::vector<MWMEditorCellID> const kSectionNoteCellTypes { MWMEditorCellTypeNote };
std::vector<MWMEditorCellID> const kSectionButtonCellTypes { MWMEditorCellTypeReportButton };
using MWMEditorCellTypeClassMap = std::map<MWMEditorCellID, Class>;
MWMEditorCellTypeClassMap const kCellType2Class {
std::map<MWMEditorCellID, Class> const kCellType2Class {
{MWMEditorCellTypeCategory, [MWMEditorCategoryCell class]},
{MWMEditorCellTypeAdditionalName, [MWMEditorAdditionalNameTableViewCell class]},
{MWMEditorCellTypeAddAdditionalName, [MWMEditorAddAdditionalNameTableViewCell class]},
@ -327,10 +326,15 @@ void registerCellsForTableView(std::vector<MWMEditorCellID> const & cells, UITab
registerCellsForTableView(kSectionCategoryCellTypes, self.tableView);
BOOL const isNameEditable = m_mapObject.IsNameEditable();
BOOL const isAddressEditable = m_mapObject.IsAddressEditable();
BOOL const areEditablePropertiesEmpty = m_mapObject.GetEditableProperties().empty();
auto editableProperties = m_mapObject.GetEditableProperties();
// Remove fields that are already displayed in the Address section.
editableProperties.erase(std::remove_if(editableProperties.begin(), editableProperties.end(), [](osm::MapObject::MetadataID mid)
{
return mid == MetadataID::FMD_POSTCODE || mid == MetadataID::FMD_BUILDING_LEVELS;
}), editableProperties.end());
BOOL const isCreating = self.isCreating;
BOOL const isThereNotes =
!isCreating && areEditablePropertiesEmpty && !isAddressEditable && !isNameEditable;
!isCreating && editableProperties.empty() && !isAddressEditable && !isNameEditable;
if (isNameEditable)
{
@ -355,16 +359,12 @@ void registerCellsForTableView(std::vector<MWMEditorCellID> const & cells, UITab
registerCellsForTableView(kSectionAddressCellTypes, self.tableView);
}
if (!areEditablePropertiesEmpty)
if (!editableProperties.empty())
{
auto const cells = m_mapObject.GetEditableProperties();
if (!cells.empty())
{
m_sections.push_back(MWMEditorSectionDetails);
auto & v = m_cells[MWMEditorSectionDetails];
v.assign(cells.begin(), cells.end());
registerCellsForTableView(v, self.tableView);
}
m_sections.push_back(MWMEditorSectionDetails);
auto & v = m_cells[MWMEditorSectionDetails];
v.assign(editableProperties.begin(), editableProperties.end());
registerCellsForTableView(v, self.tableView);
}
if (isThereNotes)