mirror of
https://github.com/antebudimir/tempus.git
synced 2026-04-15 16:27:26 +00:00
feat: add configurable timeout (#386)
This commit is contained in:
parent
38fc4a0936
commit
8d215a7f1c
5 changed files with 59 additions and 2 deletions
|
|
@ -85,6 +85,8 @@ object Preferences {
|
|||
private const val ARTIST_SORT_BY_ALBUM_COUNT= "artist_sort_by_album_count"
|
||||
private const val SORT_SEARCH_CHRONOLOGICALLY= "sort_search_chronologically"
|
||||
private const val ARTIST_DISPLAY_BIOGRAPHY= "artist_display_biography"
|
||||
private const val NETWORK_PING_TIMEOUT = "network_ping_timeout_base"
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun getServer(): String? {
|
||||
|
|
@ -96,6 +98,19 @@ object Preferences {
|
|||
App.getInstance().preferences.edit().putString(SERVER, server).apply()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getNetworkPingTimeout(): Int {
|
||||
val timeoutString = App.getInstance().preferences.getString(NETWORK_PING_TIMEOUT, "2") ?: "2"
|
||||
return (timeoutString.toIntOrNull() ?: 2).coerceAtLeast(1)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setNetworkPingTimeout(pingTimeout: String?) {
|
||||
App.getInstance().preferences.edit().putString(NETWORK_PING_TIMEOUT, pingTimeout).apply()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun getUser(): String? {
|
||||
return App.getInstance().preferences.getString(USER, null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue