Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Magidovich <mgsergio@mapswithme.com>2016-06-22 14:21:56 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-06-24 16:02:09 +0300
commitc988ebe1438018c57157d942c14b2e9262795307 (patch)
tree74fceda97f9b1bbe92fe865e294bd34ababce486 /android
parente5ef0f94de2fe8d1787b04ea38329fa0471be38f (diff)
Lazy profile rank updates.
Diffstat (limited to 'android')
-rw-r--r--android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp6
-rw-r--r--android/src/com/mapswithme/maps/editor/OsmOAuth.java2
-rw-r--r--android/src/com/mapswithme/maps/editor/ProfileFragment.java2
3 files changed, 6 insertions, 4 deletions
diff --git a/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp b/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp
index 4d7b253a05..dd91eccb88 100644
--- a/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp
+++ b/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp
@@ -121,7 +121,7 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeGetOsmUsername(JNIEnv * env, jcla
}
JNIEXPORT void JNICALL
-Java_com_mapswithme_maps_editor_OsmOAuth_nativeUpdateOsmUserStats(JNIEnv * env, jclass clazz, jstring jUsername)
+Java_com_mapswithme_maps_editor_OsmOAuth_nativeUpdateOsmUserStats(JNIEnv * env, jclass clazz, jstring jUsername, jboolean forceUpdate)
{
static jclass const statsClazz = jni::GetGlobalClassRef(env, "com/mapswithme/maps/editor/data/UserStats");
static jmethodID const statsCtor = jni::GetConstructorID(env, statsClazz, "(IILjava/lang/String;J)V");
@@ -130,7 +130,9 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeUpdateOsmUserStats(JNIEnv * env,
static jmethodID const listenerId = jni::GetStaticMethodID(env, osmAuthClazz, "onUserStatsUpdated", "(Lcom/mapswithme/maps/editor/data/UserStats;)V");
string const username = jni::ToNativeString(env, jUsername);
- g_framework->NativeFramework()->UpdateUserStats(username, editor::UserStatsLoader::UpdatePolicy::Force, [username]()
+ auto const policy = forceUpdate ? editor::UserStatsLoader::UpdatePolicy::Force
+ : editor::UserStatsLoader::UpdatePolicy::Lazy;
+ g_framework->NativeFramework()->UpdateUserStats(username, policy, [username]()
{
editor::UserStats const & userStats = g_framework->NativeFramework()->GetUserStats(username);
if (!userStats.IsValid())
diff --git a/android/src/com/mapswithme/maps/editor/OsmOAuth.java b/android/src/com/mapswithme/maps/editor/OsmOAuth.java
index bb5a9d4ef8..1c84eaec12 100644
--- a/android/src/com/mapswithme/maps/editor/OsmOAuth.java
+++ b/android/src/com/mapswithme/maps/editor/OsmOAuth.java
@@ -153,5 +153,5 @@ public final class OsmOAuth
@Nullable
public static native String nativeGetOsmUsername(String token, String secret);
- public static native void nativeUpdateOsmUserStats(String username);
+ public static native void nativeUpdateOsmUserStats(String username, boolean forceUpdate);
}
diff --git a/android/src/com/mapswithme/maps/editor/ProfileFragment.java b/android/src/com/mapswithme/maps/editor/ProfileFragment.java
index 94388423c7..a107f91044 100644
--- a/android/src/com/mapswithme/maps/editor/ProfileFragment.java
+++ b/android/src/com/mapswithme/maps/editor/ProfileFragment.java
@@ -37,7 +37,7 @@ public class ProfileFragment extends AuthFragment implements View.OnClickListene
initViews(view);
refreshViews();
OsmOAuth.setUserStatsListener(this);
- OsmOAuth.nativeUpdateOsmUserStats(OsmOAuth.getUsername());
+ OsmOAuth.nativeUpdateOsmUserStats(OsmOAuth.getUsername(), false /*forceUpdate*/);
}
private void initViews(View view)