diff --git a/android/jni/com/mapswithme/maps/editor/Editor.cpp b/android/jni/com/mapswithme/maps/editor/Editor.cpp index b994731ced..1d02723dfb 100644 --- a/android/jni/com/mapswithme/maps/editor/Editor.cpp +++ b/android/jni/com/mapswithme/maps/editor/Editor.cpp @@ -355,7 +355,14 @@ 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), jni::ToNativeString(env, text)); + Editor::Instance().CreateNote(ms::LatLon(lat, lon), g_editableMapObject.GetID(), 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); } // static boolean nativeIsHouseValid(String houseNumber); diff --git a/android/src/com/mapswithme/maps/editor/Editor.java b/android/src/com/mapswithme/maps/editor/Editor.java index 0ef7cf97db..d66171b6b2 100644 --- a/android/src/com/mapswithme/maps/editor/Editor.java +++ b/android/src/com/mapswithme/maps/editor/Editor.java @@ -141,6 +141,7 @@ public final class Editor public static native long nativeGetMwmVersion(); public static native void nativeCreateNote(double lat, double lon, String text); + public static native void nativePlaceDoesNotExist(double lat, double lon); public static native boolean nativeIsHouseValid(String houseNumber); } diff --git a/android/src/com/mapswithme/maps/editor/ReportFragment.java b/android/src/com/mapswithme/maps/editor/ReportFragment.java index 09c7cd5a7b..571e6de454 100644 --- a/android/src/com/mapswithme/maps/editor/ReportFragment.java +++ b/android/src/com/mapswithme/maps/editor/ReportFragment.java @@ -71,6 +71,12 @@ public class ReportFragment extends BaseMwmToolbarFragment implements View.OnCli mToolbarController.onUpClick(); } + private void sendNotExist() + { + Editor.nativePlaceDoesNotExist(mLat, mLon); + mToolbarController.onUpClick(); + } + @Override public void onClick(View v) { @@ -79,7 +85,7 @@ public class ReportFragment extends BaseMwmToolbarFragment implements View.OnCli case R.id.problem_not_exist: // case R.id.problem_closed_repair: // case R.id.problem_duplicated_place: - send((String)v.getTag()); + sendNotExist(); break; case R.id.problem_other: diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 24267125d4..47962ea4d7 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -930,9 +930,13 @@ bool Editor::CreatePoint(uint32_t type, m2::PointD const & mercator, MwmSet::Mwm return true; } -void Editor::CreateNote(ms::LatLon const & latLon, string const & note) +void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note) { - m_notes->CreateNote(latLon, note); + auto const version = GetMwmCreationTimeByMwmId(fid.m_mwmId); + auto const stringVersion = my::TimestampToString(my::SecondsSinceEpochToTimeT(version)); + ostringstream sstr(note, ios_base::ate); + sstr << " (OSM data version: " << stringVersion << ')'; + m_notes->CreateNote(latLon, sstr.str()); } void Editor::UploadNotes(string const & key, string const & secret) @@ -951,4 +955,6 @@ string DebugPrint(Editor::FeatureStatus fs) case Editor::FeatureStatus::Created: return "Created"; }; } + +const char * const Editor::kPlaceDoesNotExistMessage = "The place has gone or never existed. This is an auto-generated note from MAPS.ME application: a user reports a POI that is visible on a map (which can be outdated), but cannot be found on the ground."; } // namespace osm diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index a049d2ff65..2499cc3a53 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -114,9 +114,13 @@ public: // Editor should silently ignore all types in config which are unknown to him. NewFeatureCategories GetNewFeatureCategories() const; - bool CreatePoint(uint32_t type, m2::PointD const & mercator, MwmSet::MwmId const & id, EditableMapObject & outFeature); + bool CreatePoint(uint32_t type, m2::PointD const & mercator, + MwmSet::MwmId const & id, EditableMapObject & outFeature); - void CreateNote(ms::LatLon const & latLon, string const & note); + // Predefined messages. + static const char * const kPlaceDoesNotExistMessage; + + void CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note); void UploadNotes(string const & key, string const & secret); struct Stats diff --git a/iphone/Maps/Classes/MWMReportBaseController.mm b/iphone/Maps/Classes/MWMReportBaseController.mm index 8c74c2bff3..9dfb59e403 100644 --- a/iphone/Maps/Classes/MWMReportBaseController.mm +++ b/iphone/Maps/Classes/MWMReportBaseController.mm @@ -30,7 +30,7 @@ NSAssert(!note.empty(), @"String can't be empty!"); auto const & featureID = MapsAppDelegate.theApp.mapViewController.controlsManager.placePageEntity.info.GetID(); auto const latLon = ToLatLon(m_point); - osm::Editor::Instance().CreateNote(latLon, note); + osm::Editor::Instance().CreateNote(latLon, featureID, note); [Statistics logEvent:kStatEditorProblemReport withParameters:@{kStatEditorMWMName : @(featureID.GetMwmName().c_str()), kStatEditorMWMVersion : @(featureID.GetMwmVersion()), kStatProblem : @(note.c_str()), diff --git a/iphone/Maps/Classes/MWMReportProblemController.mm b/iphone/Maps/Classes/MWMReportProblemController.mm index e39b6219b6..32cd7086f6 100644 --- a/iphone/Maps/Classes/MWMReportProblemController.mm +++ b/iphone/Maps/Classes/MWMReportProblemController.mm @@ -1,10 +1,7 @@ #import "MWMReportProblemController.h" #import "SelectableCell.h" -namespace -{ - string const kAmenityDoesntExist = "The amenity has gone or never existed. This is an auto-generated note from MAPS.ME application: a user reports a POI that is visible on a map (which can be a month old), but cannot be found on the ground."; -} +#include "indexer/osm_editor.hpp" @interface MWMReportProblemController () @@ -32,7 +29,7 @@ namespace { if (!self.isCellSelected) return; - [self sendNote:kAmenityDoesntExist]; + [self sendNote:osm::Editor::kPlaceDoesNotExistMessage]; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender