Remove the data-client app adapter implementation (#5499)

* logErrorsInsteadOfCrashing only ever returned false, so remove it and simplify logger

* Removed unused getMediaWikiBaseUrl()

* Removed getDesiredLeadImageDp() from commons app adapter, since it's unused

* Inlined the isLoggedIn() method of the app adapter

* Inline the app adapter username/password

* Removed the unused getRestbaseUriFormat() from the commons app adapter

* Remove references to the data-client SharedPreferenceCookieManager

* Manage our own OkHttpClient and remove the AppAdapter implementation
This commit is contained in:
Paul Hawke 2024-01-30 19:21:43 -06:00 committed by GitHub
parent ab9e57f5be
commit 8db0b54929
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 422 additions and 518 deletions

View file

@ -1,5 +1,7 @@
package fr.free.nrw.commons;
import static fr.free.nrw.commons.TestConnectionFactoryKt.createTestClient;
import androidx.annotation.NonNull;
import java.util.List;
import java.util.concurrent.AbstractExecutorService;
@ -12,7 +14,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.wikipedia.AppAdapter;
import org.wikipedia.json.GsonUtil;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
@ -23,9 +24,9 @@ public abstract class MockWebServerTest {
private final TestWebServer server = new TestWebServer();
@Before public void setUp() throws Throwable {
AppAdapter.set(new TestAppAdapter());
OkHttpClient.Builder builder = AppAdapter.get().getOkHttpClient().newBuilder();
okHttpClient = builder.dispatcher(new Dispatcher(new ImmediateExecutorService())).build();
OkHttpConnectionFactory.CLIENT = createTestClient();
okHttpClient = OkHttpConnectionFactory.CLIENT.newBuilder()
.dispatcher(new Dispatcher(new ImmediateExecutorService())).build();
server.setUp();
}