Further cleanup maxBitrate function

This commit is contained in:
tzugen 2021-11-03 12:55:20 +01:00
parent a66d07ae84
commit aac73cd6d7
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
1 changed files with 13 additions and 6 deletions

View File

@ -69,13 +69,20 @@ object Settings {
@JvmStatic @JvmStatic
val maxBitRate: Int val maxBitRate: Int
get() { get() {
val preferences = preferences val network = Util.networkInfo()
return preferences.getString(
if (Util.networkInfo().unmetered) Constants.PREFERENCES_KEY_MAX_BITRATE_WIFI if (!network.connected) return 0
else Constants.PREFERENCES_KEY_MAX_BITRATE_MOBILE,
"0" if (network.unmetered) {
)!!.toInt() return maxWifiBitRate
} else {
return maxMobileBitRate
} }
}
private var maxWifiBitRate by StringIntSetting(Constants.PREFERENCES_KEY_MAX_BITRATE_WIFI)
private var maxMobileBitRate by StringIntSetting(Constants.PREFERENCES_KEY_MAX_BITRATE_MOBILE)
@JvmStatic @JvmStatic
val preloadCount: Int val preloadCount: Int