|
26 | 26 | import javax.inject.Named; |
27 | 27 |
|
28 | 28 | import butterknife.ButterKnife; |
| 29 | +import fr.free.nrw.commons.BuildConfig; |
29 | 30 | import fr.free.nrw.commons.HandlerService; |
30 | 31 | import fr.free.nrw.commons.Media; |
31 | 32 | import fr.free.nrw.commons.R; |
@@ -139,6 +140,12 @@ protected void onCreate(Bundle savedInstanceState) { |
139 | 140 | requestAuthToken(); |
140 | 141 | initDrawer(); |
141 | 142 | setTitle(getString(R.string.title_activity_contributions)); |
| 143 | + |
| 144 | + if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){ |
| 145 | + Timber.d("setUploadCount()"); |
| 146 | + setUploadCount(); |
| 147 | + } |
| 148 | + |
142 | 149 | } |
143 | 150 |
|
144 | 151 | @Override |
@@ -265,11 +272,26 @@ public int getTotalMediaCount() { |
265 | 272 | } |
266 | 273 |
|
267 | 274 | @SuppressWarnings("ConstantConditions") |
268 | | - public void setUploadCount(int uploadCount) { |
| 275 | + private void setUploadCount() { |
| 276 | + compositeDisposable.add(mediaWikiApi |
| 277 | + .getUploadCount(sessionManager.getCurrentAccount().name) |
| 278 | + .subscribeOn(Schedulers.io()) |
| 279 | + .observeOn(AndroidSchedulers.mainThread()) |
| 280 | + .subscribe( |
| 281 | + uploadCount -> getSupportActionBar().setSubtitle(getResources() |
| 282 | + .getQuantityString(R.plurals.contributions_subtitle, |
| 283 | + uploadCount, uploadCount)), |
| 284 | + t -> Timber.e(t, "Fetching upload count failed") |
| 285 | + )); |
| 286 | + } |
| 287 | + |
| 288 | + public void betaSetUploadCount(int betaUploadCount){ |
| 289 | + Timber.d("" + betaUploadCount); |
269 | 290 | getSupportActionBar().setSubtitle(getResources() |
270 | | - .getQuantityString(R.plurals.contributions_subtitle, uploadCount, uploadCount)); |
| 291 | + .getQuantityString(R.plurals.contributions_subtitle, betaUploadCount, betaUploadCount)); |
271 | 292 | } |
272 | 293 |
|
| 294 | + |
273 | 295 | @Override |
274 | 296 | public void notifyDatasetChanged() { |
275 | 297 | // Do nothing for now |
|
0 commit comments