@@ -50,7 +50,7 @@ public class WikidataEditService {
50
50
* @param fileName name of the file we will upload
51
51
* @param p18Value pic attribute of Wikidata item
52
52
*/
53
- public void createClaimWithLogging (String wikidataEntityId , String fileName , @ NonNull String p18Value ) {
53
+ public void createClaimWithLogging (String wikidataEntityId , String wikiItemName , String fileName , @ NonNull String p18Value ) {
54
54
if (wikidataEntityId == null ) {
55
55
Timber .d ("Skipping creation of claim as Wikidata entity ID is null" );
56
56
return ;
@@ -71,7 +71,7 @@ public void createClaimWithLogging(String wikidataEntityId, String fileName, @No
71
71
return ;
72
72
}
73
73
74
- editWikidataProperty (wikidataEntityId , fileName );
74
+ editWikidataProperty (wikidataEntityId , wikiItemName , fileName );
75
75
}
76
76
77
77
/**
@@ -82,7 +82,7 @@ public void createClaimWithLogging(String wikidataEntityId, String fileName, @No
82
82
* @param fileName
83
83
*/
84
84
@ SuppressLint ("CheckResult" )
85
- private void editWikidataProperty (String wikidataEntityId , String fileName ) {
85
+ private void editWikidataProperty (String wikidataEntityId , String wikiItemName , String fileName ) {
86
86
Timber .d ("Upload successful with wiki data entity id as %s" , wikidataEntityId );
87
87
Timber .d ("Attempting to edit Wikidata property %s" , wikidataEntityId );
88
88
@@ -98,18 +98,18 @@ private void editWikidataProperty(String wikidataEntityId, String fileName) {
98
98
})
99
99
.subscribeOn (Schedulers .io ())
100
100
.observeOn (AndroidSchedulers .mainThread ())
101
- .subscribe (revisionId -> handleClaimResult (wikidataEntityId , String .valueOf (revisionId )), throwable -> {
101
+ .subscribe (revisionId -> handleClaimResult (wikidataEntityId , wikiItemName , String .valueOf (revisionId )), throwable -> {
102
102
Timber .e (throwable , "Error occurred while making claim" );
103
103
ViewUtil .showLongToast (context , context .getString (R .string .wikidata_edit_failure ));
104
104
});
105
105
}
106
106
107
- private void handleClaimResult (String wikidataEntityId , String revisionId ) {
107
+ private void handleClaimResult (String wikidataEntityId , String wikiItemName , String revisionId ) {
108
108
if (revisionId != null ) {
109
109
if (wikidataEditListener != null ) {
110
110
wikidataEditListener .onSuccessfulWikidataEdit ();
111
111
}
112
- showSuccessToast ();
112
+ showSuccessToast (wikiItemName );
113
113
} else {
114
114
Timber .d ("Unable to make wiki data edit for entity %s" , wikidataEntityId );
115
115
ViewUtil .showLongToast (context , context .getString (R .string .wikidata_edit_failure ));
@@ -119,10 +119,9 @@ private void handleClaimResult(String wikidataEntityId, String revisionId) {
119
119
/**
120
120
* Show a success toast when the edit is made successfully
121
121
*/
122
- private void showSuccessToast () {
123
- String title = directKvStore .getString ("Title" , "" );
122
+ private void showSuccessToast (String wikiItemName ) {
124
123
String successStringTemplate = context .getString (R .string .successful_wikidata_edit );
125
- String successMessage = String .format (Locale .getDefault (), successStringTemplate , title );
124
+ String successMessage = String .format (Locale .getDefault (), successStringTemplate , wikiItemName );
126
125
ViewUtil .showLongToast (context , successMessage );
127
126
}
128
127
0 commit comments