|
@@ -61,6 +61,7 @@ import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
|
|
import eu.kanade.tachiyomi.util.system.toast
|
|
|
import kotlinx.coroutines.launch
|
|
|
import logcat.LogPriority
|
|
|
+import okhttp3.Headers
|
|
|
import rikka.sui.Sui
|
|
|
import uy.kohesive.injekt.Injekt
|
|
|
import uy.kohesive.injekt.api.get
|
|
@@ -267,6 +268,13 @@ class SettingsAdvancedScreen : SearchableSettings {
|
|
|
context.toast(R.string.error_user_agent_string_blank)
|
|
|
return@EditTextPreference false
|
|
|
}
|
|
|
+ try {
|
|
|
+ // OkHttp checks for valid values internally
|
|
|
+ Headers.Builder().add("User-Agent", it)
|
|
|
+ } catch (_: IllegalArgumentException) {
|
|
|
+ context.toast(R.string.error_user_agent_string_invalid)
|
|
|
+ return@EditTextPreference false
|
|
|
+ }
|
|
|
context.toast(R.string.requires_app_restart)
|
|
|
true
|
|
|
},
|