mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Bugfix/duplicate categories (#2080)
* Increased timeout to 60 seconds * Bug fix #1550 * filter duplicate categories
This commit is contained in:
parent
568f80766e
commit
2bc9492367
2 changed files with 7 additions and 5 deletions
|
|
@ -31,9 +31,9 @@ public class NetworkingModule {
|
|||
@Singleton
|
||||
public OkHttpClient provideOkHttpClient(Context context) {
|
||||
File dir = new File(context.getCacheDir(), "okHttpCache");
|
||||
return new OkHttpClient.Builder().connectTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
return new OkHttpClient.Builder().connectTimeout(60, TimeUnit.SECONDS)
|
||||
.writeTimeout(60, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.cache(new Cache(dir, OK_HTTP_CACHE_SIZE))
|
||||
.build();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
@Override
|
||||
@NonNull
|
||||
public Observable<String> searchCategories(String filterValue, int searchCatsLimit) {
|
||||
List<String> categories = new ArrayList<>();
|
||||
return Single.fromCallable(() -> {
|
||||
List<CustomApiResult> categoryNodes = null;
|
||||
try {
|
||||
|
|
@ -367,11 +368,12 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
List<String> categories = new ArrayList<>();
|
||||
for (CustomApiResult categoryNode : categoryNodes) {
|
||||
String cat = categoryNode.getDocument().getTextContent();
|
||||
String catString = cat.replace("Category:", "");
|
||||
categories.add(catString);
|
||||
if (!categories.contains(catString)) {
|
||||
categories.add(catString);
|
||||
}
|
||||
}
|
||||
|
||||
return categories;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue