forked from organicmaps/organicmaps
Disable old data editing.
This commit is contained in:
parent
ccd5ee0bd8
commit
70828a529b
5 changed files with 22 additions and 10 deletions
|
@ -592,12 +592,11 @@ vector<uint32_t> Editor::GetFeaturesByStatus(MwmSet::MwmId const & mwmId, Featur
|
|||
|
||||
EditableProperties Editor::GetEditableProperties(FeatureType const & feature) const
|
||||
{
|
||||
// Disable editor for old data.
|
||||
if (!version::IsSingleMwm(feature.GetID().m_mwmId.GetInfo()->m_version.GetVersion()))
|
||||
return {};
|
||||
ASSERT(version::IsSingleMwm(feature.GetID().m_mwmId.GetInfo()->m_version.GetVersion()),
|
||||
("Edit mode should be available only on new datas"));
|
||||
|
||||
if (GetFeatureStatus(feature.GetID()) == FeatureStatus::Obsolete)
|
||||
return {};
|
||||
ASSERT(GetFeatureStatus(feature.GetID()) != FeatureStatus::Obsolete,
|
||||
("Edit mode should not be available on obsolete features"));
|
||||
|
||||
// TODO(mgsergio): Check if feature is in the area where editing is disabled in the config.
|
||||
auto editableProperties = GetEditablePropertiesForTypes(feature::TypesHolder(feature));
|
||||
|
|
|
@ -178,7 +178,7 @@ void initFieldsMap()
|
|||
- (NSString *)getCellValue:(MWMPlacePageCellType)cellType
|
||||
{
|
||||
auto const s = MapsAppDelegate.theApp.mapViewController.controlsManager.navigationState;
|
||||
BOOL const editOrAddAreAvailable = version::IsSingleMwm(GetFramework().Storage().GetCurrentDataVersion()) && s == MWMNavigationDashboardStateHidden && m_info.IsEditable();
|
||||
BOOL const editOrAddAreAvailable = s == MWMNavigationDashboardStateHidden && m_info.IsEditable();
|
||||
switch (cellType)
|
||||
{
|
||||
case MWMPlacePageCellTypeName:
|
||||
|
@ -340,7 +340,7 @@ void initFieldsMap()
|
|||
Bookmark * bookmark = static_cast<Bookmark *>(guard.m_controller.GetUserMarkForEdit(self.bac.second));
|
||||
if (!bookmark)
|
||||
return;
|
||||
|
||||
|
||||
if (self.bookmarkColor)
|
||||
bookmark->SetType(self.bookmarkColor.UTF8String);
|
||||
|
||||
|
@ -354,7 +354,7 @@ void initFieldsMap()
|
|||
if (self.bookmarkTitle)
|
||||
bookmark->SetName(self.bookmarkTitle.UTF8String);
|
||||
}
|
||||
|
||||
|
||||
category->SaveToKMLFile();
|
||||
}
|
||||
|
||||
|
|
|
@ -753,6 +753,8 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
|
|||
|
||||
info.m_isEditable = featureStatus != osm::Editor::FeatureStatus::Obsolete &&
|
||||
!info.IsSponsoredHotel();
|
||||
info.m_isDataEditable = version::IsSingleMwm(ft.GetID().m_mwmId.GetInfo()->m_version.GetVersion());
|
||||
|
||||
info.m_localizedWifiString = m_stringsBundle.GetString("wifi");
|
||||
info.m_localizedRatingString = m_stringsBundle.GetString("place_page_booking_rating");
|
||||
}
|
||||
|
|
|
@ -16,9 +16,17 @@ bool Info::IsFeature() const { return m_featureID.IsValid(); }
|
|||
bool Info::IsBookmark() const { return m_bac != MakeEmptyBookmarkAndCategory(); }
|
||||
bool Info::IsMyPosition() const { return m_isMyPosition; }
|
||||
bool Info::HasApiUrl() const { return !m_apiUrl.empty(); }
|
||||
bool Info::IsEditable() const { return m_isEditable; }
|
||||
bool Info::IsEditable() const { return m_isEditable && m_isDataEditable; }
|
||||
bool Info::IsDataEditable() const { return m_isDataEditable; }
|
||||
bool Info::HasWifi() const { return GetInternet() == osm::Internet::Wlan; }
|
||||
bool Info::ShouldShowAddPlace() const { return !IsSponsoredHotel() && (!IsFeature() || (!IsPointType() && !IsBuilding())); }
|
||||
|
||||
bool Info::ShouldShowAddPlace() const
|
||||
{
|
||||
return !IsSponsoredHotel() &&
|
||||
(!IsFeature() || (!IsPointType() && !IsBuilding())) &&
|
||||
m_isDataEditable;
|
||||
}
|
||||
|
||||
bool Info::IsSponsoredHotel() const { return m_isSponsoredHotel; }
|
||||
|
||||
string Info::FormatNewBookmarkName() const
|
||||
|
|
|
@ -34,6 +34,8 @@ public:
|
|||
bool HasApiUrl() const;
|
||||
/// @returns true if Edit Place button should be displayed.
|
||||
bool IsEditable() const;
|
||||
/// @returns true if PlacePage was opened on a single mwm (see version::IsSingleMwm).
|
||||
bool IsDataEditable() const;
|
||||
|
||||
/// TODO: Support all possible Internet types in UI. @See MapObject::GetInternet().
|
||||
bool HasWifi() const;
|
||||
|
@ -90,6 +92,7 @@ public:
|
|||
|
||||
bool m_isMyPosition = false;
|
||||
bool m_isEditable = false;
|
||||
bool m_isDataEditable = false;
|
||||
|
||||
// TODO(AlexZ): Temporary solution. It's better to use a wifi icon in UI instead of text.
|
||||
string m_localizedWifiString;
|
||||
|
|
Loading…
Add table
Reference in a new issue