Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/switch-to-commons-toolforge'
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-raoul committed Jan 29, 2024
2 parents 9f7e407 + f1276e4 commit a8545ab
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/src/androidTest/java/fr/free/nrw/commons/UploadTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class UploadTest {
.actionOnItemAtPosition<UploadMediaDetailAdapter.ViewHolder>(0,
MyViewAction.typeTextInChildViewWithId(R.id.description_item_edit_text, "Test description")))

onView(withId(R.id.btn_add_description))
onView(withId(R.id.btn_add))
.perform(click())

onView(withId(R.id.rv_descriptions)).perform(
Expand Down
14 changes: 1 addition & 13 deletions app/src/main/java/fr/free/nrw/commons/di/NetworkingModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
@SuppressWarnings({"WeakerAccess", "unused"})
public class NetworkingModule {
private static final String WIKIDATA_SPARQL_QUERY_URL = "https://query.wikidata.org/sparql";
private static final String TOOLS_FORGE_URL = "https://tools.wmflabs.org/urbanecmbot/commonsmisc";

private static final String TEST_TOOLS_FORGE_URL = "https://tools.wmflabs.org/commons-android-app/tool-commons-android-app";
private static final String TOOLS_FORGE_URL = "https://tools.wmflabs.org/commons-android-app/tool-commons-android-app";

public static final long OK_HTTP_CACHE_SIZE = 10 * 1024 * 1024;

Expand Down Expand Up @@ -92,13 +90,11 @@ public HttpLoggingInterceptor provideHttpLoggingInterceptor() {
public OkHttpJsonApiClient provideOkHttpJsonApiClient(OkHttpClient okHttpClient,
DepictsClient depictsClient,
@Named("tools_forge") HttpUrl toolsForgeUrl,
@Named("test_tools_forge") HttpUrl testToolsForgeUrl,
@Named("default_preferences") JsonKvStore defaultKvStore,
Gson gson) {
return new OkHttpJsonApiClient(okHttpClient,
depictsClient,
toolsForgeUrl,
testToolsForgeUrl,
WIKIDATA_SPARQL_QUERY_URL,
BuildConfig.WIKIMEDIA_CAMPAIGNS_URL,
gson);
Expand Down Expand Up @@ -146,14 +142,6 @@ public HttpUrl provideToolsForgeUrl() {
return HttpUrl.parse(TOOLS_FORGE_URL);
}

@Provides
@Named("test_tools_forge")
@NonNull
@SuppressWarnings("ConstantConditions")
public HttpUrl provideTestToolsForgeUrl() {
return HttpUrl.parse(TEST_TOOLS_FORGE_URL);
}

@Provides
@Singleton
@Named(NAMED_COMMONS_WIKI_SITE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public class OkHttpJsonApiClient {
private final OkHttpClient okHttpClient;
private final DepictsClient depictsClient;
private final HttpUrl wikiMediaToolforgeUrl;
private final HttpUrl wikiMediaTestToolforgeUrl;
private final String sparqlQueryUrl;
private final String campaignsUrl;
private final Gson gson;
Expand All @@ -57,14 +56,12 @@ public class OkHttpJsonApiClient {
public OkHttpJsonApiClient(OkHttpClient okHttpClient,
DepictsClient depictsClient,
HttpUrl wikiMediaToolforgeUrl,
HttpUrl wikiMediaTestToolforgeUrl,
String sparqlQueryUrl,
String campaignsUrl,
Gson gson) {
this.okHttpClient = okHttpClient;
this.depictsClient = depictsClient;
this.wikiMediaToolforgeUrl = wikiMediaToolforgeUrl;
this.wikiMediaTestToolforgeUrl = wikiMediaTestToolforgeUrl;
this.sparqlQueryUrl = sparqlQueryUrl;
this.campaignsUrl = campaignsUrl;
this.gson = gson;
Expand All @@ -83,7 +80,7 @@ public OkHttpJsonApiClient(OkHttpClient okHttpClient,
@NonNull
public Observable<LeaderboardResponse> getLeaderboard(String userName, String duration,
String category, String limit, String offset) {
final String fetchLeaderboardUrlTemplate = wikiMediaTestToolforgeUrl
final String fetchLeaderboardUrlTemplate = wikiMediaToolforgeUrl
+ LEADERBOARD_END_POINT;
String url = String.format(Locale.ENGLISH,
fetchLeaderboardUrlTemplate,
Expand Down Expand Up @@ -129,7 +126,7 @@ public Observable<LeaderboardResponse> getLeaderboard(String userName, String du
*/
@NonNull
public Single<UpdateAvatarResponse> setAvatar(String username, String avatar) {
final String urlTemplate = wikiMediaTestToolforgeUrl
final String urlTemplate = wikiMediaToolforgeUrl
+ UPDATE_AVATAR_END_POINT;
return Single.fromCallable(() -> {
String url = String.format(Locale.ENGLISH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class OkHttpJsonApiClientTests {
@Mock
lateinit var wikiMediaToolforgeUrl: HttpUrl

@Mock
lateinit var wikiMediaTestToolforgeUrl: HttpUrl
var sparqlQueryUrl: String = "https://www.testqparql.com"
var campaignsUrl: String = "https://www.testcampaignsurl.com"

Expand All @@ -52,7 +50,6 @@ class OkHttpJsonApiClientTests {
okhttpClient,
depictsClient,
wikiMediaToolforgeUrl,
wikiMediaTestToolforgeUrl,
sparqlQueryUrl,
campaignsUrl,
gson
Expand Down

0 comments on commit a8545ab

Please sign in to comment.