Fixes #4229 - App Crashes while trying to nominate an item for deletion, When User is not logged in (#4237)

* Fixes the crash while nominating an item for deletion.

* removed unnecessary code

Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
Pratham Pahariya 2021-02-19 07:18:39 +05:30 committed by GitHub
parent 850d9411a5
commit b8cdc5a537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,6 +61,7 @@ import fr.free.nrw.commons.delete.DeleteHelper;
import fr.free.nrw.commons.delete.ReasonBuilder; import fr.free.nrw.commons.delete.ReasonBuilder;
import fr.free.nrw.commons.explore.depictions.WikidataItemDetailsActivity; import fr.free.nrw.commons.explore.depictions.WikidataItemDetailsActivity;
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment; import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.nearby.Label; import fr.free.nrw.commons.nearby.Label;
import fr.free.nrw.commons.ui.widget.HtmlTextView; import fr.free.nrw.commons.ui.widget.HtmlTextView;
import fr.free.nrw.commons.utils.ViewUtilWrapper; import fr.free.nrw.commons.utils.ViewUtilWrapper;
@ -74,6 +75,7 @@ import java.util.Locale;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.wikipedia.util.DateUtil; import org.wikipedia.util.DateUtil;
import timber.log.Timber; import timber.log.Timber;
@ -117,6 +119,9 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
ViewUtilWrapper viewUtil; ViewUtilWrapper viewUtil;
@Inject @Inject
CategoryClient categoryClient; CategoryClient categoryClient;
@Inject
@Named("default_preferences")
JsonKvStore applicationKvStore;
private int initialListTop = 0; private int initialListTop = 0;
@ -258,6 +263,10 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
authorLayout.setVisibility(GONE); authorLayout.setVisibility(GONE);
} }
if(applicationKvStore.getBoolean("login_skipped")){
delete.setVisibility(GONE);
}
return view; return view;
} }