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
|
||||
@Named("commons_mediawiki_url")
|
||||
@Named("wikimedia_api_host")
|
||||
@NonNull
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public HttpUrl provideMwUrl() {
|
||||
return HttpUrl.parse(BuildConfig.COMMONS_URL);
|
||||
public String provideMwApiUrl() {
|
||||
return BuildConfig.WIKIMEDIA_API_HOST;
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ import timber.log.Timber;
|
|||
public class CategoryApi {
|
||||
|
||||
private final OkHttpClient okHttpClient;
|
||||
private final HttpUrl mwUrl;
|
||||
private final String commonsBaseUrl;
|
||||
private final Gson gson;
|
||||
|
||||
@Inject
|
||||
public CategoryApi(OkHttpClient okHttpClient, Gson gson,
|
||||
@Named("commons_mediawiki_url") HttpUrl mwUrl) {
|
||||
@Named("wikimedia_api_host") String commonsBaseUrl) {
|
||||
this.okHttpClient = okHttpClient;
|
||||
this.mwUrl = mwUrl;
|
||||
this.commonsBaseUrl = commonsBaseUrl;
|
||||
this.gson = gson;
|
||||
}
|
||||
|
||||
|
|
@ -77,9 +77,9 @@ public class CategoryApi {
|
|||
* @return URL for API query
|
||||
*/
|
||||
private HttpUrl buildUrl(String coords) {
|
||||
return mwUrl.newBuilder()
|
||||
.addPathSegment("w")
|
||||
.addPathSegment("api.php")
|
||||
return HttpUrl
|
||||
.parse(commonsBaseUrl)
|
||||
.newBuilder()
|
||||
.addQueryParameter("action", "query")
|
||||
.addQueryParameter("prop", "categories|coordinates|pageprops")
|
||||
.addQueryParameter("format", "json")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue