mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Use WIKIMEDIA_API_HOST for CategoryApi (#2821)
This commit is contained in:
parent
40e8182c9b
commit
b17c9a75a7
2 changed files with 9 additions and 9 deletions
|
|
@ -83,11 +83,11 @@ public class NetworkingModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Named("commons_mediawiki_url")
|
@Named("wikimedia_api_host")
|
||||||
@NonNull
|
@NonNull
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
public HttpUrl provideMwUrl() {
|
public String provideMwApiUrl() {
|
||||||
return HttpUrl.parse(BuildConfig.COMMONS_URL);
|
return BuildConfig.WIKIMEDIA_API_HOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,14 @@ import timber.log.Timber;
|
||||||
public class CategoryApi {
|
public class CategoryApi {
|
||||||
|
|
||||||
private final OkHttpClient okHttpClient;
|
private final OkHttpClient okHttpClient;
|
||||||
private final HttpUrl mwUrl;
|
private final String commonsBaseUrl;
|
||||||
private final Gson gson;
|
private final Gson gson;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CategoryApi(OkHttpClient okHttpClient, Gson gson,
|
public CategoryApi(OkHttpClient okHttpClient, Gson gson,
|
||||||
@Named("commons_mediawiki_url") HttpUrl mwUrl) {
|
@Named("wikimedia_api_host") String commonsBaseUrl) {
|
||||||
this.okHttpClient = okHttpClient;
|
this.okHttpClient = okHttpClient;
|
||||||
this.mwUrl = mwUrl;
|
this.commonsBaseUrl = commonsBaseUrl;
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,9 +77,9 @@ public class CategoryApi {
|
||||||
* @return URL for API query
|
* @return URL for API query
|
||||||
*/
|
*/
|
||||||
private HttpUrl buildUrl(String coords) {
|
private HttpUrl buildUrl(String coords) {
|
||||||
return mwUrl.newBuilder()
|
return HttpUrl
|
||||||
.addPathSegment("w")
|
.parse(commonsBaseUrl)
|
||||||
.addPathSegment("api.php")
|
.newBuilder()
|
||||||
.addQueryParameter("action", "query")
|
.addQueryParameter("action", "query")
|
||||||
.addQueryParameter("prop", "categories|coordinates|pageprops")
|
.addQueryParameter("prop", "categories|coordinates|pageprops")
|
||||||
.addQueryParameter("format", "json")
|
.addQueryParameter("format", "json")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue