From b51bceb0b7ae187401662d9d0b14f41c4cd7ce7e Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:40:49 +0100 Subject: [PATCH 1/8] fix(licensing): one canonical URL per licence, not whatever POM is cached The catalogue took a module's licence URL from its POM, and that POM was only there if the local Gradle cache happened to hold it (androidx.test.ext:junit 1.3.0 got a URL only after the instrumented tests had been compiled once). The Android build's licensing gate then passed on one machine and failed on another. A known licence now carries its canonical URL, and a test keeps every generated entry on it. --- .../composeResources/files/licenses.json | 270 +++++++++--------- tools/licensing/collect.py | 9 + tools/licensing/collect_test.py | 10 + 3 files changed, 154 insertions(+), 135 deletions(-) diff --git a/shared/src/commonMain/composeResources/files/licenses.json b/shared/src/commonMain/composeResources/files/licenses.json index e11d984..009838c 100644 --- a/shared/src/commonMain/composeResources/files/licenses.json +++ b/shared/src/commonMain/composeResources/files/licenses.json @@ -17,7 +17,7 @@ "id": "androidx.activity:activity", "name": "activity", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -30,7 +30,7 @@ "id": "androidx.activity:activity-compose", "name": "activity-compose", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -43,7 +43,7 @@ "id": "androidx.activity:activity-ktx", "name": "activity-ktx", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -56,7 +56,7 @@ "id": "androidx.annotation:annotation", "name": "annotation", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -69,7 +69,7 @@ "id": "androidx.annotation:annotation-experimental", "name": "annotation-experimental", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -82,7 +82,7 @@ "id": "androidx.annotation:annotation-jvm", "name": "annotation-jvm", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -95,7 +95,7 @@ "id": "androidx.appcompat:appcompat", "name": "appcompat", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -108,7 +108,7 @@ "id": "androidx.appcompat:appcompat-resources", "name": "appcompat-resources", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -121,7 +121,7 @@ "id": "androidx.arch.core:core-common", "name": "core-common", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -134,7 +134,7 @@ "id": "androidx.arch.core:core-runtime", "name": "core-runtime", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -147,7 +147,7 @@ "id": "androidx.autofill:autofill", "name": "autofill", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -160,7 +160,7 @@ "id": "androidx.biometric:biometric", "name": "biometric", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -173,7 +173,7 @@ "id": "androidx.collection:collection", "name": "collection", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -186,7 +186,7 @@ "id": "androidx.collection:collection-jvm", "name": "collection-jvm", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -199,7 +199,7 @@ "id": "androidx.collection:collection-ktx", "name": "collection-ktx", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -212,7 +212,7 @@ "id": "androidx.compose.animation:animation", "name": "animation", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -225,7 +225,7 @@ "id": "androidx.compose.animation:animation-android", "name": "animation-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -238,7 +238,7 @@ "id": "androidx.compose.animation:animation-core", "name": "animation-core", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -251,7 +251,7 @@ "id": "androidx.compose.animation:animation-core-android", "name": "animation-core-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -264,7 +264,7 @@ "id": "androidx.compose.foundation:foundation", "name": "foundation", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -277,7 +277,7 @@ "id": "androidx.compose.foundation:foundation-android", "name": "foundation-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -290,7 +290,7 @@ "id": "androidx.compose.foundation:foundation-layout", "name": "foundation-layout", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -303,7 +303,7 @@ "id": "androidx.compose.foundation:foundation-layout-android", "name": "foundation-layout-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -316,7 +316,7 @@ "id": "androidx.compose.material3:material3", "name": "material3", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -329,7 +329,7 @@ "id": "androidx.compose.material3:material3-android", "name": "material3-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -342,7 +342,7 @@ "id": "androidx.compose.material:material-icons-core", "name": "material-icons-core", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -355,7 +355,7 @@ "id": "androidx.compose.material:material-icons-core-android", "name": "material-icons-core-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -368,7 +368,7 @@ "id": "androidx.compose.material:material-icons-extended", "name": "material-icons-extended", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -381,7 +381,7 @@ "id": "androidx.compose.material:material-icons-extended-android", "name": "material-icons-extended-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -394,7 +394,7 @@ "id": "androidx.compose.material:material-ripple", "name": "material-ripple", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -407,7 +407,7 @@ "id": "androidx.compose.material:material-ripple-android", "name": "material-ripple-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -420,7 +420,7 @@ "id": "androidx.compose.runtime:runtime", "name": "runtime", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -433,7 +433,7 @@ "id": "androidx.compose.runtime:runtime-android", "name": "runtime-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -446,7 +446,7 @@ "id": "androidx.compose.runtime:runtime-annotation", "name": "runtime-annotation", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -459,7 +459,7 @@ "id": "androidx.compose.runtime:runtime-annotation-android", "name": "runtime-annotation-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -472,7 +472,7 @@ "id": "androidx.compose.runtime:runtime-retain", "name": "runtime-retain", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -485,7 +485,7 @@ "id": "androidx.compose.runtime:runtime-retain-android", "name": "runtime-retain-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -498,7 +498,7 @@ "id": "androidx.compose.runtime:runtime-saveable", "name": "runtime-saveable", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -511,7 +511,7 @@ "id": "androidx.compose.runtime:runtime-saveable-android", "name": "runtime-saveable-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -524,7 +524,7 @@ "id": "androidx.compose.ui:ui", "name": "ui", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -537,7 +537,7 @@ "id": "androidx.compose.ui:ui-android", "name": "ui-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -550,7 +550,7 @@ "id": "androidx.compose.ui:ui-geometry", "name": "ui-geometry", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -563,7 +563,7 @@ "id": "androidx.compose.ui:ui-geometry-android", "name": "ui-geometry-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -576,7 +576,7 @@ "id": "androidx.compose.ui:ui-graphics", "name": "ui-graphics", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -589,7 +589,7 @@ "id": "androidx.compose.ui:ui-graphics-android", "name": "ui-graphics-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -602,7 +602,7 @@ "id": "androidx.compose.ui:ui-test-junit4", "name": "ui-test-junit4", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Test-only dependency; not shipped in the app.", "distribution": "test", "license": "Apache-2.0", @@ -615,7 +615,7 @@ "id": "androidx.compose.ui:ui-test-manifest", "name": "ui-test-manifest", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -628,7 +628,7 @@ "id": "androidx.compose.ui:ui-text", "name": "ui-text", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -641,7 +641,7 @@ "id": "androidx.compose.ui:ui-text-android", "name": "ui-text-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -654,7 +654,7 @@ "id": "androidx.compose.ui:ui-tooling", "name": "ui-tooling", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -667,7 +667,7 @@ "id": "androidx.compose.ui:ui-tooling-android", "name": "ui-tooling-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -680,7 +680,7 @@ "id": "androidx.compose.ui:ui-tooling-data", "name": "ui-tooling-data", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -693,7 +693,7 @@ "id": "androidx.compose.ui:ui-tooling-data-android", "name": "ui-tooling-data-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -706,7 +706,7 @@ "id": "androidx.compose.ui:ui-tooling-preview", "name": "ui-tooling-preview", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -719,7 +719,7 @@ "id": "androidx.compose.ui:ui-tooling-preview-android", "name": "ui-tooling-preview-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -732,7 +732,7 @@ "id": "androidx.compose.ui:ui-unit", "name": "ui-unit", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -745,7 +745,7 @@ "id": "androidx.compose.ui:ui-unit-android", "name": "ui-unit-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -758,7 +758,7 @@ "id": "androidx.compose.ui:ui-util", "name": "ui-util", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -771,7 +771,7 @@ "id": "androidx.compose.ui:ui-util-android", "name": "ui-util-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -797,7 +797,7 @@ "id": "androidx.concurrent:concurrent-futures", "name": "concurrent-futures", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -810,7 +810,7 @@ "id": "androidx.core:core", "name": "core", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -823,7 +823,7 @@ "id": "androidx.core:core-ktx", "name": "core-ktx", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -836,7 +836,7 @@ "id": "androidx.core:core-viewtree", "name": "core-viewtree", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -849,7 +849,7 @@ "id": "androidx.credentials:credentials", "name": "credentials", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -862,7 +862,7 @@ "id": "androidx.credentials:credentials-play-services-auth", "name": "credentials-play-services-auth", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -875,7 +875,7 @@ "id": "androidx.cursoradapter:cursoradapter", "name": "cursoradapter", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -888,7 +888,7 @@ "id": "androidx.customview:customview", "name": "customview", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -901,7 +901,7 @@ "id": "androidx.customview:customview-poolingcontainer", "name": "customview-poolingcontainer", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -914,7 +914,7 @@ "id": "androidx.drawerlayout:drawerlayout", "name": "drawerlayout", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -927,7 +927,7 @@ "id": "androidx.emoji2:emoji2", "name": "emoji2", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -940,7 +940,7 @@ "id": "androidx.emoji2:emoji2-views-helper", "name": "emoji2-views-helper", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -953,7 +953,7 @@ "id": "androidx.exifinterface:exifinterface", "name": "exifinterface", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -966,7 +966,7 @@ "id": "androidx.fragment:fragment", "name": "fragment", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -979,7 +979,7 @@ "id": "androidx.graphics:graphics-path", "name": "graphics-path", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -992,7 +992,7 @@ "id": "androidx.interpolator:interpolator", "name": "interpolator", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1005,7 +1005,7 @@ "id": "androidx.lifecycle:lifecycle-common", "name": "lifecycle-common", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1018,7 +1018,7 @@ "id": "androidx.lifecycle:lifecycle-common-java8", "name": "lifecycle-common-java8", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1031,7 +1031,7 @@ "id": "androidx.lifecycle:lifecycle-common-jvm", "name": "lifecycle-common-jvm", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1044,7 +1044,7 @@ "id": "androidx.lifecycle:lifecycle-livedata-core", "name": "lifecycle-livedata-core", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1057,7 +1057,7 @@ "id": "androidx.lifecycle:lifecycle-process", "name": "lifecycle-process", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1070,7 +1070,7 @@ "id": "androidx.lifecycle:lifecycle-runtime", "name": "lifecycle-runtime", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1083,7 +1083,7 @@ "id": "androidx.lifecycle:lifecycle-runtime-android", "name": "lifecycle-runtime-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1096,7 +1096,7 @@ "id": "androidx.lifecycle:lifecycle-runtime-compose", "name": "lifecycle-runtime-compose", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1109,7 +1109,7 @@ "id": "androidx.lifecycle:lifecycle-runtime-compose-android", "name": "lifecycle-runtime-compose-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1122,7 +1122,7 @@ "id": "androidx.lifecycle:lifecycle-runtime-ktx", "name": "lifecycle-runtime-ktx", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1135,7 +1135,7 @@ "id": "androidx.lifecycle:lifecycle-runtime-ktx-android", "name": "lifecycle-runtime-ktx-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1148,7 +1148,7 @@ "id": "androidx.lifecycle:lifecycle-viewmodel", "name": "lifecycle-viewmodel", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1161,7 +1161,7 @@ "id": "androidx.lifecycle:lifecycle-viewmodel-android", "name": "lifecycle-viewmodel-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1174,7 +1174,7 @@ "id": "androidx.lifecycle:lifecycle-viewmodel-compose", "name": "lifecycle-viewmodel-compose", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1187,7 +1187,7 @@ "id": "androidx.lifecycle:lifecycle-viewmodel-compose-android", "name": "lifecycle-viewmodel-compose-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1200,7 +1200,7 @@ "id": "androidx.lifecycle:lifecycle-viewmodel-ktx", "name": "lifecycle-viewmodel-ktx", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1213,7 +1213,7 @@ "id": "androidx.lifecycle:lifecycle-viewmodel-savedstate", "name": "lifecycle-viewmodel-savedstate", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1226,7 +1226,7 @@ "id": "androidx.lifecycle:lifecycle-viewmodel-savedstate-android", "name": "lifecycle-viewmodel-savedstate-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1239,7 +1239,7 @@ "id": "androidx.loader:loader", "name": "loader", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1252,7 +1252,7 @@ "id": "androidx.navigationevent:navigationevent", "name": "navigationevent", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1265,7 +1265,7 @@ "id": "androidx.navigationevent:navigationevent-android", "name": "navigationevent-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1278,7 +1278,7 @@ "id": "androidx.navigationevent:navigationevent-compose", "name": "navigationevent-compose", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1291,7 +1291,7 @@ "id": "androidx.navigationevent:navigationevent-compose-android", "name": "navigationevent-compose-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1304,7 +1304,7 @@ "id": "androidx.profileinstaller:profileinstaller", "name": "profileinstaller", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1317,7 +1317,7 @@ "id": "androidx.resourceinspection:resourceinspection-annotation", "name": "resourceinspection-annotation", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1330,7 +1330,7 @@ "id": "androidx.savedstate:savedstate", "name": "savedstate", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1343,7 +1343,7 @@ "id": "androidx.savedstate:savedstate-android", "name": "savedstate-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1356,7 +1356,7 @@ "id": "androidx.savedstate:savedstate-compose", "name": "savedstate-compose", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1369,7 +1369,7 @@ "id": "androidx.savedstate:savedstate-compose-android", "name": "savedstate-compose-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1382,7 +1382,7 @@ "id": "androidx.savedstate:savedstate-ktx", "name": "savedstate-ktx", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1395,7 +1395,7 @@ "id": "androidx.startup:startup-runtime", "name": "startup-runtime", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1408,7 +1408,7 @@ "id": "androidx.test.ext:junit", "name": "junit", "author": "The Android Open Source Project", - "url": null, + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Test-only dependency; not shipped in the app.", "distribution": "test", "license": "Apache-2.0", @@ -1421,7 +1421,7 @@ "id": "androidx.tracing:tracing", "name": "tracing", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1434,7 +1434,7 @@ "id": "androidx.tracing:tracing-android", "name": "tracing-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1447,7 +1447,7 @@ "id": "androidx.vectordrawable:vectordrawable", "name": "vectordrawable", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1460,7 +1460,7 @@ "id": "androidx.vectordrawable:vectordrawable-animated", "name": "vectordrawable-animated", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1473,7 +1473,7 @@ "id": "androidx.versionedparcelable:versionedparcelable", "name": "versionedparcelable", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1486,7 +1486,7 @@ "id": "androidx.viewpager:viewpager", "name": "viewpager", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1499,7 +1499,7 @@ "id": "androidx.window:window", "name": "window", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1512,7 +1512,7 @@ "id": "androidx.window:window-core", "name": "window-core", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1525,7 +1525,7 @@ "id": "androidx.window:window-core-android", "name": "window-core-android", "author": "The Android Open Source Project", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1564,7 +1564,7 @@ "id": "com.caverock:androidsvg-aar", "name": "androidsvg-aar", "author": "com.caverock", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1577,7 +1577,7 @@ "id": "com.charleskorn.kaml:kaml", "name": "kaml", "author": "com.charleskorn.kaml", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1590,7 +1590,7 @@ "id": "com.charleskorn.kaml:kaml-jvm", "name": "kaml-jvm", "author": "com.charleskorn.kaml", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1603,7 +1603,7 @@ "id": "com.github.codemonstur:embedded-redis", "name": "embedded-redis", "author": "Jurgen Voorneveld", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Test-only dependency; not shipped in the app.", "distribution": "test", "license": "Apache-2.0", @@ -1616,7 +1616,7 @@ "id": "com.google.accompanist:accompanist-drawablepainter", "name": "accompanist-drawablepainter", "author": "Google LLC", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1759,7 +1759,7 @@ "id": "com.google.guava:listenablefuture", "name": "listenablefuture", "author": "Google LLC", - "url": null, + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1811,7 +1811,7 @@ "id": "com.squareup.okhttp3:okhttp", "name": "okhttp", "author": "Square, Inc.", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1824,7 +1824,7 @@ "id": "com.squareup.okio:okio", "name": "okio", "author": "Square, Inc.", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -1837,7 +1837,7 @@ "id": "com.squareup.okio:okio-fakefilesystem", "name": "okio-fakefilesystem", "author": "Square, Inc.", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Build-time or catalog-only dependency; not shipped in the app.", "distribution": "build", "license": "Apache-2.0", @@ -1850,7 +1850,7 @@ "id": "com.squareup.okio:okio-jvm", "name": "okio-jvm", "author": "Square, Inc.", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -2851,7 +2851,7 @@ "id": "it.krzeminski:snakeyaml-engine-kmp", "name": "snakeyaml-engine-kmp", "author": "it.krzeminski", - "url": "https://opensource.org/licenses/Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -2864,7 +2864,7 @@ "id": "it.krzeminski:snakeyaml-engine-kmp-jvm", "name": "snakeyaml-engine-kmp-jvm", "author": "it.krzeminski", - "url": "https://opensource.org/licenses/Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -3618,7 +3618,7 @@ "id": "org.jetbrains.kotlin:kotlin-stdlib-common", "name": "kotlin-stdlib-common", "author": "JetBrains s.r.o.", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -3631,7 +3631,7 @@ "id": "org.jetbrains.kotlin:kotlin-stdlib-jdk7", "name": "kotlin-stdlib-jdk7", "author": "JetBrains s.r.o.", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -3644,7 +3644,7 @@ "id": "org.jetbrains.kotlin:kotlin-stdlib-jdk8", "name": "kotlin-stdlib-jdk8", "author": "JetBrains s.r.o.", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -3930,7 +3930,7 @@ "id": "org.jspecify:jspecify", "name": "jspecify", "author": "JSpecify", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Transitive Android runtime dependency.", "distribution": "app", "license": "Apache-2.0", @@ -4008,7 +4008,7 @@ "id": "redis.clients:jedis", "name": "jedis", "author": "Redis Inc.", - "url": "https://github.com/redis/jedis/blob/master/LICENSE", + "url": "https://opensource.org/license/mit", "usage": "Server-side dependency; not shipped in the app.", "distribution": "server", "license": "MIT", @@ -4021,7 +4021,7 @@ "id": "software.amazon.awssdk:s3", "name": "s3", "author": "Amazon.com, Inc.", - "url": null, + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Server-side dependency; not shipped in the app.", "distribution": "server", "license": "Apache-2.0", @@ -4034,7 +4034,7 @@ "id": "software.amazon.awssdk:url-connection-client", "name": "url-connection-client", "author": "Amazon.com, Inc.", - "url": null, + "url": "https://www.apache.org/licenses/LICENSE-2.0.txt", "usage": "Server-side dependency; not shipped in the app.", "distribution": "server", "license": "Apache-2.0", diff --git a/tools/licensing/collect.py b/tools/licensing/collect.py index 6eba262..e0551d1 100644 --- a/tools/licensing/collect.py +++ b/tools/licensing/collect.py @@ -112,7 +112,15 @@ def privacy_asset(locale): "proprietary": "Proprietary", } +# One canonical URL per licence id: a POM's own URL string only existed when that +# POM happened to be in the local Gradle cache, so the catalogue changed by machine. LICENSE_URLS = { + "Apache-2.0": "https://www.apache.org/licenses/LICENSE-2.0.txt", + "MIT": "https://opensource.org/license/mit", + "BSD-2-Clause": "https://opensource.org/license/bsd-2-clause", + "BSD-3-Clause": "https://opensource.org/license/bsd-3-clause", + "EPL-1.0": "https://www.eclipse.org/legal/epl-v10.html", + "OFL-1.1": "https://openfontlicense.org/open-font-license-official-text/", "Android-SDK": "https://developer.android.com/studio/terms.html", "Play-Core-ToS": "https://developer.android.com/guide/playcore/in-app-review", "CC-BY-2.0-FR": "https://creativecommons.org/licenses/by/2.0/fr/", @@ -550,6 +558,7 @@ def _auto_component(module_id, version=None, scope="app"): author = _group_author(group) if licence: name = LICENSE_NAMES[licence] + url = LICENSE_URLS.get(licence) or url notice = None else: licence, name = raw_name or "unknown", raw_name or "Unknown licence" diff --git a/tools/licensing/collect_test.py b/tools/licensing/collect_test.py index 8dc826d..1a69fa4 100644 --- a/tools/licensing/collect_test.py +++ b/tools/licensing/collect_test.py @@ -62,6 +62,16 @@ def test_declared_modules_use_the_catalog_version(self): self.assertEqual(pinned["io.ktor:ktor-server-core"], pinned["io.ktor:ktor-client-mock"]) self.assertRegex(pinned["io.ktor:ktor-server-core"], r"^\d+\.\d+\.\d+$") + def test_known_licences_use_their_canonical_url(self): + # A POM's URL depends on the local Gradle cache; the canonical one does not. + curated = set(collect.CURATED_DEPS) | {c["id"] for c in collect.COMPONENTS} + drift = [ + c["id"] for c in _asset()["components"] + if c.get("license") in collect.LICENSE_URLS and c.get("url") != collect.LICENSE_URLS[c["license"]] + and c["id"] not in curated + ] + self.assertEqual(drift, [], f"entries not on their licence's canonical URL: {drift[:20]}") + def test_asset_is_in_lockstep_with_the_catalogue(self): self.assertEqual( _asset(), From cf2fae1b34dd46b4f803766abd95c746edc676e4 Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:40:54 +0100 Subject: [PATCH 2/8] fix(app): show a queued model download in the offline strip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tapping "Download model" in the offline strip queued the download (it waits for a connection) and hid the offer, so the strip showed only "No connection" and nothing said the tap had worked; the state lived only in Library > Offline. The strip now keeps one line for it, "Acoustic model · Waiting for Wi-Fi", with the same Use mobile data and Cancel controls. Reported by a tester on a Pixel 10a (2.5.4). --- .../kotlin/com/glosso/app/DownloadUi.kt | 17 +++++++++++++++++ .../kotlin/com/glosso/app/GlossoApp.kt | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/shared/src/commonMain/kotlin/com/glosso/app/DownloadUi.kt b/shared/src/commonMain/kotlin/com/glosso/app/DownloadUi.kt index 28c7705..0879e1f 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/DownloadUi.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/DownloadUi.kt @@ -69,6 +69,23 @@ internal fun downloadStatusText(item: DownloadItemState): String = when (item.st } } +/** + * One line for a download that is waiting, for the offline strip: there it can + * only be waiting for a connection, so a progress bar would say nothing. + */ +@Composable +internal fun PendingDownloadLine(item: DownloadItemState, modifier: Modifier = Modifier) { + Row(modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) { + Text( + "${item.title} · ${downloadStatusText(item)}", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + modifier = Modifier.weight(1f), + ) + DownloadControls(item) + } +} + /** A compact block for one active download, for the offline drawer. */ @Composable internal fun ActiveDownloadRow(item: DownloadItemState, modifier: Modifier = Modifier) { diff --git a/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt b/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt index f49f167..47dfc9e 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt @@ -1,5 +1,7 @@ package com.glosso.app +import com.glosso.app.download.DownloadIds +import com.glosso.app.download.LocalDownloader import com.glosso.app.platform.currentPlatformContext import com.glosso.app.platform.rememberConnectivity import com.glosso.app.platform.PlatformBackHandler @@ -246,6 +248,10 @@ fun GlossoApp() { val scorer by scoringVm.state.collectAsState() val offlineHintDismissed by OfflineModelHint.dismissed.collectAsState() val requestNotifications = rememberNotificationPermissionRequest() + val downloads by LocalDownloader.current.state.collectAsState() + // Started from the offline strip, the download waits for a connection; the + // strip keeps showing it so the tap visibly did something. + val modelDownload = downloads.item(DownloadIds.MODEL)?.takeIf { it.isActive } // The offline strip's offer is a one-time tip, not a loop: it only appears // while offline without the model, and never again once hidden or started. @@ -462,6 +468,11 @@ fun GlossoApp() { }, onHide = { OfflineModelHint.dismiss(context) }, ) + } else if (modelDownload != null) { + PendingDownloadLine( + modelDownload, + Modifier.padding(start = Space.gutter, end = Space.x4, bottom = Space.x4), + ) } } if (bottomBar) { From 6bd1327dfa303bad481632fe9c8353d5f694931c Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:40:54 +0100 Subject: [PATCH 3/8] fix(app): the latest lesson load wins refresh() and loadLessons() launched a new load on every language, level or server change without cancelling the one still running, so a slower response for the old language could land last and overwrite the new list. Each load now cancels the previous one, and a cancelled load stops before writing state (runCatching also caught the cancellation and served the offline fallback). --- .../kotlin/com/glosso/app/LessonViewModel.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/shared/src/commonMain/kotlin/com/glosso/app/LessonViewModel.kt b/shared/src/commonMain/kotlin/com/glosso/app/LessonViewModel.kt index ea92449..9ecef4f 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/LessonViewModel.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/LessonViewModel.kt @@ -29,6 +29,8 @@ import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.Job +import kotlinx.coroutines.ensureActive import kotlinx.coroutines.launch import org.jetbrains.compose.resources.getString @@ -177,6 +179,9 @@ data class LessonState( class LessonViewModel(private val services: AppServices) : ViewModel() { + private var refreshJob: Job? = null + private var lessonsJob: Job? = null + private val api = appApi private val profiles = ProfileStore.get(services.context) private val platform = platformInfo(services.context) @@ -275,9 +280,13 @@ class LessonViewModel(private val services: AppServices) : ViewModel() { * up without reinstalling. Falls back to downloaded packs when offline. */ fun refresh() { - viewModelScope.launch { + // Latest wins: a reload for the new language must not be overwritten by a + // slower one still running for the old language. + refreshJob?.cancel() + refreshJob = viewModelScope.launch { _state.value = _state.value.copy(loading = true, error = null) val manifest = runCatching { api.manifest() }.getOrNull() + ensureActive() if (manifest != null) { _state.value = _state.value.copy( levels = orderedLevels(manifest.levels), @@ -289,6 +298,7 @@ class LessonViewModel(private val services: AppServices) : ViewModel() { // no manifest at all): derive the levels from the whole lesson bank. if (_state.value.levels.isEmpty()) { val all = runCatching { api.lessons(limit = 200) }.getOrNull() + ensureActive() val derived = if (all != null) { orderedLevels(all.map { it.level }) } else { @@ -305,11 +315,12 @@ class LessonViewModel(private val services: AppServices) : ViewModel() { } fun loadLessons() { - viewModelScope.launch { + lessonsJob?.cancel() + lessonsJob = viewModelScope.launch { _state.value = _state.value.copy(loading = true, error = null) val level = _state.value.level val offlineIds = OfflineStore.state.value.downloadedIds - runCatching { api.lessons(level = level.takeIf { it != "ALL" }) } + runCatching { api.lessons(level = level.takeIf { it != "ALL" }) }.also { ensureActive() } .onSuccess { list -> _state.value = _state.value.copy( loading = false, From 0fefeb92793e992d9078c29bbf993f73c0e687bd Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:41:12 +0100 Subject: [PATCH 4/8] fix(app): count days by server-anchored time, and name a wrong device clock Streaks, "days since your last practice" and the week dots all read the device date, so changing the phone's clock back-dated practice, kept parallel streaks and showed "26746 days since your last practice". A tester on a Pixel 10a (2.5.4) reported it. - TrustedClock anchors to the server's Date header (read from real exchanges only, never a cache hit) and carries it forward with the monotonic clock, so a clock change while the app runs, online or offline, moves nothing. - With no anchor yet in a run, the device clock is used but never before the latest trusted time seen (persisted), so the day cannot go backwards. - A TLS failure on certificate dates proves the clock is wrong: time freezes at the last trusted moment, and load errors say the phone's date and time look wrong instead of blaming the server. Not covered: a clock moved forward after a reboot while offline, before any server contact, cannot be told from real time passing. --- .../java/com/glosso/app/GlossoApplication.kt | 1 + .../com/glosso/app/platform/Time.android.kt | 10 +- .../composeResources/values-de/strings.xml | 1 + .../composeResources/values-es/strings.xml | 1 + .../composeResources/values-fr/strings.xml | 1 + .../composeResources/values/strings.xml | 1 + .../kotlin/com/glosso/app/NetworkError.kt | 9 +- .../kotlin/com/glosso/app/TrustedClock.kt | 118 ++++++++++++++++++ .../kotlin/com/glosso/app/api/GlossoApi.kt | 20 +++ .../kotlin/com/glosso/app/platform/Time.kt | 11 +- .../kotlin/com/glosso/app/TrustedClockTest.kt | 64 ++++++++++ .../com/glosso/app/MainViewController.kt | 1 + .../com/glosso/app/platform/Time.ios.kt | 15 ++- .../wasmJsMain/kotlin/com/glosso/app/Main.kt | 1 + .../com/glosso/app/platform/Time.wasmJs.kt | 10 +- 15 files changed, 251 insertions(+), 13 deletions(-) create mode 100644 shared/src/commonMain/kotlin/com/glosso/app/TrustedClock.kt create mode 100644 shared/src/commonTest/kotlin/com/glosso/app/TrustedClockTest.kt diff --git a/androidApp/src/main/java/com/glosso/app/GlossoApplication.kt b/androidApp/src/main/java/com/glosso/app/GlossoApplication.kt index 8efdc7f..765cccf 100644 --- a/androidApp/src/main/java/com/glosso/app/GlossoApplication.kt +++ b/androidApp/src/main/java/com/glosso/app/GlossoApplication.kt @@ -36,6 +36,7 @@ class GlossoApplication : Application(), SingletonImageLoader.Factory { wireSharedCode() ServerPreferences.init(this, BuildConfig.API_BASE_URL) DeviceId.init(this) + TrustedClock.init(this) Analytics.init(this) CrashReporter.install(this) ApiCache.init(this) diff --git a/shared/src/androidMain/kotlin/com/glosso/app/platform/Time.android.kt b/shared/src/androidMain/kotlin/com/glosso/app/platform/Time.android.kt index cdedf5c..a2180bb 100644 --- a/shared/src/androidMain/kotlin/com/glosso/app/platform/Time.android.kt +++ b/shared/src/androidMain/kotlin/com/glosso/app/platform/Time.android.kt @@ -1,5 +1,11 @@ package com.glosso.app.platform -import java.time.LocalDate +import android.os.SystemClock +import java.time.Instant +import java.time.ZoneId -actual fun todayEpochDay(): Long = LocalDate.now().toEpochDay() +// Counts deep sleep too, so an anchored time stays right overnight. +actual fun monotonicMillis(): Long = SystemClock.elapsedRealtime() + +actual fun epochDayAt(epochMillis: Long): Long = + Instant.ofEpochMilli(epochMillis).atZone(ZoneId.systemDefault()).toLocalDate().toEpochDay() diff --git a/shared/src/commonMain/composeResources/values-de/strings.xml b/shared/src/commonMain/composeResources/values-de/strings.xml index eec654c..e2fdc35 100644 --- a/shared/src/commonMain/composeResources/values-de/strings.xml +++ b/shared/src/commonMain/composeResources/values-de/strings.xml @@ -10,6 +10,7 @@ Prüfe deine Verbindung und versuche es erneut. Offline. Prüfe deine Verbindung und versuche es erneut. Der Server ist nicht erreichbar. Versuche es gleich erneut. + Datum und Uhrzeit des Handys scheinen falsch zu sein, deshalb schlagen sichere Verbindungen fehl. Schalte automatisches Datum und Uhrzeit ein und versuche es erneut. Offline Du kannst ohne Verbindung weiterüben. Lade das Modell einmal herunter (etwa %1$s). Modell herunterladen diff --git a/shared/src/commonMain/composeResources/values-es/strings.xml b/shared/src/commonMain/composeResources/values-es/strings.xml index 898bacb..5f7d287 100644 --- a/shared/src/commonMain/composeResources/values-es/strings.xml +++ b/shared/src/commonMain/composeResources/values-es/strings.xml @@ -10,6 +10,7 @@ Mira tu conexión e inténtalo de nuevo. Sin conexión. Comprueba tu red e inténtalo de nuevo. No se pudo contactar con el servidor. Inténtalo en un momento. + La fecha y la hora del móvil parecen incorrectas, así que las conexiones seguras fallan. Activa la fecha y hora automáticas y vuelve a intentarlo. Sin conexión Puedes seguir practicando sin conexión. Descarga el modelo una vez (unos %1$s). Descargar modelo diff --git a/shared/src/commonMain/composeResources/values-fr/strings.xml b/shared/src/commonMain/composeResources/values-fr/strings.xml index 096da9b..56e0ac3 100644 --- a/shared/src/commonMain/composeResources/values-fr/strings.xml +++ b/shared/src/commonMain/composeResources/values-fr/strings.xml @@ -10,6 +10,7 @@ Vérifie ta connexion et réessaie. Hors ligne. Vérifie ton réseau et réessaie. Impossible de joindre le serveur. Réessaie dans un instant. + La date et l'heure du téléphone semblent incorrectes, donc les connexions sécurisées échouent. Active la date et l'heure automatiques, puis réessaie. Hors ligne Tu peux continuer à t'entraîner sans connexion. Télécharge le modèle une fois (environ %1$s). Télécharger le modèle diff --git a/shared/src/commonMain/composeResources/values/strings.xml b/shared/src/commonMain/composeResources/values/strings.xml index e926c3a..7d1b658 100644 --- a/shared/src/commonMain/composeResources/values/strings.xml +++ b/shared/src/commonMain/composeResources/values/strings.xml @@ -18,6 +18,7 @@ Check your connection and try again. No connection. Check your network and try again. Couldn't reach the server. Try again in a moment. + Your phone's date and time look wrong, so secure connections fail. Turn on automatic date and time, then try again. No connection You can keep practicing without a connection. Download the model once (about %1$s). Download model diff --git a/shared/src/commonMain/kotlin/com/glosso/app/NetworkError.kt b/shared/src/commonMain/kotlin/com/glosso/app/NetworkError.kt index 1fec329..085e1a6 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/NetworkError.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/NetworkError.kt @@ -6,9 +6,14 @@ import org.jetbrains.compose.resources.getString /** * The honest one-liner for a failed fetch: offline when there is no connection, - * a server problem otherwise. Keeps "no connection" copy from claiming a server + * the device clock when it is wrong (TLS rejects every certificate then), a + * server problem otherwise. Keeps "no connection" copy from claiming a server * error was the learner's network. */ suspend fun networkOrServerError(connectivity: Connectivity): String = getString( - if (connectivity.isOnline()) Res.string.error_server else Res.string.error_offline, + when { + !connectivity.isOnline() -> Res.string.error_offline + TrustedClock.deviceClockLooksWrong() -> Res.string.error_clock + else -> Res.string.error_server + }, ) diff --git a/shared/src/commonMain/kotlin/com/glosso/app/TrustedClock.kt b/shared/src/commonMain/kotlin/com/glosso/app/TrustedClock.kt new file mode 100644 index 0000000..3069d22 --- /dev/null +++ b/shared/src/commonMain/kotlin/com/glosso/app/TrustedClock.kt @@ -0,0 +1,118 @@ +package com.glosso.app + +import com.glosso.app.platform.KeyValueStore +import com.glosso.app.platform.PlatformContext +import com.glosso.app.platform.currentTimeMillis +import com.glosso.app.platform.keyValueStore +import com.glosso.app.platform.monotonicMillis +import kotlin.concurrent.Volatile + +/** + * The time the app counts days by. The device clock can be set to any date, which + * let a learner back-date practice, keep parallel streaks or read "26746 days + * since your last practice". The server's `Date` header anchors the time, and the + * monotonic clock (untouched by clock changes) carries it forward while offline. + * With no anchor yet in this run, the device clock is used, but never earlier than + * the latest trusted time seen, and not at all once the network has shown that + * the clock is wrong. + */ +object TrustedClock { + + private const val FILE = "glosso_trusted_clock" + private const val KEY_FLOOR = "floor_ms" + + /** A device clock this far from trusted time is wrong, not a time zone or drift. */ + const val WRONG_CLOCK_MS: Long = 24L * 60 * 60 * 1000 + + private class Anchor(val serverMillis: Long, val monotonic: Long) + + @Volatile + private var anchor: Anchor? = null + + @Volatile + private var floorMillis: Long = 0L + + /** A TLS failure on certificate dates: proof the device clock is off, with no server time to use. */ + @Volatile + private var certificateDateFailure = false + + private var store: KeyValueStore? = null + + fun init(context: PlatformContext) { + if (store != null) return + val loaded = keyValueStore(context, FILE) + store = loaded + floorMillis = maxOf(floorMillis, loaded.getString(KEY_FLOOR)?.toLongOrNull() ?: 0L) + } + + /** A server answered with its time: anchor to it, and raise the floor. */ + fun onServerTime(serverMillis: Long) { + anchor = Anchor(serverMillis, monotonicMillis()) + certificateDateFailure = false + if (serverMillis > floorMillis) { + floorMillis = serverMillis + store?.edit { putString(KEY_FLOOR, serverMillis.toString()) } + } + } + + /** A request failed; a certificate rejected on its dates means the device clock is wrong. */ + fun onNetworkFailure(error: Throwable) { + if (isCertificateDateFailure(error)) certificateDateFailure = true + } + + // The monotonic clock is read only with an anchor: nothing else needs it. + fun nowMillis(): Long = anchor.let { + trustedNow(it?.serverMillis, it?.monotonic, if (it != null) monotonicMillis() else 0, currentTimeMillis(), floorMillis, certificateDateFailure) + } + + /** True when the device clock is far enough off that network errors are the clock's doing. */ + fun deviceClockLooksWrong(): Boolean = anchor.let { + clockLooksWrong(it?.serverMillis, it?.monotonic, if (it != null) monotonicMillis() else 0, currentTimeMillis(), floorMillis, certificateDateFailure) + } + + /** + * The trusted time: the anchor carried forward by the monotonic clock when there + * is one; otherwise the device clock, but never before [floor], and the floor + * itself when certificates have shown the device clock is wrong. + */ + internal fun trustedNow( + anchorServer: Long?, + anchorMonotonic: Long?, + monotonic: Long, + device: Long, + floor: Long, + certificateDateFailure: Boolean, + ): Long = when { + anchorServer != null && anchorMonotonic != null -> anchorServer + (monotonic - anchorMonotonic).coerceAtLeast(0) + certificateDateFailure && floor > 0 -> floor + else -> maxOf(device, floor) + } + + internal fun clockLooksWrong( + anchorServer: Long?, + anchorMonotonic: Long?, + monotonic: Long, + device: Long, + floor: Long, + certificateDateFailure: Boolean, + ): Boolean { + if (certificateDateFailure) return true + if (anchorServer != null && anchorMonotonic != null) { + val trusted = trustedNow(anchorServer, anchorMonotonic, monotonic, device, floor, false) + return kotlin.math.abs(device - trusted) > WRONG_CLOCK_MS + } + return floor > 0 && device < floor - WRONG_CLOCK_MS + } + + /** + * The platform TLS errors for a certificate outside its validity dates: the JVM's + * CertificateExpired/NotYetValid exceptions, and URLSession's codes -1201 + * (bad date) and -1204 (not yet valid). + */ + internal fun isCertificateDateFailure(error: Throwable): Boolean = + generateSequence(error) { it.cause }.take(8).any { cause -> + val text = "${cause::class.simpleName} ${cause.message}" + listOf("CertificateExpired", "NotYetValid", "timestamp check failed", "BadDate", "-1201", "-1204") + .any { it in text } + } +} diff --git a/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt b/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt index 8929630..496062c 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt @@ -1,6 +1,7 @@ package com.glosso.app.api import com.glosso.app.CrashTrace +import com.glosso.app.TrustedClock import com.glosso.engine.model.ArticleModel import com.glosso.engine.model.ContentManifest import com.glosso.engine.model.DialogueModel @@ -17,11 +18,13 @@ import com.glosso.engine.model.localized import io.ktor.client.HttpClient import io.ktor.client.call.body import io.ktor.client.engine.HttpClientEngine +import io.ktor.client.plugins.HttpSend import io.ktor.client.plugins.HttpTimeout import io.ktor.client.plugins.cache.HttpCache import io.ktor.client.plugins.cache.storage.CacheStorage import io.ktor.client.plugins.contentnegotiation.ContentNegotiation import io.ktor.client.plugins.defaultRequest +import io.ktor.client.plugins.plugin import io.ktor.client.request.delete import io.ktor.client.request.get import io.ktor.client.request.headers @@ -33,6 +36,7 @@ import io.ktor.http.ContentType import io.ktor.http.HttpHeaders import io.ktor.http.HttpStatusCode import io.ktor.http.contentType +import io.ktor.http.fromHttpToGmtDate import io.ktor.http.isSuccess import io.ktor.serialization.kotlinx.json.json import kotlin.concurrent.Volatile @@ -214,6 +218,22 @@ class GlossoApi( install(HttpCache) { publicStorage(contentCache ?: CacheStorage.Disabled) } + }.also { client -> + // HttpSend sees only real exchanges, never a cache hit, so the Date header + // read here is the server's time now (TrustedClock counts days by it). + client.plugin(HttpSend).intercept { request -> + try { + execute(request).also { call -> + call.response.headers[HttpHeaders.Date]?.let { runCatching { it.fromHttpToGmtDate() }.getOrNull() } + ?.let { TrustedClock.onServerTime(it.timestamp) } + } + } catch (e: CancellationException) { + throw e + } catch (e: Throwable) { + TrustedClock.onNetworkFailure(e) + throw e + } + } } /** diff --git a/shared/src/commonMain/kotlin/com/glosso/app/platform/Time.kt b/shared/src/commonMain/kotlin/com/glosso/app/platform/Time.kt index 5d4eebd..f88c5f1 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/platform/Time.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/platform/Time.kt @@ -1,9 +1,16 @@ package com.glosso.app.platform +import com.glosso.app.TrustedClock import kotlin.time.Clock /** Milliseconds since the epoch, as `System.currentTimeMillis()`. */ fun currentTimeMillis(): Long = Clock.System.now().toEpochMilliseconds() -/** Today in the device's time zone as days since 1970-01-01, as `LocalDate.now().toEpochDay()`. */ -expect fun todayEpochDay(): Long +/** Milliseconds on a clock that only moves forward and ignores changes to the device clock. */ +expect fun monotonicMillis(): Long + +/** The day of [epochMillis] in the device's time zone, as days since 1970-01-01. */ +expect fun epochDayAt(epochMillis: Long): Long + +/** Today in the device's time zone as days since 1970-01-01, by [TrustedClock], not the device clock. */ +fun todayEpochDay(): Long = epochDayAt(TrustedClock.nowMillis()) diff --git a/shared/src/commonTest/kotlin/com/glosso/app/TrustedClockTest.kt b/shared/src/commonTest/kotlin/com/glosso/app/TrustedClockTest.kt new file mode 100644 index 0000000..b562be8 --- /dev/null +++ b/shared/src/commonTest/kotlin/com/glosso/app/TrustedClockTest.kt @@ -0,0 +1,64 @@ +package com.glosso.app + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class TrustedClockTest { + + private val day = 24L * 60 * 60 * 1000 + private val realNow = 1_795_000_000_000L // a date in 2026 + private val year2100 = 4_102_444_800_000L + + @Test + fun `an anchored time follows the monotonic clock whatever the device clock says`() { + val now = TrustedClock.trustedNow( + anchorServer = realNow, anchorMonotonic = 1_000, monotonic = 1_000 + day, + device = year2100, floor = realNow, certificateDateFailure = false, + ) + assertEquals(realNow + day, now) + } + + @Test + fun `without an anchor the day never goes back before the last trusted time`() { + val now = TrustedClock.trustedNow( + anchorServer = null, anchorMonotonic = null, monotonic = 5, + device = realNow - 30 * day, floor = realNow, certificateDateFailure = false, + ) + assertEquals(realNow, now) + } + + @Test + fun `without an anchor a sane device clock is used`() { + val now = TrustedClock.trustedNow(null, null, 5, realNow + day, realNow, false) + assertEquals(realNow + day, now) + } + + @Test + fun `a certificate rejected on its dates freezes time at the last trusted moment`() { + assertEquals(realNow, TrustedClock.trustedNow(null, null, 5, year2100, realNow, true)) + // A first run with no trusted time yet can only use the device clock. + assertEquals(year2100, TrustedClock.trustedNow(null, null, 5, year2100, 0, true)) + } + + @Test + fun `the clock looks wrong when it is a day away from the anchor or behind the floor`() { + assertTrue(TrustedClock.clockLooksWrong(realNow, 0, 0, year2100, realNow, false)) + assertFalse(TrustedClock.clockLooksWrong(realNow, 0, 0, realNow + 60_000, realNow, false)) + assertTrue(TrustedClock.clockLooksWrong(null, null, 0, realNow - 2 * day, realNow, false)) + assertFalse(TrustedClock.clockLooksWrong(null, null, 0, realNow + 2 * day, realNow, false)) + assertTrue(TrustedClock.clockLooksWrong(null, null, 0, realNow, realNow, true)) + } + + @Test + fun `certificate date failures are recognised through the cause chain`() { + val jvm = RuntimeException( + "Chain validation failed", + RuntimeException("timestamp check failed", RuntimeException("Certificate expired at Sat Feb 13 2027")), + ) + assertTrue(TrustedClock.isCertificateDateFailure(jvm)) + assertTrue(TrustedClock.isCertificateDateFailure(RuntimeException("NSURLErrorDomain Code=-1204"))) + assertFalse(TrustedClock.isCertificateDateFailure(RuntimeException("Unable to resolve host"))) + } +} diff --git a/shared/src/iosMain/kotlin/com/glosso/app/MainViewController.kt b/shared/src/iosMain/kotlin/com/glosso/app/MainViewController.kt index 97f98a4..0783180 100644 --- a/shared/src/iosMain/kotlin/com/glosso/app/MainViewController.kt +++ b/shared/src/iosMain/kotlin/com/glosso/app/MainViewController.kt @@ -100,6 +100,7 @@ private object IosHost { OfflineStore.downloader = downloader IosOnDeviceScorer.init(downloader) DeviceId.init(context) + TrustedClock.init(context) ApiCache.init(context) OfflineStore.init(context) ProductConfigRepository.init(context) diff --git a/shared/src/iosMain/kotlin/com/glosso/app/platform/Time.ios.kt b/shared/src/iosMain/kotlin/com/glosso/app/platform/Time.ios.kt index 5727668..caf3569 100644 --- a/shared/src/iosMain/kotlin/com/glosso/app/platform/Time.ios.kt +++ b/shared/src/iosMain/kotlin/com/glosso/app/platform/Time.ios.kt @@ -1,12 +1,19 @@ package com.glosso.app.platform +import kotlinx.cinterop.ExperimentalForeignApi import platform.Foundation.NSDate import platform.Foundation.NSTimeZone +import platform.Foundation.dateWithTimeIntervalSince1970 import platform.Foundation.localTimeZone -import platform.Foundation.timeIntervalSince1970 +import platform.posix.CLOCK_MONOTONIC +import platform.posix.clock_gettime_nsec_np -actual fun todayEpochDay(): Long { - val now = NSDate() - val localSeconds = now.timeIntervalSince1970.toLong() + NSTimeZone.localTimeZone.secondsFromGMTForDate(now) +// Darwin's CLOCK_MONOTONIC keeps counting while the device sleeps. +@OptIn(ExperimentalForeignApi::class) +actual fun monotonicMillis(): Long = (clock_gettime_nsec_np(CLOCK_MONOTONIC.toUInt()) / 1_000_000uL).toLong() + +actual fun epochDayAt(epochMillis: Long): Long { + val date = NSDate.dateWithTimeIntervalSince1970(epochMillis / 1000.0) + val localSeconds = epochMillis / 1000 + NSTimeZone.localTimeZone.secondsFromGMTForDate(date) return localSeconds.floorDiv(86_400L) } diff --git a/shared/src/wasmJsMain/kotlin/com/glosso/app/Main.kt b/shared/src/wasmJsMain/kotlin/com/glosso/app/Main.kt index 363c4a2..91f0d7b 100644 --- a/shared/src/wasmJsMain/kotlin/com/glosso/app/Main.kt +++ b/shared/src/wasmJsMain/kotlin/com/glosso/app/Main.kt @@ -89,6 +89,7 @@ private fun wire(): AppServices { ProductConfigRepository.api = { appApi } OfflineStore.downloader = NoDownloader DeviceId.init(context) + TrustedClock.init(context) ApiCache.init(context) OfflineStore.init(context) ProductConfigRepository.init(context) diff --git a/shared/src/wasmJsMain/kotlin/com/glosso/app/platform/Time.wasmJs.kt b/shared/src/wasmJsMain/kotlin/com/glosso/app/platform/Time.wasmJs.kt index d166e58..236686e 100644 --- a/shared/src/wasmJsMain/kotlin/com/glosso/app/platform/Time.wasmJs.kt +++ b/shared/src/wasmJsMain/kotlin/com/glosso/app/platform/Time.wasmJs.kt @@ -1,6 +1,10 @@ package com.glosso.app.platform -actual fun todayEpochDay(): Long = localEpochDay().toLong() +actual fun monotonicMillis(): Long = performanceNow().toLong() -private fun localEpochDay(): Double = - js("Math.floor((Date.now() - new Date().getTimezoneOffset() * 60000) / 86400000)") +actual fun epochDayAt(epochMillis: Long): Long = localEpochDay(epochMillis.toDouble()).toLong() + +private fun performanceNow(): Double = js("performance.now()") + +private fun localEpochDay(epochMillis: Double): Double = + js("Math.floor((epochMillis - new Date(epochMillis).getTimezoneOffset() * 60000) / 86400000)") From 3fc2e3eb37121aa3c8496ebbb4f62fa965401fb6 Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:44:57 +0100 Subject: [PATCH 5/8] build(fdroid): prepare 2.5.5 (2227) as the first F-Droid release - Version 2.5.5 / 2227, with a changelog in the four store locales. The 2226 changelog already said "First F-Droid release", but the recipe was never submitted, so 2227 carries that text plus this release's fixes. - Recipe: turn the web target off (glosso.web=false) and delete the committed stb_vorbis.wasm before building. `fdroid scanner` flags that WebAssembly binary; the Android app never uses it, and the web target would also pull the Kotlin/Wasm toolchain (a prebuilt Node) into the build. - docs/FDROID.md: why, and the release checklist that was run for this version (fdroid readmeta and lint against fdroiddata's config, a fresh-clone build of the fdroid flavor with the recipe's settings, and the scanner on the source and the APK). Nothing is tagged or submitted. --- androidApp/build.gradle.kts | 5 ++-- docs/FDROID.md | 30 +++++++++++++++++++ .../android/de-DE/changelogs/2227.txt | 6 ++++ .../android/en-US/changelogs/2227.txt | 6 ++++ .../android/es-ES/changelogs/2227.txt | 6 ++++ .../android/fr-FR/changelogs/2227.txt | 6 ++++ metadata/me.shirobyte42.glosso.yml | 13 ++++---- 7 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 fastlane/metadata/android/de-DE/changelogs/2227.txt create mode 100644 fastlane/metadata/android/en-US/changelogs/2227.txt create mode 100644 fastlane/metadata/android/es-ES/changelogs/2227.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/2227.txt diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 338e90b..ba14d6e 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -43,7 +43,7 @@ android { } val releaseSigning = if (hasReleaseKeystore) signingConfigs.getByName("release") else null - val baseVersionName = "2.5.4" + val baseVersionName = "2.5.5" defaultConfig { applicationId = "me.shirobyte42.glosso" @@ -58,7 +58,8 @@ android { // 2222 is 2.5.0: American English, "Your turn" and spaced review. // 2223 is 2.5.1: Russian A1 rewritten from Russian culture. // 2226 is 2.5.4: the v2 usage statistics and crash reports. - versionCode = 2226 + // 2227 is 2.5.5: the first F-Droid release; server-anchored time for streaks. + versionCode = 2227 versionName = baseVersionName testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/docs/FDROID.md b/docs/FDROID.md index f50f2b5..36cc7a8 100644 --- a/docs/FDROID.md +++ b/docs/FDROID.md @@ -89,6 +89,14 @@ The only binary in git is `gradle/wrapper/gradle-wrapper.jar`, which the scanner removes on its own. Repositories are only `google()`, `mavenCentral()` and the Gradle plugin portal. The model, vocabulary and content are gitignored. +**The web app's binaries.** The repository also holds the web app (`docs/WEB.md`), +whose Ogg decoder is a committed WebAssembly build of the vendored stb_vorbis +(`shared/src/wasmJsMain/resources/stb_vorbis.wasm`, built from source by +`shared/src/nativeInterop/stb_vorbis/build-wasm.sh`). `fdroid scanner` flags it +as a binary. The Android app never uses it, so the recipe deletes it (`rm:`) and +turns the web target off (`glosso.web=false`), which also keeps the Kotlin/Wasm +toolchain (a prebuilt Node download) out of the F-Droid build. + **Self-updater.** None. The server's version policy is only a dismissible notice with no link and no download. @@ -123,3 +131,25 @@ ones `tools/fetch-assets.sh` downloads. Lesson packs are not importable: they are fetched per lesson from the content manifest and have no file format of their own yet. + +## Releasing a version to F-Droid + +Checked for 2.5.5 (2227) on 2026-11-22: the steps below passed locally. + +1. Bump `baseVersionName` and `versionCode` in `androidApp/build.gradle.kts`, add + `fastlane/metadata/android//changelogs/.txt` (max 500 + characters) for every locale, and set the same version in the recipe's build + entry, `CurrentVersion` and `CurrentVersionCode`. +2. Check the recipe and the build the way F-Droid runs them: + - `fdroid readmeta` and `fdroid lint me.shirobyte42.glosso` in a directory with + the recipe under `metadata/` and fdroiddata's `config/` (sparse clone of + https://gitlab.com/fdroid/fdroiddata). + - From a fresh clone of the tagged commit, delete the `rm:` paths, then + `ANDROID_HOME=... ./gradlew :androidApp:assembleFdroidRelease -Pglosso.ios=false -Pglosso.web=false`. + - `fdroid scanner --exit-code` on that APK, and the scanner's `scan_source` on + the clone: the only source finding is the `rm:`'d `stb_vorbis.wasm`. +3. Tag the release commit `v` and push the tag. F-Droid builds from + tags (`UpdateCheckMode: Tags`), and the recipe's `commit:` is the tag. +4. First submission only: open the merge request to fdroiddata with + `metadata/me.shirobyte42.glosso.yml`. Later versions are picked up from new + tags (`AutoUpdateMode: Version`). diff --git a/fastlane/metadata/android/de-DE/changelogs/2227.txt b/fastlane/metadata/android/de-DE/changelogs/2227.txt new file mode 100644 index 0000000..ec4ade3 --- /dev/null +++ b/fastlane/metadata/android/de-DE/changelogs/2227.txt @@ -0,0 +1,6 @@ +Erste Version auf F-Droid. +- Ohne Google-Bibliotheken: keine Play-Dienste und keine Google-Anmeldung („Handy wechseln" ist nicht verfügbar). +- Nutzungsstatistiken sind zunächst aus; schalte sie in den Einstellungen ein. +- Importiere das Offline-Bewertungsmodell aus einer Datei, vor der Installation geprüft. +- Serien und Tage zählen nach der Serverzeit, nicht nach der Uhr des Handys. +- Ein offline gestarteter Modell-Download zeigt jetzt, dass er wartet. diff --git a/fastlane/metadata/android/en-US/changelogs/2227.txt b/fastlane/metadata/android/en-US/changelogs/2227.txt new file mode 100644 index 0000000..e1815ed --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/2227.txt @@ -0,0 +1,6 @@ +First F-Droid release. +- No Google libraries: no Play services or Google sign-in ("Change phone" is not available). +- Usage statistics start off; turn them on in Settings. +- Import the offline scoring model from a file, verified before install. +- Streaks and days count by the server's time, not the phone's clock. +- A model download started offline now shows that it is waiting. diff --git a/fastlane/metadata/android/es-ES/changelogs/2227.txt b/fastlane/metadata/android/es-ES/changelogs/2227.txt new file mode 100644 index 0000000..0891ead --- /dev/null +++ b/fastlane/metadata/android/es-ES/changelogs/2227.txt @@ -0,0 +1,6 @@ +Primera versión en F-Droid. +- Sin bibliotecas de Google: sin servicios de Play ni inicio de sesión con Google ("Cambiar de móvil" no está disponible). +- Las estadísticas de uso empiezan desactivadas; actívalas en Ajustes. +- Importa el modelo de puntuación sin conexión desde un archivo, verificado antes de instalarlo. +- Las rachas y los días se cuentan con la hora del servidor, no con el reloj del móvil. +- Una descarga del modelo iniciada sin conexión ahora muestra que está esperando. diff --git a/fastlane/metadata/android/fr-FR/changelogs/2227.txt b/fastlane/metadata/android/fr-FR/changelogs/2227.txt new file mode 100644 index 0000000..596e6eb --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/2227.txt @@ -0,0 +1,6 @@ +Première version sur F-Droid. +- Sans bibliothèques Google : pas de services Play ni de connexion Google (« Changer de téléphone » n'est pas disponible). +- Les statistiques d'utilisation sont désactivées au départ ; activez-les dans les Réglages. +- Importez le modèle d'évaluation hors ligne depuis un fichier, vérifié avant installation. +- Les séries et les jours suivent l'heure du serveur, pas l'horloge du téléphone. +- Un téléchargement du modèle lancé hors ligne indique maintenant qu'il attend. diff --git a/metadata/me.shirobyte42.glosso.yml b/metadata/me.shirobyte42.glosso.yml index ab1be64..2a4c705 100644 --- a/metadata/me.shirobyte42.glosso.yml +++ b/metadata/me.shirobyte42.glosso.yml @@ -17,16 +17,19 @@ RepoType: git Repo: https://github.com/IgnacioLD/glosso.git Builds: - - versionName: 2.5.4 - versionCode: 2226 - commit: v2.5.4 + - versionName: 2.5.5 + versionCode: 2227 + commit: v2.5.5 subdir: androidApp + rm: + - shared/src/wasmJsMain/resources/stb_vorbis.wasm gradle: - fdroid gradleprops: - glosso.ios=false + - glosso.web=false AutoUpdateMode: Version UpdateCheckMode: Tags -CurrentVersion: 2.5.4 -CurrentVersionCode: 2226 +CurrentVersion: 2.5.5 +CurrentVersionCode: 2227 From e4955dfa5b5badb5e6c5ca5bf654ebeb0f7b1394 Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Tue, 24 Nov 2026 04:33:32 +0100 Subject: [PATCH 6/8] fix(app): smooth onboarding and keep every language control in sync --- androidApp/build.gradle.kts | 1 + .../metadata/android/de-DE/changelogs/2227.txt | 15 +++++++++------ .../metadata/android/en-US/changelogs/2227.txt | 13 ++++++++----- .../metadata/android/es-ES/changelogs/2227.txt | 15 +++++++++------ .../metadata/android/fr-FR/changelogs/2227.txt | 15 +++++++++------ .../kotlin/com/glosso/app/CourseSwitcher.kt | 3 ++- .../commonMain/kotlin/com/glosso/app/GlossoApp.kt | 8 ++++---- .../kotlin/com/glosso/app/LessonsScreen.kt | 2 ++ .../kotlin/com/glosso/app/OnboardingScreen.kt | 12 ++++++++---- .../kotlin/com/glosso/app/SettingsScreen.kt | 3 +-- 10 files changed, 53 insertions(+), 34 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index da964fc..47c5c8f 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -58,6 +58,7 @@ android { // 2222 is 2.5.0: American English, "Your turn" and spaced review. // 2223 is 2.5.1: Russian A1 rewritten from Russian culture. // 2226 is 2.5.4: the v2 usage statistics and crash reports. + // 2227 is 2.5.5: Spanish, the course switcher and the first F-Droid build. // 2227 is 2.5.5: the first F-Droid release; server-anchored time for streaks. versionCode = 2227 versionName = baseVersionName diff --git a/fastlane/metadata/android/de-DE/changelogs/2227.txt b/fastlane/metadata/android/de-DE/changelogs/2227.txt index ec4ade3..56641a6 100644 --- a/fastlane/metadata/android/de-DE/changelogs/2227.txt +++ b/fastlane/metadata/android/de-DE/changelogs/2227.txt @@ -1,6 +1,9 @@ -Erste Version auf F-Droid. -- Ohne Google-Bibliotheken: keine Play-Dienste und keine Google-Anmeldung („Handy wechseln" ist nicht verfügbar). -- Nutzungsstatistiken sind zunächst aus; schalte sie in den Einstellungen ein. -- Importiere das Offline-Bewertungsmodell aus einer Datei, vor der Installation geprüft. -- Serien und Tage zählen nach der Serverzeit, nicht nach der Uhr des Handys. -- Ein offline gestarteter Modell-Download zeigt jetzt, dass er wartet. +- Neu: Spanisch lernen (experimentell) und ein umfangreicherer Russischkurs. +- Kurs mit einem Tipp unter Heute oder Lektionen wechseln. +- Freies Üben ist jetzt unter Heute. +- Das Üben konzentriert sich auf deine schwierigsten Laute. +- Klarere Korrekturen und gemischte Antworten. +- Jede Sprache steht unter ihrem eigenen Namen. +- Flüssigerer Startbildschirm. +- Serien zählen nach Serverzeit, nicht nach der Handyuhr. +- Ein Download ohne Verbindung zeigt nun, dass er wartet. diff --git a/fastlane/metadata/android/en-US/changelogs/2227.txt b/fastlane/metadata/android/en-US/changelogs/2227.txt index e1815ed..68849b1 100644 --- a/fastlane/metadata/android/en-US/changelogs/2227.txt +++ b/fastlane/metadata/android/en-US/changelogs/2227.txt @@ -1,6 +1,9 @@ -First F-Droid release. -- No Google libraries: no Play services or Google sign-in ("Change phone" is not available). -- Usage statistics start off; turn them on in Settings. -- Import the offline scoring model from a file, verified before install. -- Streaks and days count by the server's time, not the phone's clock. +- New: learn Spanish (experimental), and a fuller Russian course. +- Switch course in one tap from Today or Lessons. +- Free practice is now on Today. +- Practice focuses on the sounds you miss most. +- Clearer corrections and shuffled answers. +- Each language appears under its own name. +- Smoother first-run screen. +- Streaks count by the server's time, not the phone's clock. - A model download started offline now shows that it is waiting. diff --git a/fastlane/metadata/android/es-ES/changelogs/2227.txt b/fastlane/metadata/android/es-ES/changelogs/2227.txt index 0891ead..2e6bc7e 100644 --- a/fastlane/metadata/android/es-ES/changelogs/2227.txt +++ b/fastlane/metadata/android/es-ES/changelogs/2227.txt @@ -1,6 +1,9 @@ -Primera versión en F-Droid. -- Sin bibliotecas de Google: sin servicios de Play ni inicio de sesión con Google ("Cambiar de móvil" no está disponible). -- Las estadísticas de uso empiezan desactivadas; actívalas en Ajustes. -- Importa el modelo de puntuación sin conexión desde un archivo, verificado antes de instalarlo. -- Las rachas y los días se cuentan con la hora del servidor, no con el reloj del móvil. -- Una descarga del modelo iniciada sin conexión ahora muestra que está esperando. +- Nuevo: aprende español (experimental) y un curso de ruso más completo. +- Cambia de curso con un toque desde Hoy o Lecciones. +- La práctica libre ahora está en Hoy. +- La práctica se centra en los sonidos que más fallas. +- Correcciones más claras y respuestas barajadas. +- Cada idioma aparece con su propio nombre. +- Pantalla de bienvenida más fluida. +- Las rachas usan la hora del servidor, no la del móvil. +- Una descarga del modelo sin conexión ahora indica que está esperando. diff --git a/fastlane/metadata/android/fr-FR/changelogs/2227.txt b/fastlane/metadata/android/fr-FR/changelogs/2227.txt index 596e6eb..672f499 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/2227.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/2227.txt @@ -1,6 +1,9 @@ -Première version sur F-Droid. -- Sans bibliothèques Google : pas de services Play ni de connexion Google (« Changer de téléphone » n'est pas disponible). -- Les statistiques d'utilisation sont désactivées au départ ; activez-les dans les Réglages. -- Importez le modèle d'évaluation hors ligne depuis un fichier, vérifié avant installation. -- Les séries et les jours suivent l'heure du serveur, pas l'horloge du téléphone. -- Un téléchargement du modèle lancé hors ligne indique maintenant qu'il attend. +- Nouveau : apprenez l'espagnol (expérimental), et un cours de russe plus complet. +- Changez de cours en un geste depuis Aujourd'hui ou Leçons. +- La pratique libre est maintenant sur Aujourd'hui. +- La pratique cible les sons que vous ratez le plus. +- Corrections plus claires et réponses mélangées. +- Chaque langue apparaît sous son propre nom. +- Écran d'accueil plus fluide. +- Les séries suivent l'heure du serveur, pas celle du téléphone. +- Un téléchargement hors ligne indique son attente. diff --git a/shared/src/commonMain/kotlin/com/glosso/app/CourseSwitcher.kt b/shared/src/commonMain/kotlin/com/glosso/app/CourseSwitcher.kt index b035de1..53a6718 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/CourseSwitcher.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/CourseSwitcher.kt @@ -44,8 +44,9 @@ import org.jetbrains.compose.resources.stringResource internal fun switchCourse(pack: LanguagePack) { if (pack.code == LanguagePreferences.code.value) return UsageEvents.settingChanged("target_language", pack.code) - LanguagePreferences.set(pack.code) + // Voice first: setting the language wakes the loaders, which read the accent. VoicePreferences.onLanguageChanged(pack) + LanguagePreferences.set(pack.code) } /** diff --git a/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt b/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt index 16da7b0..6897891 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/GlossoApp.kt @@ -365,7 +365,8 @@ fun GlossoApp() { // A wide window (a tablet, a desktop browser) gets the tabs as a side rail // and the screens at a phone's reading width, centred. - BoxWithConstraints(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) { + // Not composed behind the welcome: it would redraw and reload on every language tap. + if (onboardingDone) BoxWithConstraints(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) { val wide = maxWidth >= Sizes.wideLayout val bottomBar = showBar && !wide Row(Modifier.fillMaxSize()) { @@ -488,12 +489,11 @@ fun GlossoApp() { AchievementOverlay(modifier = Modifier.align(Alignment.TopCenter)) } - // First run only: the short welcome, over the course, until it is dismissed. - // The guard keeps a tap on its empty areas from reaching the app behind. + // First run only: the short welcome, until it is dismissed. if (!onboardingDone) { TrackScreen("onboarding") Box( - Modifier.fillMaxSize().consumePointerEvents().background(MaterialTheme.colorScheme.background), + Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background), contentAlignment = Alignment.TopCenter, ) { Box(Modifier.widthIn(max = Sizes.contentMaxWidth)) { diff --git a/shared/src/commonMain/kotlin/com/glosso/app/LessonsScreen.kt b/shared/src/commonMain/kotlin/com/glosso/app/LessonsScreen.kt index d32923d..dce85cc 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/LessonsScreen.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/LessonsScreen.kt @@ -174,6 +174,8 @@ fun LessonsScreen( Row(verticalAlignment = Alignment.CenterVertically) { StreakChip(days = progress.shownDailyStreak()) Spacer(Modifier.width(Space.x12)) + CourseSwitcher() + Spacer(Modifier.width(Space.x12)) LevelButton( level = state.level, pickable = state.levels.size > 1, diff --git a/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt b/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt index e4152e3..1a84f0a 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/OnboardingScreen.kt @@ -56,6 +56,8 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.draw.clip import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.geometry.Offset @@ -99,7 +101,7 @@ fun OnboardingScreen(onFinish: () -> Unit) { val requestNotifications = rememberNotificationPermissionRequest() var page by remember { mutableIntStateOf(0) } - var targetLanguage by remember { mutableStateOf(LanguagePreferences.current.code) } + val targetLanguage by LanguagePreferences.code.collectAsState() // Usage statistics: once per onboarding, and whether it ended by the start // button after the seed or by one of the skips. @@ -216,10 +218,8 @@ fun OnboardingScreen(onFinish: () -> Unit) { 0 -> PromisePage( targetLanguage = targetLanguage, onTargetLanguage = { code -> - LanguagePreferences.set(code) - OfferedLanguages.orNull(code)?.let { VoicePreferences.onLanguageChanged(it) } + OfferedLanguages.orNull(code)?.let(::switchCourse) ProfileStore.get(context).setLanguage(code) - targetLanguage = code }, ) @@ -258,11 +258,15 @@ private fun PromisePage( onTargetLanguage: (String) -> Unit, ) { val scroll = rememberScrollState() + // Never shrinks: a course without accents would otherwise pull the list out from under the finger. + var tallest by remember { mutableIntStateOf(0) } Column( modifier = Modifier .fillMaxSize() .scrollEdgeFade(scroll) .verticalScroll(scroll) + .onSizeChanged { tallest = maxOf(tallest, it.height) } + .heightIn(min = with(LocalDensity.current) { tallest.toDp() }) .padding(horizontal = Space.gutter) .padding(top = Space.x24), ) { diff --git a/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt b/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt index f76e370..d88c53b 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/SettingsScreen.kt @@ -68,7 +68,7 @@ import org.jetbrains.compose.resources.stringResource @Composable fun SettingsScreen(onBack: () -> Unit, vm: ScoringViewModel = scoringViewModel()) { - var language by remember { mutableStateOf(LanguagePreferences.current.code) } + val language by LanguagePreferences.code.collectAsState() val pack = LanguagePacks.byCode(language) var accent by remember(language) { mutableStateOf(VoicePreferences.accent) } val scorer by vm.state.collectAsState() @@ -151,7 +151,6 @@ fun SettingsScreen(onBack: () -> Unit, vm: ScoringViewModel = scoringViewModel() onSelect = { code -> OfferedLanguages.orNull(code)?.takeIf { it.code != language }?.let { newPack -> switchCourse(newPack) - language = newPack.code accent = VoicePreferences.accent } }, From 54e004af196f340494a54242641d880aec5c0a21 Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Tue, 24 Nov 2026 04:49:20 +0100 Subject: [PATCH 7/8] fix(scoring): busy server is retried, not reported offline; onboarding follows the course --- deploy/.env.example | 3 +- deploy/docker-compose.yml | 3 +- docs/DEPLOYMENT.md | 3 +- .../kotlin/com/glosso/server/Application.kt | 36 +++++------ .../kotlin/com/glosso/server/InferenceGate.kt | 35 +++++++++++ .../com/glosso/server/InferenceGateTest.kt | 33 ++++++++++ shared/build.gradle.kts | 1 + .../com/glosso/app/OnboardingViewModel.kt | 46 +++++++------- .../kotlin/com/glosso/app/PracticeEngine.kt | 14 ++++- .../kotlin/com/glosso/app/api/GlossoApi.kt | 42 ++++++++++--- .../com/glosso/app/api/ScoreRetryTest.kt | 63 +++++++++++++++++++ 11 files changed, 223 insertions(+), 56 deletions(-) create mode 100644 server/src/main/kotlin/com/glosso/server/InferenceGate.kt create mode 100644 server/src/test/kotlin/com/glosso/server/InferenceGateTest.kt create mode 100644 shared/src/commonTest/kotlin/com/glosso/app/api/ScoreRetryTest.kt diff --git a/deploy/.env.example b/deploy/.env.example index 3508880..c583969 100644 --- a/deploy/.env.example +++ b/deploy/.env.example @@ -84,7 +84,8 @@ GLOSSO_ASSET_CHECKSUMS= # Reconocimientos simultaneos (2 vCPU: no subir de 1-2). GLOSSO_MAX_CONCURRENT=1 # Espera maxima en cola antes de devolver 503 (ms). -GLOSSO_QUEUE_WAIT_MS=30000 +GLOSSO_QUEUE_WAIT_MS=12000 +GLOSSO_MAX_QUEUED=8 # 1 = logs del engine (fonemas). Dejar vacio en produccion. GLOSSO_DEBUG= # Origenes CORS permitidos para web, separados por coma. Vacio = sin CORS. diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 0552ab2..eb870e9 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -112,7 +112,8 @@ services: GLOSSO_INGEST_TOKEN: ${GLOSSO_INGEST_TOKEN:-} GLOSSO_BOOTSTRAP: ${GLOSSO_BOOTSTRAP:-} GLOSSO_MAX_CONCURRENT: ${GLOSSO_MAX_CONCURRENT:-1} - GLOSSO_QUEUE_WAIT_MS: ${GLOSSO_QUEUE_WAIT_MS:-30000} + GLOSSO_QUEUE_WAIT_MS: ${GLOSSO_QUEUE_WAIT_MS:-12000} + GLOSSO_MAX_QUEUED: ${GLOSSO_MAX_QUEUED:-8} GLOSSO_DEBUG: ${GLOSSO_DEBUG:-} GLOSSO_ANALYTICS_RETENTION_DAYS: ${GLOSSO_ANALYTICS_RETENTION_DAYS:-180} # Copia de los eventos de la app en umami (docs/ANALYTICS-BETA.md). Vacio diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index 726cd8a..3bfbb00 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -66,7 +66,8 @@ sudo systemctl enable --now glosso-server | `GLOSSO_ASSETS_DIR` | `data/assets` | Carpeta de assets estaticos | | `GLOSSO_BOOTSTRAP` | (vacio) | `1` descarga modelo/vocab/CMUdict en el primer arranque | | `GLOSSO_MAX_CONCURRENT` | `1` | Reconocimientos simultaneos admitidos | -| `GLOSSO_QUEUE_WAIT_MS` | `30000` | Espera maxima en cola antes de devolver 503 | +| `GLOSSO_QUEUE_WAIT_MS` | `12000` | Espera maxima en cola antes de devolver 503; menor que el timeout de puntuacion de la app (30 s) | +| `GLOSSO_MAX_QUEUED` | `8` | Puntuaciones en espera como maximo; con la cola llena el servidor responde 503 al instante y la app reintenta | | `GLOSSO_DEBUG` | (vacio) | `1` activa logs del engine (fonemas) | | `GLOSSO_ADMIN_TOKEN` | (vacio) | Token que protege `/metrics`, `/stats` y las vistas de analitica. Sin el, cerrados | | `GLOSSO_API_KEY` | (vacio) | Credencial de cliente (`X-Api-Key`) que protege `/v1/score`. Sin ella, scoring abierto (dev/emulador). **No definir en produccion hasta que la app envie la cabecera** | diff --git a/server/src/main/kotlin/com/glosso/server/Application.kt b/server/src/main/kotlin/com/glosso/server/Application.kt index a181403..1640bd5 100644 --- a/server/src/main/kotlin/com/glosso/server/Application.kt +++ b/server/src/main/kotlin/com/glosso/server/Application.kt @@ -51,9 +51,7 @@ import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancel import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import kotlinx.coroutines.sync.Semaphore import kotlinx.coroutines.withContext -import kotlinx.coroutines.withTimeoutOrNull import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonArray import kotlinx.serialization.json.JsonElement @@ -728,10 +726,14 @@ fun Application.module( // test shows the host benefits from it. val maxConcurrent = System.getenv("GLOSSO_MAX_CONCURRENT")?.toIntOrNull()?.coerceAtLeast(1) ?: 1 - val queueWaitMs = System.getenv("GLOSSO_QUEUE_WAIT_MS")?.toLongOrNull() ?: 30_000L - val inferenceSlots = Semaphore(maxConcurrent) + // Below the app's 30 s score timeout minus a slow inference, so a busy server + // answers 503 (the app retries) instead of the phone timing out mid-wait. + val queueWaitMs = System.getenv("GLOSSO_QUEUE_WAIT_MS")?.toLongOrNull() ?: 12_000L + // Beyond this many waiting takes the server answers 503 at once (the app retries). + val maxQueued = System.getenv("GLOSSO_MAX_QUEUED")?.toIntOrNull()?.coerceAtLeast(0) ?: 8 + val inferenceGate = InferenceGate(maxConcurrent, maxQueued, queueWaitMs) val inFlight = AtomicInteger(0) - logger.info { "Inference gate: maxConcurrent=$maxConcurrent, queueWaitMs=$queueWaitMs" } + logger.info { "Inference gate: maxConcurrent=$maxConcurrent, maxQueued=$maxQueued, queueWaitMs=$queueWaitMs" } // First-party analytics: the store the caller passed (the production // overload builds it from the environment); null disables it cleanly. @@ -1297,10 +1299,7 @@ fun Application.module( // Suspend while waiting for a slot; never block a thread, or the // dispatcher starves and inference collapses. - val admitted = withTimeoutOrNull(queueWaitMs) { - inferenceSlots.acquire() - true - } ?: false + val admitted = inferenceGate.admit() if (!admitted) { scoreBusy.increment() call.response.header(HttpHeaders.RetryAfter, "2") @@ -1334,7 +1333,7 @@ fun Application.module( analysis.recognition.ipa } finally { inFlight.decrementAndGet() - inferenceSlots.release() + inferenceGate.release() } } else if (!request.actualIpa.isNullOrBlank()) { request.actualIpa @@ -1474,10 +1473,7 @@ fun Application.module( ErrorResponse("Recognition model is not ready"), ) } - val admitted = withTimeoutOrNull(queueWaitMs) { - inferenceSlots.acquire() - true - } ?: false + val admitted = inferenceGate.admit() if (!admitted) { scoreBusy.increment() call.response.header(HttpHeaders.RetryAfter, "2") @@ -1491,7 +1487,7 @@ fun Application.module( withContext(Dispatchers.Default) { recognizer.recognize(request.audioBase64) } } finally { inFlight.decrementAndGet() - inferenceSlots.release() + inferenceGate.release() } if (ipa.isNullOrBlank()) { scoreError.increment() @@ -1550,10 +1546,7 @@ fun Application.module( ErrorResponse("Recognition model is not ready"), ) } - val admitted = withTimeoutOrNull(queueWaitMs) { - inferenceSlots.acquire() - true - } ?: false + val admitted = inferenceGate.admit() if (!admitted) { scoreBusy.increment() call.response.header(HttpHeaders.RetryAfter, "2") @@ -1567,7 +1560,7 @@ fun Application.module( withContext(Dispatchers.Default) { recognizer.analyze(request.audioBase64, expectedIpa) } } finally { inFlight.decrementAndGet() - inferenceSlots.release() + inferenceGate.release() } if (analysis == null) { scoreError.increment() @@ -2250,7 +2243,8 @@ fun Application.module( mapOf( "inFlight" to inFlight.get(), "maxConcurrent" to maxConcurrent, - "availableSlots" to inferenceSlots.availablePermits, + "availableSlots" to inferenceGate.availablePermits, + "queued" to inferenceGate.queued, ), ) } diff --git a/server/src/main/kotlin/com/glosso/server/InferenceGate.kt b/server/src/main/kotlin/com/glosso/server/InferenceGate.kt new file mode 100644 index 0000000..014fe7c --- /dev/null +++ b/server/src/main/kotlin/com/glosso/server/InferenceGate.kt @@ -0,0 +1,35 @@ +package com.glosso.server + +import java.util.concurrent.atomic.AtomicInteger +import kotlinx.coroutines.sync.Semaphore +import kotlinx.coroutines.withTimeoutOrNull + +/** + * Admission to the CPU-bound recognizer: [maxConcurrent] runs at a time, at most + * [maxWaiting] requests queued behind them, each for at most [waitMs]. A full + * queue is refused at once, so a burst gets a fast 503 the app retries instead + * of everyone waiting out the clock and failing together. + */ +class InferenceGate(maxConcurrent: Int, private val maxWaiting: Int, private val waitMs: Long) { + private val slots = Semaphore(maxConcurrent) + private val waiting = AtomicInteger(0) + + val availablePermits: Int get() = slots.availablePermits + val queued: Int get() = waiting.get() + + /** True with a slot held (pair with [release]); false means answer 503. */ + suspend fun admit(): Boolean { + if (slots.tryAcquire()) return true + if (waiting.incrementAndGet() > maxWaiting) { + waiting.decrementAndGet() + return false + } + return try { + withTimeoutOrNull(waitMs) { slots.acquire(); true } ?: false + } finally { + waiting.decrementAndGet() + } + } + + fun release() = slots.release() +} diff --git a/server/src/test/kotlin/com/glosso/server/InferenceGateTest.kt b/server/src/test/kotlin/com/glosso/server/InferenceGateTest.kt new file mode 100644 index 0000000..197ced7 --- /dev/null +++ b/server/src/test/kotlin/com/glosso/server/InferenceGateTest.kt @@ -0,0 +1,33 @@ +package com.glosso.server + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue +import kotlinx.coroutines.async +import kotlinx.coroutines.test.advanceTimeBy +import kotlinx.coroutines.test.runTest + +class InferenceGateTest { + + @Test + fun fullQueueIsRefusedAtOnce() = runTest { + val gate = InferenceGate(maxConcurrent = 1, maxWaiting = 1, waitMs = 10_000) + assertTrue(gate.admit()) + val queued = async { gate.admit() } + advanceTimeBy(1) + assertEquals(1, gate.queued) + assertFalse(gate.admit()) // the queue is full: no wait + gate.release() + assertTrue(queued.await()) + assertEquals(0, gate.queued) + } + + @Test + fun waitRunsOut() = runTest { + val gate = InferenceGate(maxConcurrent = 1, maxWaiting = 4, waitMs = 1_000) + assertTrue(gate.admit()) + assertFalse(gate.admit()) + assertEquals(0, gate.queued) + } +} diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 4dba725..48a220b 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -162,6 +162,7 @@ kotlin { dependencies { implementation(kotlin("test")) implementation(libs.kotlinx.coroutines.test) + implementation(libs.ktor.client.mock) } } findByName("androidMain")?.dependencies { diff --git a/shared/src/commonMain/kotlin/com/glosso/app/OnboardingViewModel.kt b/shared/src/commonMain/kotlin/com/glosso/app/OnboardingViewModel.kt index d033940..2acc6ab 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/OnboardingViewModel.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/OnboardingViewModel.kt @@ -5,9 +5,10 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.glosso.engine.model.DrillModel import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.drop +import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.CancellationException import kotlinx.coroutines.launch /** How many reviewed phrases the seed step asks the learner to say. */ @@ -76,34 +77,33 @@ class OnboardingViewModel(private val services: AppServices) : ViewModel() { ) _seed.value = _seed.value.copy(previousScore = previous) } - load() - // The first page lets the learner pick the accent, and the phrases are - // worded per accent: fetch them again in the one just chosen. + // The first page picks the course and the accent, and the phrases (and + // their clips) belong to both: fetch again on any change. Latest wins, so + // the brief accent-before-language step never leaves the old course's + // phrases on screen. viewModelScope.launch { - VoicePreferences.accentFlow.drop(1).collect { load() } + contentReloadSignal(LanguagePreferences.code, UiLanguage.current).collectLatest { fetch() } } } fun load() { - viewModelScope.launch { - _seed.value = _seed.value.copy(loading = true, error = null) - // The bank is paged in row order, so the first few drills repeat the - // same sounds. Fetch a wide page and pick one phrase per trained - // sound, so the profile starts with breadth instead of two sounds. - runCatching { api.drills(limit = OnboardingSeed.POOL) } - .onSuccess { pool -> - _seed.value = SeedState( - loading = false, - drills = OnboardingSeed.select(pool, ONBOARDING_SEED_PHRASES), - ) - } - .onFailure { - _seed.value = SeedState( - loading = false, - error = networkOrServerError(services.connectivity), - ) - } + viewModelScope.launch { fetch() } + } + + private suspend fun fetch() { + _seed.value = _seed.value.copy(loading = true, error = null) + // The bank is paged in row order, so the first few drills repeat the + // same sounds. Fetch a wide page and pick one phrase per trained + // sound, so the profile starts with breadth instead of two sounds. + val pool = try { + api.drills(limit = OnboardingSeed.POOL) + } catch (e: CancellationException) { + throw e // a newer course or accent took over + } catch (_: Exception) { + _seed.value = SeedState(loading = false, error = networkOrServerError(services.connectivity)) + return } + _seed.value = SeedState(loading = false, drills = OnboardingSeed.select(pool, ONBOARDING_SEED_PHRASES)) } fun play(slow: Boolean = false) { diff --git a/shared/src/commonMain/kotlin/com/glosso/app/PracticeEngine.kt b/shared/src/commonMain/kotlin/com/glosso/app/PracticeEngine.kt index 378c4e2..fb24349 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/PracticeEngine.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/PracticeEngine.kt @@ -25,6 +25,8 @@ import kotlin.concurrent.Volatile import kotlin.io.encoding.Base64 import kotlin.time.TimeSource import kotlinx.io.IOException +import io.ktor.client.network.sockets.SocketTimeoutException +import io.ktor.client.plugins.HttpRequestTimeoutException import org.jetbrains.compose.resources.getString /** Everything about one spoken attempt: the recorder, the cloud score and the @@ -311,7 +313,7 @@ class PracticeEngine( if (e is CancellationException) throw e // The score is a cloud call. A dead connection reads as an // IOException: say so plainly instead of leaking a stack trace. - val offline = e is IOException + val offline = e.isOffline() // Offline with no on-device pack: the take is not scored and // cannot be, but the learner can install the pack and try // again, so the UI is told to offer it. @@ -490,7 +492,7 @@ class PracticeEngine( } .onFailure { e -> if (e is CancellationException) throw e - val offline = e is IOException + val offline = e.isOffline() val needsModel = offline && onDevice.supported && onDeviceLanguage() && !onDevice.available() _state.value = _state.value.copy( scoring = false, @@ -530,3 +532,11 @@ private const val MAX_LATENCY_MS = 120_000L */ fun referenceAudioPath(audio: Map): String? = audio.clipFor(VoicePreferences.accent) + +/** + * A connection that could not be made or broke. A timeout is an IOException in + * Ktor too, but it means a slow server on a working connection, so it is not + * reported (or shown) as offline. + */ +internal fun Throwable.isOffline(): Boolean = + this is IOException && this !is HttpRequestTimeoutException && this !is SocketTimeoutException diff --git a/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt b/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt index d9abc08..49b9649 100644 --- a/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt +++ b/shared/src/commonMain/kotlin/com/glosso/app/api/GlossoApi.kt @@ -34,6 +34,9 @@ import io.ktor.client.request.setBody import io.ktor.client.statement.bodyAsText import io.ktor.http.ContentType import io.ktor.http.HttpHeaders +import kotlinx.coroutines.delay +import kotlin.random.Random +import io.ktor.client.plugins.timeout import io.ktor.http.HttpStatusCode import io.ktor.http.contentType import io.ktor.http.fromHttpToGmtDate @@ -334,13 +337,15 @@ class GlossoApi( }.body>().map { it.forAccent(accent, authoredAccent) } suspend fun score(request: ScoreRequest): PronunciationFeedback { - val response = client.post("$baseUrl/v1/score") { - noCache() - contentType(ContentType.Application.Json) - // Only sent when the build carries a key; an empty key means an - // open server and no header, exactly the old behaviour. - if (apiKey.isNotBlank()) headers { append(API_KEY_HEADER, apiKey) } - setBody(request) + var response = postScore(request) + // Busy: the server queues takes and answers 503 before our timeout runs + // out. Retry after its Retry-After, with jitter so a burst of phones does + // not come back in step. + repeat(SCORE_BUSY_RETRIES) { + if (response.status != HttpStatusCode.ServiceUnavailable) return@repeat + val waitSeconds = response.headers[HttpHeaders.RetryAfter]?.toLongOrNull() ?: 2L + delay(waitSeconds.coerceIn(1L, 5L) * 1_000 + Random.nextLong(0, 1_000)) + response = postScore(request) } // The engine rejects recordings with no usable speech. The API answers // 422 for that - and its tiny body would otherwise deserialize into an @@ -349,9 +354,26 @@ class GlossoApi( if (response.status == HttpStatusCode.UnprocessableEntity) { return PronunciationFeedback(evaluated = false) } + // Any other failure is the server's, never a 0/100 decoded from an error body. + if (!response.status.isSuccess()) error("Scoring failed: HTTP ${response.status.value}") return response.body() } + private suspend fun postScore(request: ScoreRequest) = client.post("$baseUrl/v1/score") { + noCache() + contentType(ContentType.Application.Json) + // Only sent when the build carries a key; an empty key means an + // open server and no header, exactly the old behaviour. + if (apiKey.isNotBlank()) headers { append(API_KEY_HEADER, apiKey) } + // Longer than the server's queue wait plus a slow inference, so a busy + // server answers (503) instead of the phone giving up mid-wait. + timeout { + requestTimeoutMillis = SCORE_TIMEOUT_MS + socketTimeoutMillis = SCORE_TIMEOUT_MS + } + setBody(request) + } + /** A practice plan for this learner: weakest sound first, on-theme and on-target. */ suspend fun drillPlan(request: DrillPlanRequest): DrillPlanModel = client.post("$baseUrl/v1/drills") { @@ -665,6 +687,12 @@ class GlossoApi( /** Shared client credential the scoring oracle expects; see [GlossoApi.apiKey]. */ private const val API_KEY_HEADER = "X-Api-Key" +/** A score waits for the server queue (12 s at most) plus one inference. */ +internal const val SCORE_TIMEOUT_MS = 30_000L + +/** Retries of a take the server was too busy to admit. */ +private const val SCORE_BUSY_RETRIES = 2 + /** The device identity the server keys the user by; see [GlossoApi.deviceIdProvider]. */ private const val DEVICE_ID_HEADER = "X-Device-Id" diff --git a/shared/src/commonTest/kotlin/com/glosso/app/api/ScoreRetryTest.kt b/shared/src/commonTest/kotlin/com/glosso/app/api/ScoreRetryTest.kt new file mode 100644 index 0000000..bef2889 --- /dev/null +++ b/shared/src/commonTest/kotlin/com/glosso/app/api/ScoreRetryTest.kt @@ -0,0 +1,63 @@ +package com.glosso.app.api + +import io.ktor.client.engine.mock.MockEngine +import io.ktor.client.engine.mock.respond +import io.ktor.http.HttpHeaders +import io.ktor.http.HttpStatusCode +import io.ktor.http.headersOf +import kotlinx.coroutines.test.runTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse + +class ScoreRetryTest { + + private val json = headersOf(HttpHeaders.ContentType, "application/json") + + private fun api(vararg replies: Pair): Pair Int> { + var calls = 0 + val engine = MockEngine { + val (status, body) = replies[calls++] + respond(body, status, if (status == HttpStatusCode.ServiceUnavailable) headersOf(HttpHeaders.RetryAfter, "1") else json) + } + val scope = object : ContentScope { + override val language = "en" + override val accent = "en-GB" + override val authoredAccent = "en-GB" + override val uiLanguage = "en" + } + val api = GlossoApi({ "http://test" }, engine, null, AssetVersionStore.None, "", { null }, { false }, scope) + return api to { calls } + } + + @Test + fun busyServerIsRetriedOnce() = runTest { + val (api, calls) = api( + HttpStatusCode.ServiceUnavailable to """{"error":"busy"}""", + HttpStatusCode.OK to """{"score":87}""", + ) + assertEquals(87, api.score(ScoreRequest(text = "hi")).score) + assertEquals(2, calls()) + } + + @Test + fun aServerBusyThroughEveryRetryFails() = runTest { + val busy = HttpStatusCode.ServiceUnavailable to """{"error":"busy"}""" + val (api, calls) = api(busy, busy, busy) + assertFailsWith { api.score(ScoreRequest(text = "hi")) } + assertEquals(3, calls()) + } + + @Test + fun serverErrorIsAFailureNotAZeroScore() = runTest { + val (api, _) = api(HttpStatusCode.InternalServerError to """{"error":"boom"}""") + assertFailsWith { api.score(ScoreRequest(text = "hi")) } + } + + @Test + fun unusableSpeechIsNotEvaluated() = runTest { + val (api, _) = api(HttpStatusCode.UnprocessableEntity to "{}") + assertFalse(api.score(ScoreRequest(text = "hi")).evaluated) + } +} From fbc9d0663cf25ef11864e174ca4b47d435c40653 Mon Sep 17 00:00:00 2001 From: IgnacioLD <178957758+IgnacioLD@users.noreply.github.com> Date: Wed, 25 Nov 2026 00:21:12 +0100 Subject: [PATCH 8/8] docs(store): new screenshots and the real course list in every listing --- .../metadata/android/ar/full_description.txt | 2 +- .../android/de-DE/full_description.txt | 2 +- .../android/en-US/full_description.txt | 2 +- .../en-US/images/phoneScreenshots/1.png | Bin 159030 -> 152770 bytes .../en-US/images/phoneScreenshots/2.png | Bin 188402 -> 181583 bytes .../en-US/images/phoneScreenshots/3.png | Bin 180256 -> 157734 bytes .../en-US/images/phoneScreenshots/4.png | Bin 0 -> 176433 bytes .../en-US/images/phoneScreenshots/5.png | Bin 0 -> 196072 bytes .../en-US/images/phoneScreenshots/6.png | Bin 0 -> 278940 bytes .../en-US/images/phoneScreenshots/7.png | Bin 0 -> 160419 bytes .../android/es-ES/full_description.txt | 2 +- .../android/fr-FR/full_description.txt | 2 +- .../android/hi-IN/full_description.txt | 2 +- .../android/ru-RU/full_description.txt | 2 +- 14 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 fastlane/metadata/android/en-US/images/phoneScreenshots/4.png create mode 100644 fastlane/metadata/android/en-US/images/phoneScreenshots/5.png create mode 100644 fastlane/metadata/android/en-US/images/phoneScreenshots/6.png create mode 100644 fastlane/metadata/android/en-US/images/phoneScreenshots/7.png diff --git a/fastlane/metadata/android/ar/full_description.txt b/fastlane/metadata/android/ar/full_description.txt index c696531..6c26d55 100644 --- a/fastlane/metadata/android/ar/full_description.txt +++ b/fastlane/metadata/android/ar/full_description.txt @@ -1,6 +1,6 @@ تطبيق Glosso دورة لغات تقيس نطقك فعلًا. يستمع إلى كل تسجيل، ويتعرف على الأصوات التي نطقتها حقًا، ويقارنها بالأصوات المتوقعة، ثم يخبرك بالضبط أي صوت تحتاج إلى تصحيحه. -اللغات: الإنجليزية (البريطانية والأمريكية) والفرنسية والألمانية والروسية. +الدورات: الإنجليزية (البريطانية والأمريكية)، إضافة إلى الروسية والإسبانية كدورتين تجريبيتين للمبتدئين. ما ستحصل عليه