mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Don't allow setting blank user agent string
This commit is contained in:
parent
47b56644de
commit
3760b310df
@ -229,19 +229,24 @@ class SettingsAdvancedController(
|
||||
summary = network.defaultUserAgent
|
||||
|
||||
onChange {
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
true
|
||||
if (it.toString().isBlank()) {
|
||||
activity?.toast(R.string.error_user_agent_string_blank)
|
||||
false
|
||||
} else {
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (preferences.defaultUserAgent().isSet()) {
|
||||
preference {
|
||||
key = "pref_reset_user_agent"
|
||||
titleRes = R.string.pref_reset_user_agent_string
|
||||
preference {
|
||||
key = "pref_reset_user_agent"
|
||||
titleRes = R.string.pref_reset_user_agent_string
|
||||
|
||||
onClick {
|
||||
preferences.defaultUserAgent().delete()
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
}
|
||||
visibleIf(preferences.defaultUserAgent()) { it != preferences.defaultUserAgent().defaultValue }
|
||||
|
||||
onClick {
|
||||
preferences.defaultUserAgent().delete()
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -475,6 +475,7 @@
|
||||
<string name="pref_clear_cookies">Clear cookies</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="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="requires_app_restart">Requires app restart to take effect</string>
|
||||
<string name="cookies_cleared">Cookies cleared</string>
|
||||
|
Loading…
Reference in New Issue
Block a user