diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml
index e986416..e53facf 100644
--- a/androidApp/src/main/res/values/strings.xml
+++ b/androidApp/src/main/res/values/strings.xml
@@ -105,7 +105,7 @@
%1$d new items loaded.
Notify on new items synced.
Offline
- Api Timeout
+ Api Timeout (seconds)
Experimental
Webview not available. Disabling the article viewer to avoid any future crashes. Will load articles inside of your browser from now on.
Webview issue
diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/service/AppSettingsService.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/service/AppSettingsService.kt
index c8e8bf2..860c981 100644
--- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/service/AppSettingsService.kt
+++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/service/AppSettingsService.kt
@@ -100,9 +100,21 @@ class AppSettingsService {
return _apiTimeout!!
}
+ private fun secToMs(n: Long) = n * 1000
+
private fun refreshApiTimeout() {
- val settingsTimeout = settings.getLong(API_TIMEOUT, HttpTimeout.INFINITE_TIMEOUT_MS)
- _apiTimeout = if (settingsTimeout > 0) settingsTimeout else HttpTimeout.INFINITE_TIMEOUT_MS
+ _apiTimeout = secToMs(try {
+ val settingsTimeout = settings.getString(API_TIMEOUT, "60")
+ if (settingsTimeout.toLong() > 0) {
+ settingsTimeout.toLong()
+ } else {
+ settings.remove(API_TIMEOUT)
+ 60
+ }
+ } catch (e: Exception) {
+ settings.remove(API_TIMEOUT)
+ 60
+ })
}
private fun refreshBaseUrl() {