Don't allow setting blank user agent string

This commit is contained in:
Jays2Kings 2022-08-20 23:26:33 -04:00
parent 8d4e812b3d
commit dea47baff1

View file

@ -45,7 +45,13 @@ class EditTextResetPreference @JvmOverloads constructor(
notifyChanged() notifyChanged()
} }
this.setPositiveButton(android.R.string.ok) { _, _ -> this.setPositiveButton(android.R.string.ok) { _, _ ->
sharedPreferences?.edit { putString(key, textView.text.toString()) } sharedPreferences?.edit {
if (textView.text.isNullOrBlank()) {
remove(key)
} else {
putString(key, textView.text.toString())
}
}
callChangeListener(textView.text.toString()) callChangeListener(textView.text.toString())
notifyChanged() notifyChanged()
} }