mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Removed references to the data-client Service interface (#5484)
This commit is contained in:
parent
8222c4a42c
commit
9e970123fd
15 changed files with 38 additions and 61 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
package fr.free.nrw.commons.actions
|
package fr.free.nrw.commons.actions
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
import org.wikipedia.dataclient.Service
|
|
||||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||||
import org.wikipedia.edit.Edit
|
import org.wikipedia.edit.Edit
|
||||||
import org.wikipedia.wikidata.Entities
|
import org.wikipedia.wikidata.Entities
|
||||||
|
|
@ -27,7 +27,7 @@ interface PageEditInterface {
|
||||||
*/
|
*/
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@POST(Service.MW_API_PREFIX + "action=edit")
|
@POST(MW_API_PREFIX + "action=edit")
|
||||||
fun postEdit(
|
fun postEdit(
|
||||||
@Field("title") title: String,
|
@Field("title") title: String,
|
||||||
@Field("summary") summary: String,
|
@Field("summary") summary: String,
|
||||||
|
|
@ -47,7 +47,7 @@ interface PageEditInterface {
|
||||||
*/
|
*/
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@POST(Service.MW_API_PREFIX + "action=edit")
|
@POST(MW_API_PREFIX + "action=edit")
|
||||||
fun postAppendEdit(
|
fun postAppendEdit(
|
||||||
@Field("title") title: String,
|
@Field("title") title: String,
|
||||||
@Field("summary") summary: String,
|
@Field("summary") summary: String,
|
||||||
|
|
@ -66,7 +66,7 @@ interface PageEditInterface {
|
||||||
*/
|
*/
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@POST(Service.MW_API_PREFIX + "action=edit")
|
@POST(MW_API_PREFIX + "action=edit")
|
||||||
fun postPrependEdit(
|
fun postPrependEdit(
|
||||||
@Field("title") title: String,
|
@Field("title") title: String,
|
||||||
@Field("summary") summary: String,
|
@Field("summary") summary: String,
|
||||||
|
|
@ -77,7 +77,7 @@ interface PageEditInterface {
|
||||||
|
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@POST(Service.MW_API_PREFIX + "action=wbsetlabel&format=json&site=commonswiki&formatversion=2")
|
@POST(MW_API_PREFIX + "action=wbsetlabel&format=json&site=commonswiki&formatversion=2")
|
||||||
fun postCaptions(
|
fun postCaptions(
|
||||||
@Field("summary") summary: String,
|
@Field("summary") summary: String,
|
||||||
@Field("title") title: String,
|
@Field("title") title: String,
|
||||||
|
|
@ -91,10 +91,7 @@ interface PageEditInterface {
|
||||||
* @param titles : Name of the file
|
* @param titles : Name of the file
|
||||||
* @return Single<MwQueryResult>
|
* @return Single<MwQueryResult>
|
||||||
*/
|
*/
|
||||||
@GET(
|
@GET(MW_API_PREFIX + "action=query&prop=revisions&rvprop=content|timestamp&rvlimit=1&converttitles=")
|
||||||
Service.MW_API_PREFIX +
|
|
||||||
"action=query&prop=revisions&rvprop=content|timestamp&rvlimit=1&converttitles="
|
|
||||||
)
|
|
||||||
fun getWikiText(
|
fun getWikiText(
|
||||||
@Query("titles") title: String
|
@Query("titles") title: String
|
||||||
): Single<MwQueryResponse?>
|
): Single<MwQueryResponse?>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package fr.free.nrw.commons.actions
|
package fr.free.nrw.commons.actions
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import org.wikipedia.dataclient.Service
|
|
||||||
import retrofit2.http.Field
|
import retrofit2.http.Field
|
||||||
import retrofit2.http.FormUrlEncoded
|
import retrofit2.http.FormUrlEncoded
|
||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
||||||
|
|
@ -14,7 +14,7 @@ import retrofit2.http.POST
|
||||||
*/
|
*/
|
||||||
interface ThanksInterface {
|
interface ThanksInterface {
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(Service.MW_API_PREFIX + "action=thank")
|
@POST(MW_API_PREFIX + "action=thank")
|
||||||
fun thank(
|
fun thank(
|
||||||
@Field("rev") rev: String?,
|
@Field("rev") rev: String?,
|
||||||
@Field("log") log: String?,
|
@Field("log") log: String?,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package fr.free.nrw.commons.auth.csrf
|
package fr.free.nrw.commons.auth.csrf
|
||||||
|
|
||||||
import org.wikipedia.dataclient.Service
|
import fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX
|
||||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
|
|
@ -8,6 +8,6 @@ import retrofit2.http.Headers
|
||||||
|
|
||||||
interface CsrfTokenInterface {
|
interface CsrfTokenInterface {
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@GET(Service.MW_API_PREFIX + "action=query&meta=tokens&type=csrf")
|
@GET(MW_API_PREFIX + "action=query&meta=tokens&type=csrf")
|
||||||
fun getCsrfTokenCall(): Call<MwQueryResponse?>
|
fun getCsrfTokenCall(): Call<MwQueryResponse?>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ package fr.free.nrw.commons.auth.login
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import fr.free.nrw.commons.auth.login.LoginResult.OAuthResult
|
import fr.free.nrw.commons.auth.login.LoginResult.OAuthResult
|
||||||
import fr.free.nrw.commons.auth.login.LoginResult.ResetPasswordResult
|
import fr.free.nrw.commons.auth.login.LoginResult.ResetPasswordResult
|
||||||
|
import fr.free.nrw.commons.wikidata.WikidataConstants.WIKIPEDIA_URL
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import org.wikipedia.dataclient.Service
|
|
||||||
import org.wikipedia.dataclient.ServiceFactory
|
import org.wikipedia.dataclient.ServiceFactory
|
||||||
import org.wikipedia.dataclient.WikiSite
|
import org.wikipedia.dataclient.WikiSite
|
||||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||||
|
|
@ -57,7 +57,7 @@ class LoginClient {
|
||||||
|
|
||||||
loginCall = if (twoFactorCode.isNullOrEmpty() && retypedPassword.isNullOrEmpty()) {
|
loginCall = if (twoFactorCode.isNullOrEmpty() && retypedPassword.isNullOrEmpty()) {
|
||||||
ServiceFactory.get(wiki, LoginInterface::class.java)
|
ServiceFactory.get(wiki, LoginInterface::class.java)
|
||||||
.postLogIn(userName, password, loginToken, userLanguage, Service.WIKIPEDIA_URL)
|
.postLogIn(userName, password, loginToken, userLanguage, WIKIPEDIA_URL)
|
||||||
} else {
|
} else {
|
||||||
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
||||||
userName, password, retypedPassword, twoFactorCode, loginToken, userLanguage, true
|
userName, password, retypedPassword, twoFactorCode, loginToken, userLanguage, true
|
||||||
|
|
@ -115,8 +115,7 @@ class LoginClient {
|
||||||
val loginToken = tokenResponse.body()?.query()?.loginToken()
|
val loginToken = tokenResponse.body()?.query()?.loginToken()
|
||||||
val tempLoginCall = if (twoFactorCode.isNullOrEmpty()) {
|
val tempLoginCall = if (twoFactorCode.isNullOrEmpty()) {
|
||||||
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
||||||
userName, password, loginToken, userLanguage, Service.WIKIPEDIA_URL
|
userName, password, loginToken, userLanguage, WIKIPEDIA_URL)
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
||||||
userName, password, null, twoFactorCode, loginToken, userLanguage, true
|
userName, password, null, twoFactorCode, loginToken, userLanguage, true
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package fr.free.nrw.commons.auth.login
|
package fr.free.nrw.commons.auth.login
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import org.wikipedia.dataclient.Service
|
|
||||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.http.Field
|
import retrofit2.http.Field
|
||||||
|
|
@ -13,12 +13,12 @@ import retrofit2.http.Query
|
||||||
|
|
||||||
interface LoginInterface {
|
interface LoginInterface {
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@GET(Service.MW_API_PREFIX + "action=query&meta=tokens&type=login")
|
@GET(MW_API_PREFIX + "action=query&meta=tokens&type=login")
|
||||||
fun getLoginToken(): Call<MwQueryResponse?>
|
fun getLoginToken(): Call<MwQueryResponse?>
|
||||||
|
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(Service.MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
@POST(MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
||||||
fun postLogIn(
|
fun postLogIn(
|
||||||
@Field("username") user: String?,
|
@Field("username") user: String?,
|
||||||
@Field("password") pass: String?,
|
@Field("password") pass: String?,
|
||||||
|
|
@ -29,7 +29,7 @@ interface LoginInterface {
|
||||||
|
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(Service.MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
@POST(MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
||||||
fun postLogIn(
|
fun postLogIn(
|
||||||
@Field("username") user: String?,
|
@Field("username") user: String?,
|
||||||
@Field("password") pass: String?,
|
@Field("password") pass: String?,
|
||||||
|
|
@ -40,6 +40,6 @@ interface LoginInterface {
|
||||||
@Field("logincontinue") loginContinue: Boolean
|
@Field("logincontinue") loginContinue: Boolean
|
||||||
): Call<LoginResponse?>
|
): Call<LoginResponse?>
|
||||||
|
|
||||||
@GET(Service.MW_API_PREFIX + "action=query&meta=userinfo&list=users&usprop=groups|cancreate")
|
@GET(MW_API_PREFIX + "action=query&meta=userinfo&list=users&usprop=groups|cancreate")
|
||||||
fun getUserInfo(@Query("ususers") userName: String): Observable<MwQueryResponse?>
|
fun getUserInfo(@Query("ususers") userName: String): Observable<MwQueryResponse?>
|
||||||
}
|
}
|
||||||
|
|
@ -166,20 +166,6 @@ public class NetworkingModule {
|
||||||
return GsonUtil.getDefaultGson();
|
return GsonUtil.getDefaultGson();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
@Named("commons-service")
|
|
||||||
public Service provideCommonsService(@Named(NAMED_COMMONS_WIKI_SITE) WikiSite commonsWikiSite) {
|
|
||||||
return ServiceFactory.get(commonsWikiSite);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
@Named("wikidata-service")
|
|
||||||
public Service provideWikidataService(@Named(NAMED_WIKI_DATA_WIKI_SITE) WikiSite wikidataWikiSite) {
|
|
||||||
return ServiceFactory.get(wikidataWikiSite, BuildConfig.WIKIDATA_URL, Service.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public ReviewInterface provideReviewInterface(@Named(NAMED_COMMONS_WIKI_SITE) WikiSite commonsWikiSite) {
|
public ReviewInterface provideReviewInterface(@Named(NAMED_COMMONS_WIKI_SITE) WikiSite commonsWikiSite) {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package fr.free.nrw.commons.media;
|
package fr.free.nrw.commons.media;
|
||||||
|
|
||||||
|
import static fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import org.wikipedia.dataclient.Service;
|
|
||||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse;
|
import org.wikipedia.dataclient.mwapi.MwQueryResponse;
|
||||||
import org.wikipedia.wikidata.Entities;
|
import org.wikipedia.wikidata.Entities;
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
|
@ -43,10 +43,7 @@ public interface MediaDetailInterface {
|
||||||
* @param title file name
|
* @param title file name
|
||||||
* @return Single<MwQueryResponse>
|
* @return Single<MwQueryResponse>
|
||||||
*/
|
*/
|
||||||
@GET(
|
@GET(MW_API_PREFIX + "action=query&prop=revisions&rvprop=content|timestamp&rvlimit=1&converttitles=")
|
||||||
Service.MW_API_PREFIX +
|
|
||||||
"action=query&prop=revisions&rvprop=content|timestamp&rvlimit=1&converttitles="
|
|
||||||
)
|
|
||||||
Single<MwQueryResponse> getWikiText(
|
Single<MwQueryResponse> getWikiText(
|
||||||
@Query("titles") String title
|
@Query("titles") String title
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import retrofit2.http.GET;
|
||||||
import retrofit2.http.Query;
|
import retrofit2.http.Query;
|
||||||
import retrofit2.http.QueryMap;
|
import retrofit2.http.QueryMap;
|
||||||
|
|
||||||
import static org.wikipedia.dataclient.Service.MW_API_PREFIX;
|
import static fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX;
|
||||||
|
|
||||||
public interface UserInterface {
|
public interface UserInterface {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package fr.free.nrw.commons.notification
|
package fr.free.nrw.commons.notification
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
import org.wikipedia.dataclient.Service
|
|
||||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||||
import retrofit2.http.Field
|
import retrofit2.http.Field
|
||||||
import retrofit2.http.FormUrlEncoded
|
import retrofit2.http.FormUrlEncoded
|
||||||
|
|
@ -13,7 +13,7 @@ import retrofit2.http.Query
|
||||||
interface NotificationInterface {
|
interface NotificationInterface {
|
||||||
|
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@GET(Service.MW_API_PREFIX + "action=query&meta=notifications¬format=model¬limit=max")
|
@GET(MW_API_PREFIX + "action=query&meta=notifications¬format=model¬limit=max")
|
||||||
fun getAllNotifications(
|
fun getAllNotifications(
|
||||||
@Query("notwikis") wikiList: String?,
|
@Query("notwikis") wikiList: String?,
|
||||||
@Query("notfilter") filter: String?,
|
@Query("notfilter") filter: String?,
|
||||||
|
|
@ -22,7 +22,7 @@ interface NotificationInterface {
|
||||||
|
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@Headers("Cache-Control: no-cache")
|
@Headers("Cache-Control: no-cache")
|
||||||
@POST(Service.MW_API_PREFIX + "action=echomarkread")
|
@POST(MW_API_PREFIX + "action=echomarkread")
|
||||||
fun markRead(
|
fun markRead(
|
||||||
@Field("token") token: String,
|
@Field("token") token: String,
|
||||||
@Field("list") readList: String?,
|
@Field("list") readList: String?,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package fr.free.nrw.commons.upload;
|
package fr.free.nrw.commons.upload;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import static fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import okhttp3.MultipartBody;
|
import okhttp3.MultipartBody;
|
||||||
|
|
@ -13,8 +14,6 @@ import retrofit2.http.Multipart;
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
import retrofit2.http.Part;
|
import retrofit2.http.Part;
|
||||||
|
|
||||||
import static org.wikipedia.dataclient.Service.MW_API_PREFIX;
|
|
||||||
|
|
||||||
public interface UploadInterface {
|
public interface UploadInterface {
|
||||||
|
|
||||||
@Multipart
|
@Multipart
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package fr.free.nrw.commons.upload;
|
package fr.free.nrw.commons.upload;
|
||||||
|
|
||||||
import static org.wikipedia.dataclient.Service.MW_API_PREFIX;
|
import static fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,7 @@ public class WikidataConstants {
|
||||||
public static final String BOOKMARKS_ITEMS = "bookmarks.items";
|
public static final String BOOKMARKS_ITEMS = "bookmarks.items";
|
||||||
public static final String SELECTED_NEARBY_PLACE = "selected.nearby.place";
|
public static final String SELECTED_NEARBY_PLACE = "selected.nearby.place";
|
||||||
public static final String SELECTED_NEARBY_PLACE_CATEGORY = "selected.nearby.place.category";
|
public static final String SELECTED_NEARBY_PLACE_CATEGORY = "selected.nearby.place.category";
|
||||||
|
|
||||||
|
public static final String MW_API_PREFIX = "w/api.php?format=json&formatversion=2&errorformat=plaintext&";
|
||||||
|
public static final String WIKIPEDIA_URL = "https://wikipedia.org/";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,17 @@ package fr.free.nrw.commons.wikidata;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse;
|
import org.wikipedia.dataclient.mwapi.MwQueryResponse;
|
||||||
|
|
||||||
import fr.free.nrw.commons.wikidata.model.AddEditTagResponse;
|
|
||||||
import fr.free.nrw.commons.wikidata.model.WbCreateClaimResponse;
|
import fr.free.nrw.commons.wikidata.model.WbCreateClaimResponse;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import okhttp3.RequestBody;
|
|
||||||
import retrofit2.http.Field;
|
import retrofit2.http.Field;
|
||||||
import retrofit2.http.FormUrlEncoded;
|
import retrofit2.http.FormUrlEncoded;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
import retrofit2.http.Headers;
|
import retrofit2.http.Headers;
|
||||||
import retrofit2.http.Multipart;
|
|
||||||
import retrofit2.http.POST;
|
import retrofit2.http.POST;
|
||||||
import retrofit2.http.Part;
|
|
||||||
|
|
||||||
import static org.wikipedia.dataclient.Service.MW_API_PREFIX;
|
import static fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX;
|
||||||
|
|
||||||
public interface WikidataInterface {
|
public interface WikidataInterface {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package fr.free.nrw.commons;
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
|
import static fr.free.nrw.commons.wikidata.WikidataConstants.WIKIPEDIA_URL;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.AbstractExecutorService;
|
import java.util.concurrent.AbstractExecutorService;
|
||||||
|
|
@ -13,7 +15,6 @@ import org.junit.Before;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.wikipedia.AppAdapter;
|
import org.wikipedia.AppAdapter;
|
||||||
import org.wikipedia.dataclient.Service;
|
|
||||||
import org.wikipedia.dataclient.WikiSite;
|
import org.wikipedia.dataclient.WikiSite;
|
||||||
import org.wikipedia.json.GsonUtil;
|
import org.wikipedia.json.GsonUtil;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
@ -26,7 +27,7 @@ public abstract class MockWebServerTest {
|
||||||
|
|
||||||
@Before public void setUp() throws Throwable {
|
@Before public void setUp() throws Throwable {
|
||||||
AppAdapter.set(new TestAppAdapter());
|
AppAdapter.set(new TestAppAdapter());
|
||||||
OkHttpClient.Builder builder = AppAdapter.get().getOkHttpClient(new WikiSite(Service.WIKIPEDIA_URL)).newBuilder();
|
OkHttpClient.Builder builder = AppAdapter.get().getOkHttpClient(new WikiSite(WIKIPEDIA_URL)).newBuilder();
|
||||||
okHttpClient = builder.dispatcher(new Dispatcher(new ImmediateExecutorService())).build();
|
okHttpClient = builder.dispatcher(new Dispatcher(new ImmediateExecutorService())).build();
|
||||||
server.setUp();
|
server.setUp();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package fr.free.nrw.commons;
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import fr.free.nrw.commons.wikidata.WikidataConstants;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import org.wikipedia.AppAdapter;
|
import org.wikipedia.AppAdapter;
|
||||||
import org.wikipedia.dataclient.Service;
|
|
||||||
import org.wikipedia.dataclient.SharedPreferenceCookieManager;
|
import org.wikipedia.dataclient.SharedPreferenceCookieManager;
|
||||||
import org.wikipedia.dataclient.WikiSite;
|
import org.wikipedia.dataclient.WikiSite;
|
||||||
import org.wikipedia.dataclient.okhttp.TestStubInterceptor;
|
import org.wikipedia.dataclient.okhttp.TestStubInterceptor;
|
||||||
|
|
@ -13,7 +13,7 @@ public class TestAppAdapter extends AppAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMediaWikiBaseUrl() {
|
public String getMediaWikiBaseUrl() {
|
||||||
return Service.WIKIPEDIA_URL;
|
return WikidataConstants.WIKIPEDIA_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue