diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt
index 0c34cf1d3..8d75adffb 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt
@@ -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)
}
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b6c6a5cfa..e934a30c7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -475,6 +475,7 @@
Clear cookies
DNS over HTTPS (DoH)
Default user agent string
+ User agent string can not be blank
Reset default user agent string
Requires app restart to take effect
Cookies cleared