diff --git a/android/jni/com/mapswithme/maps/editor/Editor.cpp b/android/jni/com/mapswithme/maps/editor/Editor.cpp index 1d02723dfb..526489d7fb 100644 --- a/android/jni/com/mapswithme/maps/editor/Editor.cpp +++ b/android/jni/com/mapswithme/maps/editor/Editor.cpp @@ -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); diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 47962ea4d7..237293d974 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -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()); } diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index 2499cc3a53..28c5295ea8 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -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 diff --git a/iphone/Maps/Classes/Editor/MWMEditorViewController.mm b/iphone/Maps/Classes/Editor/MWMEditorViewController.mm index 20fe8b68f0..f21bab9cb5 100644 --- a/iphone/Maps/Classes/Editor/MWMEditorViewController.mm +++ b/iphone/Maps/Classes/Editor/MWMEditorViewController.mm @@ -245,7 +245,7 @@ void registerCellsForTableView(vector 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 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]; }];