forked from organicmaps/organicmaps
Merge pull request #2918 from mgsergio/amenity-dne-in-core
[No Not Merge] [Editor] Select note message with enum.
This commit is contained in:
commit
ada49db35c
4 changed files with 31 additions and 11 deletions
|
@ -355,14 +355,16 @@ Java_com_mapswithme_maps_editor_Editor_nativeGetMwmVersion(JNIEnv * env, jclass
|
|||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_editor_Editor_nativeCreateNote(JNIEnv * env, jclass clazz, jdouble lat, jdouble lon, jstring text)
|
||||
{
|
||||
Editor::Instance().CreateNote(ms::LatLon(lat, lon), g_editableMapObject.GetID(), jni::ToNativeString(env, text));
|
||||
Editor::Instance().CreateNote(ms::LatLon(lat, lon), g_editableMapObject.GetID(),
|
||||
osm::Editor::NoteProblemType::General, jni::ToNativeString(env, text));
|
||||
}
|
||||
|
||||
// static void nativePlaceDoesNotExist(double lat, double lon);
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_editor_Editor_nativePlaceDoesNotExist(JNIEnv * env, jclass clazz, jdouble lat, jdouble lon)
|
||||
{
|
||||
Editor::Instance().CreateNote(ms::LatLon(lat, lon), g_editableMapObject.GetID(), osm::Editor::kPlaceDoesNotExistMessage);
|
||||
Editor::Instance().CreateNote(ms::LatLon(lat, lon), g_editableMapObject.GetID(),
|
||||
osm::Editor::NoteProblemType::PlaceDoesNotExist, "");
|
||||
}
|
||||
|
||||
// static boolean nativeIsHouseValid(String houseNumber);
|
||||
|
|
|
@ -930,11 +930,25 @@ bool Editor::CreatePoint(uint32_t type, m2::PointD const & mercator, MwmSet::Mwm
|
|||
return true;
|
||||
}
|
||||
|
||||
void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note)
|
||||
void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid,
|
||||
NoteProblemType const type, string const & note)
|
||||
{
|
||||
auto const version = GetMwmCreationTimeByMwmId(fid.m_mwmId);
|
||||
auto const stringVersion = my::TimestampToString(my::SecondsSinceEpochToTimeT(version));
|
||||
ostringstream sstr(note, ios_base::ate);
|
||||
ostringstream sstr;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case NoteProblemType::PlaceDoesNotExist:
|
||||
sstr << kPlaceDoesNotExistMessage;
|
||||
if (!note.empty())
|
||||
sstr << " User comments: \"" << note << '\"';
|
||||
break;
|
||||
case NoteProblemType::General:
|
||||
sstr << note;
|
||||
break;
|
||||
}
|
||||
|
||||
sstr << " (OSM data version: " << stringVersion << ')';
|
||||
m_notes->CreateNote(latLon, sstr.str());
|
||||
}
|
||||
|
|
|
@ -120,7 +120,14 @@ public:
|
|||
// Predefined messages.
|
||||
static const char * const kPlaceDoesNotExistMessage;
|
||||
|
||||
void CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note);
|
||||
enum class NoteProblemType
|
||||
{
|
||||
General,
|
||||
PlaceDoesNotExist
|
||||
};
|
||||
|
||||
void CreateNote(ms::LatLon const & latLon, FeatureID const & fid,
|
||||
NoteProblemType const type, string const & note);
|
||||
void UploadNotes(string const & key, string const & secret);
|
||||
|
||||
struct Stats
|
||||
|
|
|
@ -245,7 +245,7 @@ void registerCellsForTableView(vector<MWMPlacePageCellType> const & cells, UITab
|
|||
noteInfo[kStatLat] = @(latLon.lat);
|
||||
noteInfo[kStatLon] = @(latLon.lon);
|
||||
[Statistics logEvent:kStatEditorProblemReport withParameters:noteInfo];
|
||||
osm::Editor::Instance().CreateNote(latLon, featureID, self.note.UTF8String);
|
||||
osm::Editor::Instance().CreateNote(latLon, featureID, osm::Editor::NoteProblemType::General ,self.note.UTF8String);
|
||||
}
|
||||
|
||||
switch (f.SaveEditedMapObject(m_mapObject))
|
||||
|
@ -783,17 +783,14 @@ void registerCellsForTableView(vector<MWMPlacePageCellType> const & cells, UITab
|
|||
{
|
||||
auto const & fid = self->m_mapObject.GetID();
|
||||
auto const latLon = self->m_mapObject.GetLatLon();
|
||||
if (additionalMessage.length)
|
||||
{
|
||||
//TODO(Vlad): Pass additional message as second parameter into CreateNote.
|
||||
}
|
||||
string const additional = additionalMessage.length ? additionalMessage.UTF8String : "";
|
||||
|
||||
[Statistics logEvent:kStatEditorProblemReport withParameters:@{
|
||||
kStatEditorMWMName : @(fid.GetMwmName().c_str()),
|
||||
kStatEditorMWMVersion : @(fid.GetMwmVersion()),
|
||||
kStatProblem : @(osm::Editor::kPlaceDoesNotExistMessage),
|
||||
kStatLat : @(latLon.lat), kStatLon : @(latLon.lon)}];
|
||||
osm::Editor::Instance().CreateNote(latLon, fid, osm::Editor::kPlaceDoesNotExistMessage);
|
||||
osm::Editor::Instance().CreateNote(latLon, fid, osm::Editor::NoteProblemType::PlaceDoesNotExist, additional);
|
||||
[self backTap];
|
||||
[self showDropDown];
|
||||
}];
|
||||
|
|
Loading…
Add table
Reference in a new issue