mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Fixed 4728 : Suggest User to turn on camera location (#4735)
* Dialog can't be dismissed * Dialog can't be dismissed * Suggest users to turn on camera location * Added safety pattern * Title removed * Changed constant
This commit is contained in:
parent
d8bfd1ffc5
commit
8a2c30120d
3 changed files with 27 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package fr.free.nrw.commons.upload;
|
||||
|
||||
import static fr.free.nrw.commons.contributions.ContributionController.ACTION_INTERNAL_UPLOADS;
|
||||
import static fr.free.nrw.commons.upload.UploadPresenter.COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES;
|
||||
import static fr.free.nrw.commons.wikidata.WikidataConstants.PLACE_OBJECT;
|
||||
|
||||
import android.Manifest;
|
||||
|
|
@ -469,7 +470,18 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
|
|||
vpUpload.setCurrentItem(index + 1, false);
|
||||
fragments.get(index + 1).onBecameVisible();
|
||||
} else {
|
||||
presenter.handleSubmit();
|
||||
if(defaultKvStore.getInt(COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES, 0) >= 10){
|
||||
DialogUtil.showAlertDialog(this,
|
||||
"",
|
||||
getString(R.string.location_message),
|
||||
getString(R.string.ok),
|
||||
() -> {
|
||||
defaultKvStore.putInt(COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES, 0);
|
||||
presenter.handleSubmit();
|
||||
}, false);
|
||||
} else {
|
||||
presenter.handleSubmit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ public class UploadPresenter implements UploadContract.UserActionListener {
|
|||
private UploadContract.View view = DUMMY;
|
||||
|
||||
private CompositeDisposable compositeDisposable;
|
||||
public static final String COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES
|
||||
= "number_of_consecutive_uploads_without_coordinates";
|
||||
|
||||
|
||||
@Inject
|
||||
UploadPresenter(UploadRepository uploadRepository,
|
||||
|
|
@ -69,6 +72,16 @@ public class UploadPresenter implements UploadContract.UserActionListener {
|
|||
|
||||
@Override
|
||||
public void onNext(Contribution contribution) {
|
||||
if(contribution.getDecimalCoords() == null){
|
||||
final int recentCount
|
||||
= defaultKvStore.getInt(
|
||||
COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES, 0);
|
||||
defaultKvStore.putInt(
|
||||
COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES, recentCount + 1);
|
||||
} else {
|
||||
defaultKvStore.putInt(
|
||||
COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES, 0);
|
||||
}
|
||||
repository.prepareMedia(contribution);
|
||||
contribution.setState(Contribution.STATE_QUEUED);
|
||||
repository.saveContribution(contribution);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue