forked from organicmaps/organicmaps
Set "Place doesn't exist" text in core when making a note.
This commit is contained in:
parent
956647dc11
commit
6ccd95c7cf
5 changed files with 18 additions and 11 deletions
|
@ -121,7 +121,7 @@ void ServerApi06::CloseChangeSet(uint64_t changesetId) const
|
|||
uint64_t ServerApi06::CreateNote(ms::LatLon const & ll, string const & message) const
|
||||
{
|
||||
CHECK(!message.empty(), ("Note content should not be empty."));
|
||||
string const params = "?lat=" + strings::to_string_dac(ll.lat, 7) + "&lon=" + strings::to_string_dac(ll.lon, 7) + "&text=" + UrlEncode(message + " #mapsme");
|
||||
string const params = "?lat=" + strings::to_string_dac(ll.lat, 7) + "&lon=" + strings::to_string_dac(ll.lon, 7) + "&text=" + UrlEncode(message);
|
||||
OsmOAuth::Response const response = m_auth.Request("/notes" + params, "POST");
|
||||
if (response.first != OsmOAuth::HTTP::OK)
|
||||
MYTHROW(ErrorAddingNote, ("Could not post a new note:", response));
|
||||
|
|
|
@ -915,9 +915,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 << " #mapsme: OSM snapshot version: " << stringVersion;
|
||||
m_notes->CreateNote(latLon, sstr.str());
|
||||
}
|
||||
|
||||
void Editor::UploadNotes(string const & key, string const & secret)
|
||||
|
@ -936,4 +940,6 @@ string DebugPrint(Editor::FeatureStatus fs)
|
|||
case Editor::FeatureStatus::Created: return "Created";
|
||||
};
|
||||
}
|
||||
|
||||
char const * 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()),
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue