mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 22:03:55 +01:00
Fix version number for alpha builds (#2325)
This commit is contained in:
parent
ddc83f1f22
commit
de9611821b
11 changed files with 51 additions and 16 deletions
|
|
@ -52,6 +52,7 @@ import fr.free.nrw.commons.category.QueryContinue;
|
|||
import fr.free.nrw.commons.kvstore.BasicKvStore;
|
||||
import fr.free.nrw.commons.notification.Notification;
|
||||
import fr.free.nrw.commons.notification.NotificationUtils;
|
||||
import fr.free.nrw.commons.utils.ConfigUtils;
|
||||
import fr.free.nrw.commons.utils.DateUtils;
|
||||
import fr.free.nrw.commons.utils.ViewUtil;
|
||||
import in.yuvi.http.fluent.Http;
|
||||
|
|
@ -115,7 +116,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
@Override
|
||||
@NonNull
|
||||
public String getUserAgent() {
|
||||
return "Commons/" + BuildConfig.VERSION_NAME + " (https://mediawiki.org/wiki/Apps/Commons) Android/" + Build.VERSION.RELEASE;
|
||||
return "Commons/" + ConfigUtils.getVersionNameWithSha(context) + " (https://mediawiki.org/wiki/Apps/Commons) Android/" + Build.VERSION.RELEASE;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.mwapi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import fr.free.nrw.commons.Utils;
|
||||
|
|
@ -16,14 +17,14 @@ public class EventLog {
|
|||
}
|
||||
}
|
||||
|
||||
private static LogBuilder schema(String schema, long revision, MediaWikiApi mwApi, BasicKvStore prefs) {
|
||||
return new LogBuilder(schema, revision, mwApi, prefs);
|
||||
private static LogBuilder schema(String schema, long revision, MediaWikiApi mwApi, BasicKvStore prefs, Context context) {
|
||||
return new LogBuilder(schema, revision, mwApi, prefs, context);
|
||||
}
|
||||
|
||||
public static LogBuilder schema(Object[] scid, MediaWikiApi mwApi, BasicKvStore prefs) {
|
||||
public static LogBuilder schema(Object[] scid, MediaWikiApi mwApi, BasicKvStore prefs, Context context) {
|
||||
if (scid.length != 2) {
|
||||
throw new IllegalArgumentException("Needs an object array with schema as first param and revision as second");
|
||||
}
|
||||
return schema((String) scid[0], (Long) scid[1], mwApi, prefs);
|
||||
return schema((String) scid[0], (Long) scid[1], mwApi, prefs, context);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.mwapi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
|
||||
|
|
@ -13,6 +14,7 @@ import fr.free.nrw.commons.BuildConfig;
|
|||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.kvstore.BasicKvStore;
|
||||
import fr.free.nrw.commons.settings.Prefs;
|
||||
import fr.free.nrw.commons.utils.ConfigUtils;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public class LogBuilder {
|
||||
|
|
@ -21,6 +23,7 @@ public class LogBuilder {
|
|||
private final long rev;
|
||||
private final String schema;
|
||||
private final BasicKvStore prefs;
|
||||
private final Context context;
|
||||
|
||||
/**
|
||||
* Main constructor of LogBuilder
|
||||
|
|
@ -30,12 +33,17 @@ public class LogBuilder {
|
|||
* @param mwApi Wiki media API instance
|
||||
* @param prefs Instance of SharedPreferences
|
||||
*/
|
||||
LogBuilder(String schema, long revision, MediaWikiApi mwApi, BasicKvStore prefs) {
|
||||
LogBuilder(String schema,
|
||||
long revision,
|
||||
MediaWikiApi mwApi,
|
||||
BasicKvStore prefs,
|
||||
Context context) {
|
||||
this.prefs = prefs;
|
||||
this.data = new JSONObject();
|
||||
this.schema = schema;
|
||||
this.rev = revision;
|
||||
this.mwApi = mwApi;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -65,7 +73,7 @@ public class LogBuilder {
|
|||
fullData.put("wiki", BuildConfig.EVENTLOG_WIKI);
|
||||
data.put("device", EventLog.DEVICE);
|
||||
data.put("platform", "Android/" + Build.VERSION.RELEASE);
|
||||
data.put("appversion", "Android/" + BuildConfig.VERSION_NAME);
|
||||
data.put("appversion", "Android/" + ConfigUtils.getVersionNameWithSha(context));
|
||||
fullData.put("event", data);
|
||||
return new URL(BuildConfig.EVENTLOG_URL + "?" + Utils.urlEncode(fullData.toString()) + ";");
|
||||
} catch (MalformedURLException | JSONException e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue