diff --git a/android/app/src/main/kotlin/se/hagstedt/kvitt/di/AppBuildInfoModule.kt b/android/app/src/main/kotlin/se/hagstedt/kvitt/di/AppBuildInfoModule.kt index ba4b12e..282eb80 100644 --- a/android/app/src/main/kotlin/se/hagstedt/kvitt/di/AppBuildInfoModule.kt +++ b/android/app/src/main/kotlin/se/hagstedt/kvitt/di/AppBuildInfoModule.kt @@ -6,11 +6,12 @@ import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import se.hagstedt.kvitt.BuildConfig import se.hagstedt.kvitt.data.di.AppBuildInfo +import se.hagstedt.kvitt.link.RELEASE_SERVER_URL import javax.inject.Singleton /** - * Both variants: the app's version (§10.6) and build type for `:data`'s `DataModule`, which Hilt installs in debug and - * release alike (it binds no `:core:model` interface, D-041). + * Both variants: the app's version (§10.6), build type and release server ([RELEASE_SERVER_URL], D-121, D-122) for + * `:data`'s `DataModule`, which Hilt installs in debug and release alike (it binds no `:core:model` interface, D-041). */ @Module @InstallIn(SingletonComponent::class) @@ -20,5 +21,6 @@ object AppBuildInfoModule { versionCode = BuildConfig.VERSION_CODE, versionName = BuildConfig.VERSION_NAME, debug = BuildConfig.DEBUG, + releaseServerUrl = RELEASE_SERVER_URL, ) } diff --git a/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/FakeScenarios.kt b/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/FakeScenarios.kt index ff78758..5f42c2b 100644 --- a/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/FakeScenarios.kt +++ b/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/FakeScenarios.kt @@ -71,7 +71,7 @@ object FakeScenarios { clockSkew = false, syncRunning = false, update = UpdateState.None, - about = AboutState("dev", 1, "https://icehack.asuscomm.com:8443", null, null), + about = AboutState("dev", 1, "https://kvitt.example.org:8443", null, null), online = true, today = "2026-10-17", now = "2026-10-17T06:00:00.000Z", diff --git a/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/settings/SettingsScenarios.kt b/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/settings/SettingsScenarios.kt index 6443853..80663cc 100644 --- a/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/settings/SettingsScenarios.kt +++ b/android/core/fakes/src/main/kotlin/se/hagstedt/kvitt/fakes/settings/SettingsScenarios.kt @@ -116,7 +116,7 @@ object SettingsScenarios { devices = devices, invites = listOf(pendingDeviceInvite), lastSuccessAt = "2026-10-17T11:59:00.000Z", - about = AboutState("1.1", 11, "https://icehack.asuscomm.com:8443", "1.1.0", 3), + about = AboutState("1.1", 11, "https://kvitt.example.org:8443", "1.1.0", 3), today = "2026-10-17", now = "2026-10-17T12:02:00.000Z", defaultAccountId = huset.id, diff --git a/android/data/src/main/kotlin/se/hagstedt/kvitt/data/di/DataModule.kt b/android/data/src/main/kotlin/se/hagstedt/kvitt/data/di/DataModule.kt index 83b0362..dbbba69 100644 --- a/android/data/src/main/kotlin/se/hagstedt/kvitt/data/di/DataModule.kt +++ b/android/data/src/main/kotlin/se/hagstedt/kvitt/data/di/DataModule.kt @@ -87,8 +87,11 @@ import javax.inject.Provider import javax.inject.Qualifier import javax.inject.Singleton -/** What `:app` provides: its version (§10.6) and build type (AC-2.8, AC-16.5). */ -data class AppBuildInfo(val versionCode: Int, val versionName: String, val debug: Boolean) +/** + * What `:app` provides: its version (§10.6), build type (AC-2.8, AC-16.5) and release server `https://:8443` + * (`RELEASE_SERVER_URL`, from the Gradle property `kvitt.publicHost`, D-121), which S-22 shows before pairing (D-122). + */ +data class AppBuildInfo(val versionCode: Int, val versionName: String, val debug: Boolean, val releaseServerUrl: String) @Qualifier @Retention(AnnotationRetention.BINARY) @@ -110,9 +113,6 @@ annotation class DataScope @Module @InstallIn(SingletonComponent::class) object DataModule { - /** §8.5: release builds use https only (the app's network security config); the default server of AC-2.7. */ - const val DEFAULT_SERVER_URL = "https://icehack.asuscomm.com:8443" - @Provides @Singleton @DataScope fun scope(): CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) @@ -276,7 +276,7 @@ object DataModule { @Provides @Singleton fun about(credentials: CredentialStore, session: SessionManager, api: KvittApi, gate: OnlineGate, build: AppBuildInfo): AboutRepositoryImpl = - AboutRepositoryImpl(credentials, session.serverVersion, api, gate, build.versionName, build.versionCode, DEFAULT_SERVER_URL) + AboutRepositoryImpl(credentials, session.serverVersion, api, gate, build.versionName, build.versionCode, build.releaseServerUrl) } /** The `:core:model` interfaces bound to `:data`. Not installed automatically: `:app` includes it in its release graph. */ diff --git a/android/data/src/main/kotlin/se/hagstedt/kvitt/data/repo/SettingsRepositories.kt b/android/data/src/main/kotlin/se/hagstedt/kvitt/data/repo/SettingsRepositories.kt index 10d6fb6..f8d781e 100644 --- a/android/data/src/main/kotlin/se/hagstedt/kvitt/data/repo/SettingsRepositories.kt +++ b/android/data/src/main/kotlin/se/hagstedt/kvitt/data/repo/SettingsRepositories.kt @@ -388,7 +388,8 @@ class AboutRepositoryImpl( private val gate: OnlineGate, private val versionName: String, private val versionCode: Int, - private val defaultServerUrl: String, + /** Shown while no server is paired: `AppBuildInfo.releaseServerUrl`, `https://:8443` (D-122). */ + private val releaseServerUrl: String, ) : AboutRepository { override fun about(): Flow { val health = flow { @@ -396,7 +397,7 @@ class AboutRepositoryImpl( emit((gate.run({ api.health() }) { it } as? OnlineResult.Ok)?.value) } return combine(credentials.record, serverVersion, health) { record, header, h -> - AboutState(versionName, versionCode, record.baseUrl ?: defaultServerUrl, h?.serverVersion ?: header, h?.schemaVersion) + AboutState(versionName, versionCode, record.baseUrl ?: releaseServerUrl, h?.serverVersion ?: header, h?.schemaVersion) }.distinctUntilChanged() } } diff --git a/android/data/src/test/kotlin/se/hagstedt/kvitt/data/repo/RepositoriesTest.kt b/android/data/src/test/kotlin/se/hagstedt/kvitt/data/repo/RepositoriesTest.kt index 19d47f3..5d93055 100644 --- a/android/data/src/test/kotlin/se/hagstedt/kvitt/data/repo/RepositoriesTest.kt +++ b/android/data/src/test/kotlin/se/hagstedt/kvitt/data/repo/RepositoriesTest.kt @@ -374,7 +374,7 @@ class RepositoriesTest { h.server.restHandler = { _, path -> if (path == "/health") HttpStatusCode.OK to """{"status":"ok","server_version":"1.2.0","schema_version":3,"db_ok":true}""" else null } - val repo = AboutRepositoryImpl(h.credentials, kotlinx.coroutines.flow.MutableStateFlow("1.1.0"), h.api, h.gate, "1.1", 11, "https://default.test") + val repo = AboutRepositoryImpl(h.credentials, kotlinx.coroutines.flow.MutableStateFlow("1.1.0"), h.api, h.gate, "1.1", 11, RELEASE_SERVER_URL) val state = repo.about().first { it.schemaVersion != null } assertEquals("1.2.0", state.serverVersion) assertEquals(3, state.schemaVersion) @@ -387,7 +387,7 @@ class RepositoriesTest { fun about_offlineOrFailingHealth_fallsBackToTheHeaderVersion() = runSync { val header = kotlinx.coroutines.flow.MutableStateFlow("1.1.0") h.monitor.state.value = false - val repo = AboutRepositoryImpl(h.credentials, header, h.api, h.gate, "1.1", 11, "https://default.test") + val repo = AboutRepositoryImpl(h.credentials, header, h.api, h.gate, "1.1", 11, RELEASE_SERVER_URL) val offline = repo.about().first() assertEquals("1.1.0", offline.serverVersion) assertNull(offline.schemaVersion) @@ -400,6 +400,14 @@ class RepositoriesTest { assertEquals("1.1.0", repo.about().first().serverVersion) } + @Test + fun about_unpaired_showsTheReleaseServerOfTheBuild() = runSync { + h.credentials.clear() + h.monitor.state.value = false + val repo = AboutRepositoryImpl(h.credentials, kotlinx.coroutines.flow.MutableStateFlow(null), h.api, h.gate, "1.1", 11, RELEASE_SERVER_URL) + assertEquals(RELEASE_SERVER_URL, repo.about().first().serverUrl) + } + @Test fun categoryReorder_sendsOnePatchPerChangedSortOrder() = runSync { val patched = mutableListOf>() @@ -519,5 +527,7 @@ class RepositoriesTest { private companion object { const val OLDER = "0192a003-0000-7000-8000-000000000002" + /** `AppBuildInfo.releaseServerUrl` of the tests: a fixed host, not `:app`'s `kvitt.publicHost` (D-122). */ + const val RELEASE_SERVER_URL = "https://kvitt.example.org:8443" } } diff --git a/android/feature/settings/src/test/screenshots/s21_invites_created_device_en_light.png b/android/feature/settings/src/test/screenshots/s21_invites_created_device_en_light.png index 3b798ee..7ce8957 100644 Binary files a/android/feature/settings/src/test/screenshots/s21_invites_created_device_en_light.png and b/android/feature/settings/src/test/screenshots/s21_invites_created_device_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_dark.png b/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_dark.png index ae92ff5..6a04e6d 100644 Binary files a/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_dark.png and b/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_light.png b/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_light.png index 3c3dcec..3e08744 100644 Binary files a/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_light.png and b/android/feature/settings/src/test/screenshots/s21_invites_created_device_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s21_invites_created_partner_en_light.png b/android/feature/settings/src/test/screenshots/s21_invites_created_partner_en_light.png index 6f40a42..e9b6703 100644 Binary files a/android/feature/settings/src/test/screenshots/s21_invites_created_partner_en_light.png and b/android/feature/settings/src/test/screenshots/s21_invites_created_partner_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_dark.png b/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_dark.png index 3702263..2886609 100644 Binary files a/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_dark.png and b/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_light.png b/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_light.png index 586cbed..1b5e6c8 100644 Binary files a/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_light.png and b/android/feature/settings/src/test/screenshots/s21_invites_created_partner_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_failed_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_check_failed_en_light.png index 9d0293a..7f9f26e 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_failed_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_check_failed_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_dark.png index 4b146f5..eea6698 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_light.png index bfca37d..a1ce605 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_check_failed_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_en_light.png index 604717b..8d3bdf0 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_dark.png index a66184a..eca52fe 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_light.png index 700690d..1a8e756 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_check_up_to_date_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_update_found_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_check_update_found_en_light.png index d162723..061b7e4 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_update_found_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_check_update_found_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_dark.png index 9c069e1..a5dd34e 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_light.png index 7398895..5ad8edf 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_check_update_found_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_checking_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_checking_en_light.png index e6f3cde..506359c 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_checking_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_checking_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_checking_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_checking_sv_dark.png index db22e3a..1197e5a 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_checking_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_checking_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_checking_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_checking_sv_light.png index 98eced9..d44ad63 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_checking_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_checking_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_downloading_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_downloading_en_light.png index 9e77fe7..2a45d42 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_downloading_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_downloading_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_dark.png index 4552095..4e58130 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_light.png index efbd93e..c50a4ef 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_downloading_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_offline_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_offline_en_light.png index 426164e..b978293 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_offline_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_offline_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_offline_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_offline_sv_dark.png index c9ff5a6..2b71d6f 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_offline_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_offline_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_offline_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_offline_sv_light.png index 1637062..4069e94 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_offline_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_offline_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_online_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_online_en_light.png index 663a87a..512c915 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_online_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_online_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_online_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_online_sv_dark.png index 3587ce3..0c4180a 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_online_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_online_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_online_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_online_sv_light.png index 6432811..57b0879 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_online_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_online_sv_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_update_failed_en_light.png b/android/feature/settings/src/test/screenshots/s22_about_update_failed_en_light.png index 28fa148..2b87052 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_update_failed_en_light.png and b/android/feature/settings/src/test/screenshots/s22_about_update_failed_en_light.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_dark.png b/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_dark.png index 891f533..1e65a75 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_dark.png and b/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_dark.png differ diff --git a/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_light.png b/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_light.png index eadea58..0abf6f1 100644 Binary files a/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_light.png and b/android/feature/settings/src/test/screenshots/s22_about_update_failed_sv_light.png differ