fixes - #1984 -Upload count does not get updated right away post successful upload

->implements the Callback method to update total number of media uploaded
This commit is contained in:
Prince kushwaha 2021-02-08 17:36:16 +05:30 committed by GitHub
parent 3ad16d120f
commit 8384ad03dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -38,6 +38,7 @@ import fr.free.nrw.commons.auth.SessionManager;
import fr.free.nrw.commons.notification.Notification;
import fr.free.nrw.commons.notification.NotificationController;
import fr.free.nrw.commons.theme.BaseActivity;
import fr.free.nrw.commons.upload.UploadService.ServiceCallback;
import io.reactivex.disposables.Disposable;
import java.util.List;
@ -84,7 +85,7 @@ public class ContributionsFragment
OnBackStackChangedListener,
LocationUpdateListener,
MediaDetailProvider,
ICampaignsView, ContributionsContract.View, Callback {
ICampaignsView, ContributionsContract.View, Callback , ServiceCallback {
@Inject @Named("default_preferences") JsonKvStore store;
@Inject NearbyController nearbyController;
@Inject OkHttpJsonApiClient okHttpJsonApiClient;
@ -135,6 +136,7 @@ public class ContributionsFragment
public void onServiceConnected(ComponentName componentName, IBinder binder) {
uploadService = (UploadService) ((UploadService.UploadServiceLocalBinder) binder)
.getService();
uploadService.setServiceCallback(ContributionsFragment.this);
isUploadServiceConnected = true;
}
@ -520,6 +522,7 @@ public class ContributionsFragment
if (isUploadServiceConnected) {
if (getActivity() != null) {
uploadService.setServiceCallback(null);
getActivity().unbindService(uploadServiceConnection);
isUploadServiceConnected = false;
}
@ -666,5 +669,10 @@ public class ContributionsFragment
public MediaDetailPagerFragment getMediaDetailPagerFragment() {
return mediaDetailPagerFragment;
}
@Override
public void updateUploadCount() {
setUploadCount();
}
}