fix(android): don't pre-fill localhost default in ServerUrl field
User pointed out they were being forced to clear "http://localhost:8080" before typing their actual server URL. That default came from AuthStore.DEFAULT_BASE_URL — an internal HTTP-client fallback for when nothing's been configured, never something a user typed. Now: pre-fill only when the stored URL is something the user actually saved (anything other than the default). Otherwise leave the field empty so the placeholder ("https://minstrel.example.com") shows through and they can just start typing. Edit case still works: if a user already saved e.g. "http://192.168.1.10:8080" and re-opens ServerUrl after sign-out, the field is pre-filled with that real value for them to edit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,7 +51,17 @@ class ServerUrlViewModel @Inject constructor(
|
||||
) : ViewModel() {
|
||||
|
||||
private val internal = MutableStateFlow(
|
||||
ServerUrlFormState(url = authStore.baseUrl.value),
|
||||
// Pre-fill ONLY if the user has previously saved a real URL —
|
||||
// the DEFAULT_BASE_URL placeholder (`http://localhost:8080`) is
|
||||
// an internal HTTP-client fallback, not something a user
|
||||
// typed. Leaving the field empty lets the OutlinedTextField's
|
||||
// placeholder ("https://minstrel.example.com") show through
|
||||
// so the user can just type without first having to clear.
|
||||
ServerUrlFormState(
|
||||
url = authStore.baseUrl.value
|
||||
.takeIf { it != AuthStore.DEFAULT_BASE_URL }
|
||||
.orEmpty(),
|
||||
),
|
||||
)
|
||||
val state: StateFlow<ServerUrlFormState> = internal.asStateFlow()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user