Add new line check to user agent preference

This commit is contained in:
Mubashir Haroon 2022-08-25 12:35:55 +05:00
parent 4b9a6541d1
commit 402bbe9d9a
2 changed files with 4 additions and 0 deletions

View File

@ -232,6 +232,9 @@ class SettingsAdvancedController(
if (it.toString().isBlank()) {
activity?.toast(R.string.error_user_agent_string_blank)
false
} else if (it.toString().contains("\n")) {
activity?.toast(R.string.error_user_agent_string_no_newline)
false
} else {
activity?.toast(R.string.requires_app_restart)
true

View File

@ -484,6 +484,7 @@
<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="error_user_agent_string_no_newline">User agent string can not contain new line</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>