Skip to content

Commit 7a995ed

Browse files
author
maskara
committed
Add javadocs
1 parent fbd8321 commit 7a995ed

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

app/src/main/java/fr/free/nrw/commons/mwapi/ApacheHttpClientMediaWikiApi.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,12 @@ public String wikidatCreateClaim(String entityId, String property, String snakty
425425
return null;
426426
}
427427

428+
/**
429+
* Adds the wikimedia-commons-app tag to the edits made on wikidata
430+
* @param revisionId
431+
* @return
432+
* @throws IOException
433+
*/
428434
@Nullable
429435
@Override
430436
public boolean addWikidataEditTag(String revisionId) throws IOException {

app/src/main/java/fr/free/nrw/commons/wikidata/WikidataEditService.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
import io.reactivex.schedulers.Schedulers;
1919
import timber.log.Timber;
2020

21+
/**
22+
* This class is meant to handle the Wikidata edits made through the app
23+
* It will talk with MediaWikiApi to make necessary API calls, log the edits and fire listeners
24+
* on successful edits
25+
*/
2126
@Singleton
2227
public class WikidataEditService {
2328

@@ -37,6 +42,11 @@ public WikidataEditService(Context context,
3742
this.directPrefs = directPrefs;
3843
}
3944

45+
/**
46+
* Create a P18 claim and log the edit with custom tag
47+
* @param wikidataEntityId
48+
* @param fileName
49+
*/
4050
public void createClaimWithLogging(String wikidataEntityId, String fileName) {
4151
editWikidataProperty(wikidataEntityId, fileName);
4252
}
@@ -75,6 +85,10 @@ private void handleClaimResult(String wikidataEntityId, String revisionId) {
7585
}
7686
}
7787

88+
/**
89+
* Log the Wikidata edit by adding Wikimedia Commons App tag to the edit
90+
* @param revisionId
91+
*/
7892
@SuppressLint("CheckResult")
7993
private void logEdit(String revisionId) {
8094
Observable.fromCallable(() -> mediaWikiApi.addWikidataEditTag(revisionId))
@@ -91,6 +105,9 @@ private void logEdit(String revisionId) {
91105
});
92106
}
93107

108+
/**
109+
* Show a success toast when the edit is made successfully
110+
*/
94111
private void showSuccessToast() {
95112
String title = directPrefs.getString("Title", "");
96113
String successStringTemplate = context.getString(R.string.successful_wikidata_edit);

0 commit comments

Comments
 (0)