mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-13 17:38:42 -04:00
#2385 Online Library is just loading and loading - make serialiser strict
This commit is contained in:
parent
17b71ab75c
commit
cdcc45cf92
@ -73,7 +73,6 @@ import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryListItem.Li
|
||||
import java.util.LinkedList
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit.MILLISECONDS
|
||||
import java.util.concurrent.TimeUnit.SECONDS
|
||||
import javax.inject.Inject
|
||||
|
||||
class ZimManageViewModel @Inject constructor(
|
||||
@ -218,18 +217,15 @@ class ZimManageViewModel @Inject constructor(
|
||||
connectivityBroadcastReceiver.networkStates.distinctUntilChanged().filter(
|
||||
CONNECTED::equals
|
||||
),
|
||||
BiFunction<Unit, NetworkState, Unit> { _, _ -> Unit }
|
||||
BiFunction<Unit, NetworkState, Unit> { _, _ -> }
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(
|
||||
{
|
||||
kiwixService.library
|
||||
.timeout(60, SECONDS)
|
||||
.retry(5)
|
||||
.subscribe(
|
||||
library::onNext
|
||||
) {
|
||||
.subscribe(library::onNext) {
|
||||
it.printStackTrace()
|
||||
library.onNext(LibraryNetworkEntity().apply { book = LinkedList() })
|
||||
}
|
||||
|
@ -32,15 +32,19 @@ import javax.inject.Singleton
|
||||
|
||||
private const val CONNECTION_TIMEOUT = 10L
|
||||
private const val READ_TIMEOUT = 60L
|
||||
private const val CALL_TIMEOUT = 60L
|
||||
private const val USER_AGENT = "kiwix-android-version:${BuildConfig.VERSION_CODE}"
|
||||
private const val KIWIX_DOWNLOAD_URL = "http://mirror.download.kiwix.org/"
|
||||
|
||||
@Module
|
||||
class NetworkModule {
|
||||
@Provides @Singleton fun provideOkHttpClient(): OkHttpClient {
|
||||
return OkHttpClient().newBuilder().followRedirects(true).followSslRedirects(true)
|
||||
return OkHttpClient().newBuilder()
|
||||
.followRedirects(true)
|
||||
.followSslRedirects(true)
|
||||
.connectTimeout(CONNECTION_TIMEOUT, SECONDS)
|
||||
.readTimeout(READ_TIMEOUT, SECONDS)
|
||||
.callTimeout(CALL_TIMEOUT, SECONDS)
|
||||
.addNetworkInterceptor(HttpLoggingInterceptor().apply {
|
||||
level = if (BuildConfig.DEBUG) BASIC else NONE
|
||||
})
|
||||
|
@ -25,7 +25,7 @@ import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.ElementList;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name = "library", strict = false)
|
||||
@Root(name = "library")
|
||||
public class LibraryNetworkEntity {
|
||||
|
||||
@ElementList(name = "book", inline = true, required = false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user