Skip to content

Wikidata edit fix #1800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
Timber.d("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
requestCode, resultCode, data);
String wikidataEntityId = directPrefs.getString("WikiDataEntityId", null);
if (requestCode == ContributionController.SELECT_FROM_CAMERA) {
// If coming from camera, pass null as uri. Because camera photos get saved to a
// fixed directory
controller.handleImagePicked(requestCode, null, true, null);
controller.handleImagePicked(requestCode, null, true, wikidataEntityId);
} else {
controller.handleImagePicked(requestCode, data.getData(), true, null);
controller.handleImagePicked(requestCode, data.getData(), true, wikidataEntityId);
}
} else {
Timber.e("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,12 +770,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
Timber.d("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
requestCode, resultCode, data);
String wikidataEntityId = directPrefs.getString("WikiDataEntityId", null);
if (requestCode == ContributionController.SELECT_FROM_CAMERA) {
// If coming from camera, pass null as uri. Because camera photos get saved to a
// fixed directory
controller.handleImagePicked(requestCode, null, true, null);
controller.handleImagePicked(requestCode, null, true, wikidataEntityId);
} else {
controller.handleImagePicked(requestCode, data.getData(), true, null);
controller.handleImagePicked(requestCode, data.getData(), true, wikidataEntityId);
}
} else {
Timber.e("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import fr.free.nrw.commons.di.ApplicationlessInjection;
import timber.log.Timber;

import static fr.free.nrw.commons.wikidata.WikidataConstants.WIKIDATA_ENTITY_ID_PREF;

public class PlaceRenderer extends Renderer<Place> {

@BindView(R.id.tvName) TextView tvName;
Expand Down Expand Up @@ -126,6 +128,7 @@ private void storeSharedPrefs() {
editor.putString("Title", place.getName());
editor.putString("Desc", place.getLongDescription());
editor.putString("Category", place.getCategory());
editor.putString(WIKIDATA_ENTITY_ID_PREF, place.getWikiDataEntityId());
editor.apply();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ public void startUpload(String title, Uri contentProviderUri, Uri mediaUri, Stri
contribution.setTag("mimeType", mimeType);
contribution.setSource(source);

//Calls the next overloaded method
startUpload(contribution, onComplete);

Timber.d("Wikidata entity ID received from Share activity is %s", wikiDataEntityId);
//TODO: Modify this to include coords
Account currentAccount = sessionManager.getCurrentAccount();
Expand All @@ -136,7 +133,8 @@ public void startUpload(String title, Uri contentProviderUri, Uri mediaUri, Stri
contribution.setWikiDataEntityId(wikiDataEntityId);
contribution.setContentProviderUri(contentProviderUri);


//Calls the next overloaded method
startUpload(contribution, onComplete);
}

/**
Expand Down