Skip to content

Commit

Permalink
Erroneous data fixed (#4119)
Browse files Browse the repository at this point in the history
  • Loading branch information
4D17Y4 authored Dec 21, 2020
1 parent b1a691a commit a0af174
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import androidx.annotation.NonNull;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.filepicker.DefaultCallback;
import fr.free.nrw.commons.filepicker.FilePicker;
import fr.free.nrw.commons.filepicker.FilePicker.ImageSource;
import fr.free.nrw.commons.filepicker.UploadableFile;
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.nearby.Place;
Expand Down Expand Up @@ -95,6 +97,13 @@ private void initiateCameraUpload(Activity activity) {
*/
public void handleActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
FilePicker.handleActivityResult(requestCode, resultCode, data, activity, new DefaultCallback() {

@Override
public void onCanceled(final ImageSource source, final int type) {
super.onCanceled(source, type);
defaultKvStore.remove(PLACE_OBJECT);
}

@Override
public void onImagePickerError(Exception e, FilePicker.ImageSource source, int type) {
ViewUtil.showShortToast(activity, R.string.error_occurred_in_picking_images);
Expand Down Expand Up @@ -123,6 +132,7 @@ private Intent handleImagesPicked(Context context,
shareIntent.setAction(ACTION_INTERNAL_UPLOADS);
shareIntent.putParcelableArrayListExtra(EXTRA_FILES, new ArrayList<>(imagesFiles));
Place place = defaultKvStore.getJson(PLACE_OBJECT, Place.class);

if (place != null) {
shareIntent.putExtra(PLACE_OBJECT, place);
}
Expand Down

0 comments on commit a0af174

Please sign in to comment.