Android: public host as the build property kvitt.publicHost (D-121)

The release server's host name comes from -Pkvitt.publicHost, else kvitt.publicHost in
android/local.properties, else the placeholder kvitt.example.invalid. :app exposes it as
BuildConfig.PUBLIC_HOST, the manifest placeholder publicHost (the https invite-link intent
filter, port 8443) and RELEASE_SERVER_URL, which :feature:onboarding receives through the
@ReleaseServerUrl Hilt qualifier for S-1's prefill. Tests and goldens use fixed hosts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
2026-10-19 19:58:58 +02:00
parent 9231a1d755
commit d090c6c850
15 changed files with 156 additions and 50 deletions
@@ -56,7 +56,7 @@ data class PairingUiState(
val code: String = "",
val adminName: String? = null,
val name: String = "",
val serverUrl: String = RELEASE_SERVER_URL,
val serverUrl: String,
val serverExpanded: Boolean = false,
val pairing: Boolean = false,
val error: PairingError? = null,
@@ -75,17 +75,20 @@ data class PairingUiState(
/**
* State holder of S-1 Pairing (design-spec S-1; AC-2.4, AC-2.6 to AC-2.8, AC-2.10; §8.3; §14.4.8). Pairing never
* queues: offline, the call reports the network error. [allowLanHttp] is true in debug builds (AC-2.8).
* queues: offline, the call reports the network error. [allowLanHttp] is true in debug builds (AC-2.8);
* [releaseServerUrl] is the prefilled release server `:app` provides (AC-2.7, D-121).
*/
@HiltViewModel
class PairingViewModel internal constructor(
private val session: SessionRepository,
private val allowLanHttp: Boolean,
private val releaseServerUrl: String,
) : ViewModel() {
@Inject
constructor(session: SessionRepository) : this(session, BuildConfig.DEBUG)
constructor(session: SessionRepository, @ReleaseServerUrl releaseServerUrl: String) :
this(session, BuildConfig.DEBUG, releaseServerUrl)
private val mutable = MutableStateFlow(PairingUiState())
private val mutable = MutableStateFlow(PairingUiState(serverUrl = releaseServerUrl))
val state: StateFlow<PairingUiState> = mutable.asStateFlow()
private var prefilled = false
@@ -110,7 +113,7 @@ class PairingViewModel internal constructor(
code = code?.let(::normalizeInviteCode) ?: s.code,
adminName = adminName ?: s.adminName,
serverUrl = server ?: s.serverUrl,
serverExpanded = s.serverExpanded || (server != null && server != RELEASE_SERVER_URL),
serverExpanded = s.serverExpanded || (server != null && server != releaseServerUrl),
)
}
}
@@ -139,7 +142,7 @@ class PairingViewModel internal constructor(
code = invite.code,
adminName = invite.adminName ?: s.adminName,
serverUrl = server ?: s.serverUrl,
serverExpanded = s.serverExpanded || (server != null && server != RELEASE_SERVER_URL),
serverExpanded = s.serverExpanded || (server != null && server != releaseServerUrl),
error = null,
)
}
@@ -2,9 +2,21 @@ package se.hagstedt.kvitt.feature.onboarding
import java.net.URI
import java.net.URISyntaxException
import javax.inject.Qualifier
/** The release server, prefilled on S-1 (AC-2.7, SPEC §10.1). */
const val RELEASE_SERVER_URL = "https://icehack.asuscomm.com:8443"
/** The release server's port: the router forwards external 8443 to the TLS proxy (SPEC §10.1, D-120). */
const val RELEASE_SERVER_PORT = 8443
/**
* The release server of a public host name, `https://<host>:8443` (AC-2.7, D-121). `:app` builds it from its
* `BuildConfig.PUBLIC_HOST` (the Gradle property `kvitt.publicHost`) and provides it as [ReleaseServerUrl].
*/
fun releaseServerUrl(publicHost: String): String = "https://$publicHost:$RELEASE_SERVER_PORT"
/** The release server prefilled on S-1 (AC-2.7), `RELEASE_SERVER_URL` in `:app` (D-121). */
@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class ReleaseServerUrl
/** What is wrong with a server address on S-1. */
enum class ServerAddressProblem {