This commit is contained in:
aminecmi 2022-12-13 21:32:48 +01:00
parent 156c1681cf
commit c4ed30f594
2 changed files with 15 additions and 3 deletions

View File

@ -105,7 +105,7 @@
<string name="new_items_notification_text">%1$d new items loaded.</string> <string name="new_items_notification_text">%1$d new items loaded.</string>
<string name="pref_switch_notify_new_items">Notify on new items synced.</string> <string name="pref_switch_notify_new_items">Notify on new items synced.</string>
<string name="shortcut_offline">Offline</string> <string name="shortcut_offline">Offline</string>
<string name="pref_api_timeout">Api Timeout</string> <string name="pref_api_timeout">Api Timeout (seconds)</string>
<string name="pref_header_experimental">Experimental</string> <string name="pref_header_experimental">Experimental</string>
<string name="webview_dialog_issue_message">Webview not available. Disabling the article viewer to avoid any future crashes. Will load articles inside of your browser from now on.</string> <string name="webview_dialog_issue_message">Webview not available. Disabling the article viewer to avoid any future crashes. Will load articles inside of your browser from now on.</string>
<string name="webview_dialog_issue_title">Webview issue</string> <string name="webview_dialog_issue_title">Webview issue</string>

View File

@ -100,9 +100,21 @@ class AppSettingsService {
return _apiTimeout!! return _apiTimeout!!
} }
private fun secToMs(n: Long) = n * 1000
private fun refreshApiTimeout() { private fun refreshApiTimeout() {
val settingsTimeout = settings.getLong(API_TIMEOUT, HttpTimeout.INFINITE_TIMEOUT_MS) _apiTimeout = secToMs(try {
_apiTimeout = if (settingsTimeout > 0) settingsTimeout else HttpTimeout.INFINITE_TIMEOUT_MS 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() { private fun refreshBaseUrl() {