From d7cdf740e58d7eb2ddc247c75ec02c475eb63d6f Mon Sep 17 00:00:00 2001 From: null Date: Wed, 19 Aug 2026 21:52:10 -0500 Subject: [PATCH] chore: hiltViewModel comes from the package that still supports it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit androidx.hilt.navigation.compose.hiltViewModel is deprecated — it moved to androidx.hilt.lifecycle.viewmodel.compose, and every one of the ten files calling it was importing the old path, so the whole app module compiled with a deprecation warning on the single most-used composable helper in it. hilt-lifecycle-viewmodel-compose was already resolving onto the classpath transitively at the same 1.4.0. It is declared explicitly now rather than leaned on, because it is called directly in ten files and a transitive that quietly stops being pulled is a compile error with a confusing cause. The app module now compiles with zero deprecation warnings. Checked while auditing library currency: every artifact in the catalog, all four plugins and the Gradle wrapper are already at their newest stable. The only version that looks old is androidx.biometric 1.1.0, which IS the newest stable — 1.4.0 is alpha-only and biometric-ktx has never shipped a stable release. Co-Authored-By: Claude Opus 5 (1M context) --- app/build.gradle.kts | 4 ++++ .../dev/privacyllc/period/feature/calendar/CalendarScreen.kt | 2 +- .../dev/privacyllc/period/feature/insights/InsightsScreen.kt | 2 +- .../dev/privacyllc/period/feature/lock/ForgotPinScreen.kt | 2 +- .../dev/privacyllc/period/feature/lock/LockSettingsScreen.kt | 2 +- .../privacyllc/period/feature/onboarding/OnboardingScreen.kt | 2 +- .../period/feature/settings/NotificationSettingsScreen.kt | 2 +- .../dev/privacyllc/period/feature/settings/SettingsScreen.kt | 2 +- .../kotlin/dev/privacyllc/period/feature/today/TodayScreen.kt | 2 +- app/src/main/kotlin/dev/privacyllc/period/lock/AppLockGate.kt | 2 +- .../main/kotlin/dev/privacyllc/period/navigation/PeriodApp.kt | 2 +- gradle/libs.versions.toml | 1 + 12 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ac7260d..b0e7f30 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -81,6 +81,10 @@ dependencies { implementation(libs.hilt.android) implementation(libs.hilt.navigation.compose) + // hiltViewModel() moved here from hilt-navigation-compose, which now + // deprecates it. Declared explicitly rather than leaned on transitively, + // because it is called directly in ten files. + implementation(libs.androidx.hilt.lifecycle.viewmodel.compose) implementation(libs.androidx.hilt.work) implementation(libs.androidx.work.runtime) implementation(libs.androidx.biometric) diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/calendar/CalendarScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/calendar/CalendarScreen.kt index ad9c3d1..49f44ed 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/calendar/CalendarScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/calendar/CalendarScreen.kt @@ -44,7 +44,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import dev.privacyllc.period.R import dev.privacyllc.period.designsystem.PeriodTheme diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/insights/InsightsScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/insights/InsightsScreen.kt index fa9991b..728b4d2 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/insights/InsightsScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/insights/InsightsScreen.kt @@ -21,7 +21,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import dev.privacyllc.period.core.data.PredictionAccuracy import dev.privacyllc.period.designsystem.PeriodTheme diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/lock/ForgotPinScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/lock/ForgotPinScreen.kt index aa6cf32..20542f5 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/lock/ForgotPinScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/lock/ForgotPinScreen.kt @@ -33,7 +33,7 @@ import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import dev.privacyllc.period.designsystem.PeriodTheme diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/lock/LockSettingsScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/lock/LockSettingsScreen.kt index c43f444..e8b117a 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/lock/LockSettingsScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/lock/LockSettingsScreen.kt @@ -36,7 +36,7 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import dev.privacyllc.period.designsystem.PeriodTheme diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/onboarding/OnboardingScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/onboarding/OnboardingScreen.kt index 3b7cf8c..1c00ff2 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/onboarding/OnboardingScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/onboarding/OnboardingScreen.kt @@ -37,7 +37,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import dev.privacyllc.period.core.datastore.NotificationPrivacy import dev.privacyllc.period.designsystem.art.ForecastIllustration diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/settings/NotificationSettingsScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/settings/NotificationSettingsScreen.kt index 9cd2fc1..b3bae52 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/settings/NotificationSettingsScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/settings/NotificationSettingsScreen.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.semantics.Role import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import dev.privacyllc.period.core.datastore.NotificationPrivacy import dev.privacyllc.period.core.datastore.UserPreferences diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/settings/SettingsScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/settings/SettingsScreen.kt index 9c83aac..2584176 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/settings/SettingsScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/settings/SettingsScreen.kt @@ -19,7 +19,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember diff --git a/app/src/main/kotlin/dev/privacyllc/period/feature/today/TodayScreen.kt b/app/src/main/kotlin/dev/privacyllc/period/feature/today/TodayScreen.kt index 3c64d21..68e9db9 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/feature/today/TodayScreen.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/feature/today/TodayScreen.kt @@ -38,7 +38,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import dev.privacyllc.period.R import dev.privacyllc.period.designsystem.PeriodTheme diff --git a/app/src/main/kotlin/dev/privacyllc/period/lock/AppLockGate.kt b/app/src/main/kotlin/dev/privacyllc/period/lock/AppLockGate.kt index 5eff71c..11f2d83 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/lock/AppLockGate.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/lock/AppLockGate.kt @@ -5,7 +5,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.compose.LocalLifecycleOwner diff --git a/app/src/main/kotlin/dev/privacyllc/period/navigation/PeriodApp.kt b/app/src/main/kotlin/dev/privacyllc/period/navigation/PeriodApp.kt index 40cf729..6234ed0 100644 --- a/app/src/main/kotlin/dev/privacyllc/period/navigation/PeriodApp.kt +++ b/app/src/main/kotlin/dev/privacyllc/period/navigation/PeriodApp.kt @@ -31,7 +31,7 @@ import androidx.navigation.NavGraph.Companion.findStartDestination import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.currentBackStackEntryAsState -import androidx.hilt.navigation.compose.hiltViewModel +import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.compose.rememberNavController import dev.privacyllc.period.R diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f7d2fa9..34a5f6f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -57,6 +57,7 @@ kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-cor hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } androidx-hilt-work = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltNavigationCompose" } +androidx-hilt-lifecycle-viewmodel-compose = { group = "androidx.hilt", name = "hilt-lifecycle-viewmodel-compose", version.ref = "hiltNavigationCompose" } androidx-hilt-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltNavigationCompose" } hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" }