forked from organicmaps/organicmaps
[editor] Correctly send version information in changesets.
This commit is contained in:
parent
1429aa49af
commit
43bdc8ccb8
5 changed files with 18 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "std/bind.hpp"
|
||||
#include "std/sstream.hpp"
|
||||
#include "std/target_os.hpp"
|
||||
|
||||
#include <QtGui/QCloseEvent>
|
||||
|
||||
|
@ -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}});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue