diff --git a/android/jni/com/mapswithme/maps/editor/Editor.cpp b/android/jni/com/mapswithme/maps/editor/Editor.cpp index f87763c007..c54fafc4ea 100644 --- a/android/jni/com/mapswithme/maps/editor/Editor.cpp +++ b/android/jni/com/mapswithme/maps/editor/Editor.cpp @@ -11,6 +11,7 @@ #include "std/algorithm.hpp" #include "std/set.hpp" +#include "std/target_os.hpp" #include "std/vector.hpp" namespace @@ -219,11 +220,13 @@ Java_com_mapswithme_maps_editor_Editor_nativeHasSomethingToUpload(JNIEnv * env, } JNIEXPORT void JNICALL -Java_com_mapswithme_maps_editor_Editor_nativeUploadChanges(JNIEnv * env, jclass clazz, jstring token, jstring secret) +Java_com_mapswithme_maps_editor_Editor_nativeUploadChanges(JNIEnv * env, jclass clazz, jstring token, jstring secret, + jstring appVersion, jstring appId) { - Editor::Instance().UploadChanges(jni::ToNativeString(env, token), - jni::ToNativeString(env, secret), - {{"version", "TODO android"}}, nullptr); + // TODO: Upload changes from background service to avoid interruptions. + Editor::Instance().UploadChanges(jni::ToNativeString(env, token), jni::ToNativeString(env, secret), + {{"created_by", "MAPS.ME " OMIM_OS_NAME " " + jni::ToNativeString(env, appVersion)}, + {"bundle_id", jni::ToNativeString(env, appId)}}, nullptr); } JNIEXPORT jlongArray JNICALL diff --git a/android/src/com/mapswithme/maps/editor/Editor.java b/android/src/com/mapswithme/maps/editor/Editor.java index e331ddc03e..6997750766 100644 --- a/android/src/com/mapswithme/maps/editor/Editor.java +++ b/android/src/com/mapswithme/maps/editor/Editor.java @@ -4,6 +4,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Size; import android.support.annotation.WorkerThread; +import com.mapswithme.maps.BuildConfig; import com.mapswithme.maps.Framework; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.background.AppBackgroundTracker; @@ -45,7 +46,8 @@ public final class Editor public static void uploadChanges() { if (nativeHasSomethingToUpload() && OsmOAuth.isAuthorized()) - nativeUploadChanges(OsmOAuth.getAuthToken(), OsmOAuth.getAuthSecret()); + nativeUploadChanges(OsmOAuth.getAuthToken(), OsmOAuth.getAuthSecret(), BuildConfig.VERSION_NAME, + BuildConfig.APPLICATION_ID); } public static native boolean nativeIsFeatureEditable(); @@ -87,7 +89,7 @@ public final class Editor public static native boolean nativeHasSomethingToUpload(); @WorkerThread - private static native void nativeUploadChanges(String token, String secret); + private static native void nativeUploadChanges(String token, String secret, String appVersion, String appId); /** * @return array [total edits count, uploaded edits count, last upload timestamp] diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index b57d80b402..f2ac85af0a 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -539,7 +539,6 @@ void Editor::UploadChanges(string const & key, string const & secret, TChangeset auto const stats = GetStats(); tags["total_edits"] = strings::to_string(stats.m_edits.size()); tags["uploaded_edits"] = strings::to_string(stats.m_uploadedCount); - tags["created_by"] = "MAPS.ME " OMIM_OS_NAME; } // TODO(AlexZ): features access should be synchronized. auto const upload = [this](string key, string secret, TChangesetTags tags, TFinishUploadCallback callBack) diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 33f8b2964d..464e02bf06 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -32,6 +32,7 @@ #include "platform/settings.hpp" #include "platform/platform.hpp" #include "platform/preferred_languages.hpp" +#include "std/target_os.hpp" #include "storage/storage_defines.hpp" // If you have a "missing header error" here, then please run configure.sh script in the root repo folder. @@ -423,11 +424,10 @@ using namespace osm_auth_ios; // Starts async edits uploading process. + (void)uploadLocalMapEdits:(void (^)(osm::Editor::UploadResult))finishCallback with:(osm::TKeySecret const &)keySecret { - osm::Editor::Instance().UploadChanges(keySecret.first, keySecret.second, {{"version", AppInfo.sharedInfo.bundleVersion.UTF8String}}, - [finishCallback](osm::Editor::UploadResult result) - { - finishCallback(result); - }); + auto const lambda = [finishCallback](osm::Editor::UploadResult result) { finishCallback(result); }; + osm::Editor::Instance().UploadChanges(keySecret.first, keySecret.second, + {{"created_by", string("MAPS.ME " OMIM_OS_NAME " ") + AppInfo.sharedInfo.bundleVersion.UTF8String}, + {"bundle_id", NSBundle.mainBundle.bundleIdentifier.UTF8String}}, lambda); } - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 5749469074..2701a85239 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -13,6 +13,7 @@ #include "std/bind.hpp" #include "std/sstream.hpp" +#include "std/target_os.hpp" #include @@ -502,7 +503,7 @@ void MainWindow::OnUploadEditsMenuItem() { auto & editor = osm::Editor::Instance(); if (editor.HaveSomethingToUpload()) - editor.UploadChanges(key, secret, {}); + editor.UploadChanges(key, secret, {{"created_by", "MAPS.ME " OMIM_OS_NAME}}); } }