mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 03:09:19 +01:00
Don't allow setting blank user agent string
This commit is contained in:
parent
47b56644de
commit
3760b310df
@ -229,22 +229,27 @@ class SettingsAdvancedController(
|
|||||||
summary = network.defaultUserAgent
|
summary = network.defaultUserAgent
|
||||||
|
|
||||||
onChange {
|
onChange {
|
||||||
|
if (it.toString().isBlank()) {
|
||||||
|
activity?.toast(R.string.error_user_agent_string_blank)
|
||||||
|
false
|
||||||
|
} else {
|
||||||
activity?.toast(R.string.requires_app_restart)
|
activity?.toast(R.string.requires_app_restart)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (preferences.defaultUserAgent().isSet()) {
|
}
|
||||||
preference {
|
preference {
|
||||||
key = "pref_reset_user_agent"
|
key = "pref_reset_user_agent"
|
||||||
titleRes = R.string.pref_reset_user_agent_string
|
titleRes = R.string.pref_reset_user_agent_string
|
||||||
|
|
||||||
|
visibleIf(preferences.defaultUserAgent()) { it != preferences.defaultUserAgent().defaultValue }
|
||||||
|
|
||||||
onClick {
|
onClick {
|
||||||
preferences.defaultUserAgent().delete()
|
preferences.defaultUserAgent().delete()
|
||||||
activity?.toast(R.string.requires_app_restart)
|
activity?.toast(R.string.requires_app_restart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
titleRes = R.string.label_library
|
titleRes = R.string.label_library
|
||||||
|
@ -475,6 +475,7 @@
|
|||||||
<string name="pref_clear_cookies">Clear cookies</string>
|
<string name="pref_clear_cookies">Clear cookies</string>
|
||||||
<string name="pref_dns_over_https">DNS over HTTPS (DoH)</string>
|
<string name="pref_dns_over_https">DNS over HTTPS (DoH)</string>
|
||||||
<string name="pref_user_agent_string">Default user agent string</string>
|
<string name="pref_user_agent_string">Default user agent string</string>
|
||||||
|
<string name="error_user_agent_string_blank">User agent string can not be blank</string>
|
||||||
<string name="pref_reset_user_agent_string">Reset default user agent string</string>
|
<string name="pref_reset_user_agent_string">Reset default user agent string</string>
|
||||||
<string name="requires_app_restart">Requires app restart to take effect</string>
|
<string name="requires_app_restart">Requires app restart to take effect</string>
|
||||||
<string name="cookies_cleared">Cookies cleared</string>
|
<string name="cookies_cleared">Cookies cleared</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user