mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Use generated version name from BuildConfig
This commit is contained in:
		
							parent
							
								
									0d582100b3
								
							
						
					
					
						commit
						0e3bd3c74a
					
				
					 5 changed files with 7 additions and 16 deletions
				
			
		|  | @ -30,7 +30,7 @@ public class AboutActivity extends BaseActivity { | |||
|         ButterKnife.bind(this); | ||||
| 
 | ||||
|         uploadsToText.setText(CommonsApplication.EVENTLOG_WIKI); | ||||
|         versionText.setText(CommonsApplication.APPLICATION_VERSION); | ||||
|         versionText.setText(BuildConfig.VERSION_NAME); | ||||
| 
 | ||||
|         // We can't use formatted strings directly because it breaks with | ||||
|         // our localization tools. Grab an HTML string and turn it into | ||||
|  |  | |||
|  | @ -5,7 +5,6 @@ import android.accounts.AccountManager; | |||
| import android.accounts.AuthenticatorException; | ||||
| import android.accounts.OperationCanceledException; | ||||
| import android.app.Application; | ||||
| import android.content.pm.PackageInfo; | ||||
| import android.content.pm.PackageManager; | ||||
| import android.graphics.Bitmap; | ||||
| import android.os.Build; | ||||
|  | @ -52,8 +51,6 @@ import fr.free.nrw.commons.caching.CacheController; | |||
| ) | ||||
| public class CommonsApplication extends Application { | ||||
| 
 | ||||
|     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... | ||||
|     public static final String API_URL = "https://commons.wikimedia.org/w/api.php"; | ||||
|  | @ -84,7 +81,7 @@ public class CommonsApplication extends Application { | |||
|         final SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory(); | ||||
|         schemeRegistry.register(new Scheme("https", sslSocketFactory, 443)); | ||||
|         ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); | ||||
|         params.setParameter(CoreProtocolPNames.USER_AGENT, "Commons/" + APPLICATION_VERSION + " (https://mediawiki.org/wiki/Apps/Commons) Android/" + Build.VERSION.RELEASE); | ||||
|         params.setParameter(CoreProtocolPNames.USER_AGENT, "Commons/" + BuildConfig.VERSION_NAME + " (https://mediawiki.org/wiki/Apps/Commons) Android/" + Build.VERSION.RELEASE); | ||||
|         return new DefaultHttpClient(cm, params); | ||||
|     } | ||||
| 
 | ||||
|  | @ -105,14 +102,6 @@ public class CommonsApplication extends Application { | |||
|                 .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); | ||||
|         } | ||||
| 
 | ||||
|         // Initialize EventLogging | ||||
|         EventLog.setApp(this); | ||||
| 
 | ||||
|  |  | |||
|  | @ -90,7 +90,7 @@ public class EventLog { | |||
|                 fullData.put("wiki", CommonsApplication.EVENTLOG_WIKI); | ||||
|                 data.put("device", DEVICE); | ||||
|                 data.put("platform", "Android/" + Build.VERSION.RELEASE); | ||||
|                 data.put("appversion", "Android/" + CommonsApplication.APPLICATION_VERSION); | ||||
|                 data.put("appversion", "Android/" + BuildConfig.VERSION_NAME); | ||||
|                 fullData.put("event", data); | ||||
|                 return new URL(CommonsApplication.EVENTLOG_URL + "?" + Utils.urlEncode(fullData.toString()) + ";"); | ||||
|             } catch (MalformedURLException e) { | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ import java.text.SimpleDateFormat; | |||
| import java.util.Date; | ||||
| import java.util.Locale; | ||||
| 
 | ||||
| import fr.free.nrw.commons.BuildConfig; | ||||
| import fr.free.nrw.commons.CommonsApplication; | ||||
| import fr.free.nrw.commons.EventLog; | ||||
| import fr.free.nrw.commons.Media; | ||||
|  | @ -154,7 +155,7 @@ public class Contribution extends Media { | |||
| 
 | ||||
|         buffer.append("== {{int:license-header}} ==\n") | ||||
|                 .append(Utils.licenseTemplateFor(getLicense())).append("\n\n") | ||||
|             .append("{{Uploaded from Mobile|platform=Android|version=").append(CommonsApplication.APPLICATION_VERSION).append("}}\n") | ||||
|             .append("{{Uploaded from Mobile|platform=Android|version=").append(BuildConfig.VERSION_NAME).append("}}\n") | ||||
|             .append(getTrackingTemplates()); | ||||
|         return buffer.toString(); | ||||
|     } | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ import android.widget.Toast; | |||
| import butterknife.BindView; | ||||
| import butterknife.ButterKnife; | ||||
| import fr.free.nrw.commons.AboutActivity; | ||||
| import fr.free.nrw.commons.BuildConfig; | ||||
| import fr.free.nrw.commons.CommonsApplication; | ||||
| import fr.free.nrw.commons.R; | ||||
| import fr.free.nrw.commons.SettingsActivity; | ||||
|  | @ -136,7 +137,7 @@ public class ContributionsListFragment extends Fragment { | |||
|                 Intent feedbackIntent = new Intent(Intent.ACTION_SEND); | ||||
|                 feedbackIntent.setType("message/rfc822"); | ||||
|                 feedbackIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { CommonsApplication.FEEDBACK_EMAIL }); | ||||
|                 feedbackIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT, CommonsApplication.APPLICATION_VERSION)); | ||||
|                 feedbackIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(CommonsApplication.FEEDBACK_EMAIL_SUBJECT, BuildConfig.VERSION_NAME)); | ||||
|                 try { | ||||
|                     startActivity(feedbackIntent); | ||||
|                 } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 veyndan
						veyndan