mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Include tracking template on all uploads
This commit is contained in:
parent
1986b2455c
commit
af73954cd1
2 changed files with 13 additions and 0 deletions
|
|
@ -12,6 +12,8 @@ import javax.xml.transform.*;
|
|||
|
||||
import android.accounts.*;
|
||||
import android.app.Application;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
|
|
@ -48,6 +50,7 @@ import org.wikimedia.commons.data.DBOpenHelper;
|
|||
public class CommonsApplication extends Application {
|
||||
|
||||
private DBOpenHelper dbOpenHelper;
|
||||
public static String APPLICATION_VERSION; // Populated in onCreate. Race conditions theoretically possible, but practically not?
|
||||
|
||||
private MWApi api;
|
||||
private Account currentAccount = null; // Unlike a savings account...
|
||||
|
|
@ -91,6 +94,14 @@ public class CommonsApplication extends Application {
|
|||
.discCache(new TotalSizeLimitedDiscCache(StorageUtils.getCacheDirectory(this), 128 * 1024 * 1024))
|
||||
.imageDownloader(new ContentUriImageDownloader()).build();
|
||||
ImageLoader.getInstance().init(imageLoaderConfiguration);
|
||||
|
||||
try {
|
||||
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
APPLICATION_VERSION = pInfo.versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// LET US WIN THE AWARD FOR DUMBEST CHECKED EXCEPTION EVER!
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public MWApi getApi() {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.net.*;
|
||||
import android.os.RemoteException;
|
||||
import android.text.TextUtils;
|
||||
import org.wikimedia.commons.CommonsApplication;
|
||||
import org.wikimedia.commons.Media;
|
||||
|
||||
public class Contribution extends Media {
|
||||
|
|
@ -84,6 +85,7 @@ public class Contribution extends Media {
|
|||
.append("== {{int:license-header}} ==\n")
|
||||
.append("{{self|cc-by-sa-3.0}}")
|
||||
;
|
||||
buffer.append("\n{{Uploaded from Mobile|platform=Android|version=").append(CommonsApplication.APPLICATION_VERSION).append("}}");
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue