feat: implement "Liquid Glass" toggle and rename theme repository#343
feat: implement "Liquid Glass" toggle and rename theme repository#343rainxchzed merged 3 commits intomainfrom
Conversation
- Rename `ThemesRepository` to `TweaksRepository` to reflect its expanded scope of managing various app behaviors and settings. - Implement a new "Liquid Glass Effect" setting in the Appearance section, allowing users to toggle the smooth glass-like UI effects. - Update `ProfileViewModel`, `HomeViewModel`, `SearchViewModel`, `AppsViewModel`, and `DetailsViewModel` to observe and react to the `isLiquidGlassEnabled` state. - Conditionally apply `Modifier.liquefiable` and liquid frost backgrounds across multiple UI components (TopBars, BottomNavigation, FilterChips, and content sections) based on the user's preference. - Refactor dependency injection and repository usages to support the new `TweaksRepository` interface. - Add localized strings for the Liquid Glass option title and description. - Adjust layout and padding in the Profile screen settings sections.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
WalkthroughRenames Changes
Sequence DiagramsequenceDiagram
participant User
participant ProfileUI as Profile UI
participant ProfileVM as ProfileViewModel
participant TweaksRepo as TweaksRepository
participant DataStore as DataStore
participant OtherVMs as Other ViewModels
User->>ProfileUI: Toggle "Liquid Glass" setting
ProfileUI->>ProfileVM: dispatch OnLiquidGlassEnabledChange(enabled)
ProfileVM->>TweaksRepo: setLiquidGlassEnabled(enabled)
TweaksRepo->>DataStore: persist LIQUID_GLASS_ENABLED_KEY
DataStore-->>TweaksRepo: write ack
Note right of TweaksRepo: TweaksRepo exposes Flow<Boolean>
TweaksRepo-->>OtherVMs: emit new value via getLiquidGlassEnabled()
OtherVMs->>OtherVMs: update _state.isLiquidGlassEnabled
OtherVMs-->>UI: new states emitted
UI->>UI: recomposition applies or removes Modifier.liquefiable()
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…uages - Add localized strings for "Liquid Glass" effect title and description. - Provide translations for Bengali, Hindi, Italian, Spanish, Arabic, French, Polish, Russian, Japanese, Korean, Turkish, and Chinese (Simplified). - Include descriptions for enhancing the interface with a smooth glass-like appearance.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Header.kt (2)
107-108: RedundantliquidStatedeclaration.
liquidStateis already declared at line 48 within the sameLazyListScope.headerfunction scope. The second declaration at line 108 shadows the first unnecessarily. While this doesn't cause a bug (both resolve to the same CompositionLocal value), it adds visual noise.♻️ Remove redundant declaration
item { - val liquidState = LocalTopbarLiquidState.current - Box(🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Header.kt` around lines 107 - 108, Remove the redundant declaration of liquidState inside the LazyListScope.header item: there is already a val liquidState = LocalTopbarLiquidState.current earlier in the same function (around line 48), so delete the second declaration at the item block to avoid shadowing; keep using the existing liquidState reference throughout the item and ensure no other local variable with the same name is introduced inside LazyListScope.header.
155-162: Consider extracting a conditional liquefiable modifier helper to reduce repetition.The same
Modifier.then(if (state.isLiquidGlassEnabled) Modifier.liquefiable(liquidState) else Modifier)pattern is repeated four times in this file. A small helper extension would improve readability.♻️ Optional: Extract helper extension
`@Composable` private fun Modifier.conditionalLiquefiable( enabled: Boolean, liquidState: LiquidState ): Modifier = if (enabled) this.liquefiable(liquidState) else thisThen use as:
modifier = Modifier.conditionalLiquefiable(state.isLiquidGlassEnabled, liquidState)Also applies to: 192-199, 229-236
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Header.kt` around lines 155 - 162, Extract a small Modifier extension to encapsulate the repeated pattern instead of repeating Modifier.then(if (state.isLiquidGlassEnabled) Modifier.liquefiable(liquidState) else Modifier) in Header.kt; add a private helper extension (e.g., conditionalLiquefiable) that takes enabled: Boolean and liquidState: LiquidState and returns either this.liquefiable(liquidState) when enabled or this otherwise, then replace the four occurrences with Modifier.conditionalLiquefiable(state.isLiquidGlassEnabled, liquidState) to improve readability and remove duplication.feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Stats.kt (1)
37-73: Consider extracting the conditional liquefiable modifier pattern.The same conditional modifier logic is repeated three times. This could be extracted to a small extension function for better maintainability:
private fun Modifier.conditionalLiquefiable( enabled: Boolean, liquidState: LiquidState ): Modifier = if (enabled) liquefiable(liquidState) else thisThis pattern appears across multiple files in this PR, so a shared utility in the core presentation module would reduce duplication.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Stats.kt` around lines 37 - 73, Extract the repeated conditional Modifier logic into a single extension function (e.g., Modifier.conditionalLiquefiable(enabled: Boolean, liquidState: LiquidState)) that returns if (enabled) this.liquefiable(liquidState) else this, add it to a shared presentation utilities file, and replace the repeated .then(if (isLiquidGlassEnabled) Modifier.liquefiable(liquidState) else Modifier) occurrences in StatItem usages (and other files) with .then(Modifier.conditionalLiquefiable(isLiquidGlassEnabled, liquidState)) to remove duplication while keeping behavior identical.feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/WhatsNew.kt (1)
83-90: Consider extracting the conditional liquefiable modifier into an extension function.The same conditional pattern is repeated 4 times in this file (and likely elsewhere in the PR). An extension function would improve readability and reduce duplication.
♻️ Suggested extension function
// In a shared utility file fun Modifier.liquefiableIf( enabled: Boolean, liquidState: LiquidState, ): Modifier = if (enabled) this.liquefiable(liquidState) else thisThen usage becomes:
-Modifier.then( - if (isLiquidGlassEnabled) { - Modifier.liquefiable(liquidState) - } else { - Modifier - }, -), +Modifier.liquefiableIf(isLiquidGlassEnabled, liquidState),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/WhatsNew.kt` around lines 83 - 90, Extract the repeated conditional Modifier.liquefiable(...) pattern into an extension function (e.g., fun Modifier.liquefiableIf(enabled: Boolean, liquidState: LiquidState): Modifier) and replace each occurrence that checks isLiquidGlassEnabled and applies Modifier.liquefiable(liquidState) with a call to .liquefiableIf(isLiquidGlassEnabled, liquidState); update references in WhatsNew.kt where isLiquidGlassEnabled and liquidState are used to call the new extension to remove duplication and improve readability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@feature/home/presentation/src/commonMain/kotlin/zed/rainxch/home/presentation/HomeState.kt`:
- Line 22: The HomeState default for isLiquidGlassEnabled is currently false
causing a visual mismatch on first render; update the HomeState data class
(symbol: HomeState and property isLiquidGlassEnabled) to initialize
isLiquidGlassEnabled to true so it matches other screens' defaults and avoids
the brief UI inconsistency until the preferences flow updates state.
---
Nitpick comments:
In
`@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Header.kt`:
- Around line 107-108: Remove the redundant declaration of liquidState inside
the LazyListScope.header item: there is already a val liquidState =
LocalTopbarLiquidState.current earlier in the same function (around line 48), so
delete the second declaration at the item block to avoid shadowing; keep using
the existing liquidState reference throughout the item and ensure no other local
variable with the same name is introduced inside LazyListScope.header.
- Around line 155-162: Extract a small Modifier extension to encapsulate the
repeated pattern instead of repeating Modifier.then(if
(state.isLiquidGlassEnabled) Modifier.liquefiable(liquidState) else Modifier) in
Header.kt; add a private helper extension (e.g., conditionalLiquefiable) that
takes enabled: Boolean and liquidState: LiquidState and returns either
this.liquefiable(liquidState) when enabled or this otherwise, then replace the
four occurrences with
Modifier.conditionalLiquefiable(state.isLiquidGlassEnabled, liquidState) to
improve readability and remove duplication.
In
`@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Stats.kt`:
- Around line 37-73: Extract the repeated conditional Modifier logic into a
single extension function (e.g., Modifier.conditionalLiquefiable(enabled:
Boolean, liquidState: LiquidState)) that returns if (enabled)
this.liquefiable(liquidState) else this, add it to a shared presentation
utilities file, and replace the repeated .then(if (isLiquidGlassEnabled)
Modifier.liquefiable(liquidState) else Modifier) occurrences in StatItem usages
(and other files) with
.then(Modifier.conditionalLiquefiable(isLiquidGlassEnabled, liquidState)) to
remove duplication while keeping behavior identical.
In
`@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/WhatsNew.kt`:
- Around line 83-90: Extract the repeated conditional Modifier.liquefiable(...)
pattern into an extension function (e.g., fun Modifier.liquefiableIf(enabled:
Boolean, liquidState: LiquidState): Modifier) and replace each occurrence that
checks isLiquidGlassEnabled and applies Modifier.liquefiable(liquidState) with a
call to .liquefiableIf(isLiquidGlassEnabled, liquidState); update references in
WhatsNew.kt where isLiquidGlassEnabled and liquidState are used to call the new
extension to remove duplication and improve readability.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bf82d675-1574-4a6c-9672-38d656564322
📒 Files selected for processing (44)
composeApp/src/androidMain/kotlin/zed/rainxch/githubstore/app/GithubStoreApp.ktcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/Main.ktcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/MainState.ktcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/MainViewModel.ktcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/app/di/SharedModules.ktcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/app/navigation/AppNavigation.ktcomposeApp/src/commonMain/kotlin/zed/rainxch/githubstore/app/navigation/BottomNavigation.ktcore/data/src/androidMain/kotlin/zed/rainxch/core/data/di/PlatformModule.android.ktcore/data/src/androidMain/kotlin/zed/rainxch/core/data/services/AutoUpdateWorker.ktcore/data/src/androidMain/kotlin/zed/rainxch/core/data/services/UpdateCheckWorker.ktcore/data/src/androidMain/kotlin/zed/rainxch/core/data/services/shizuku/ShizukuInstallerWrapper.ktcore/data/src/commonMain/kotlin/zed/rainxch/core/data/di/SharedModule.ktcore/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/InstalledAppsRepositoryImpl.ktcore/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/TweaksRepositoryImpl.ktcore/domain/src/commonMain/kotlin/zed/rainxch/core/domain/repository/TweaksRepository.ktcore/presentation/src/commonMain/composeResources/values/strings.xmlfeature/apps/data/src/commonMain/kotlin/zed/rainxch/apps/data/di/SharedModule.ktfeature/apps/data/src/commonMain/kotlin/zed/rainxch/apps/data/repository/AppsRepositoryImpl.ktfeature/apps/presentation/src/commonMain/kotlin/zed/rainxch/apps/presentation/AppsRoot.ktfeature/apps/presentation/src/commonMain/kotlin/zed/rainxch/apps/presentation/AppsState.ktfeature/apps/presentation/src/commonMain/kotlin/zed/rainxch/apps/presentation/AppsViewModel.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/DetailsRoot.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/DetailsState.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/DetailsViewModel.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/About.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Header.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Logs.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Owner.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/Stats.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/sections/WhatsNew.ktfeature/home/presentation/src/commonMain/kotlin/zed/rainxch/home/presentation/HomeRoot.ktfeature/home/presentation/src/commonMain/kotlin/zed/rainxch/home/presentation/HomeState.ktfeature/home/presentation/src/commonMain/kotlin/zed/rainxch/home/presentation/HomeViewModel.ktfeature/home/presentation/src/commonMain/kotlin/zed/rainxch/home/presentation/components/HomeFilterChips.ktfeature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileAction.ktfeature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileRoot.ktfeature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileState.ktfeature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileViewModel.ktfeature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/components/sections/Appearance.ktfeature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/components/sections/SettingsSection.ktfeature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchRoot.ktfeature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchState.ktfeature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchViewModel.kt
feature/home/presentation/src/commonMain/kotlin/zed/rainxch/home/presentation/HomeState.kt
Outdated
Show resolved
Hide resolved
- Update the default value of `isLiquidGlassEnabled` to `true` in `HomeState`.
ThemesRepositorytoTweaksRepositoryto reflect its expanded scope of managing various app behaviors and settings.ProfileViewModel,HomeViewModel,SearchViewModel,AppsViewModel, andDetailsViewModelto observe and react to theisLiquidGlassEnabledstate.Modifier.liquefiableand liquid frost backgrounds across multiple UI components (TopBars, BottomNavigation, FilterChips, and content sections) based on the user's preference.TweaksRepositoryinterface.Summary by CodeRabbit
New Features
Improvements
Localization