-
-
Notifications
You must be signed in to change notification settings - Fork 49
🔧 Tweaks #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ensuring the widget is also updated Signed-off-by: shub39 <[email protected]>
Signed-off-by: shub39 <[email protected]>
Signed-off-by: shub39 <[email protected]>
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (22)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThis update refactors data access in notification logic to use a unified repository, enhances theme and color handling in the UI, updates analytics components with new titles and validation, and introduces new string resources. Function signatures and composable parameters are adjusted for consistency, and several dependency versions are incremented. Changes
Sequence Diagram(s)sequenceDiagram
participant NotificationReceiver
participant HabitRepo
participant Habit
participant HabitStatus
NotificationReceiver->>HabitRepo: getHabitById(habitId)
HabitRepo-->>NotificationReceiver: Habit?
NotificationReceiver->>HabitRepo: getStatusForHabit(habitId)
HabitRepo-->>NotificationReceiver: List<HabitStatus>
NotificationReceiver->>HabitRepo: insertHabitStatus(HabitStatus)
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/src/main/res/values/strings.xml (1)
35-35: Consider plural form for better internationalization.The updated format removes parentheses but now uses hardcoded "Days" instead of handling singular/plural forms. This could cause grammatical issues in different languages or when the count is 1.
Consider using Android's plural resources for better internationalization:
<plurals name="days_ago_format"> <item quantity="one">%1$d Day ago…</item> <item quantity="other">%1$d Days ago…</item> </plurals>However, based on the retrieved learnings, switching to plural resources creates breaking changes for existing translations. The current approach maintains compatibility while improving readability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
fastlane/metadata/android/en-US/images/featureGraphic.pngis excluded by!**/*.png
📒 Files selected for processing (14)
app/src/main/java/com/shub39/grit/core/data/NotificationReceiver.kt(4 hunks)app/src/main/java/com/shub39/grit/core/presentation/settings/components/LookAndFeelPage.kt(1 hunks)app/src/main/java/com/shub39/grit/core/presentation/theme/GritTheme.kt(1 hunks)app/src/main/java/com/shub39/grit/core/presentation/util.kt(2 hunks)app/src/main/java/com/shub39/grit/habits/data/repository/HabitRepository.kt(2 hunks)app/src/main/java/com/shub39/grit/habits/domain/HabitRepo.kt(1 hunks)app/src/main/java/com/shub39/grit/habits/presentation/Habits.kt(3 hunks)app/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsCard.kt(2 hunks)app/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsPage.kt(6 hunks)app/src/main/java/com/shub39/grit/habits/presentation/component/HabitCard.kt(5 hunks)app/src/main/java/com/shub39/grit/habits/presentation/component/HabitsList.kt(1 hunks)app/src/main/java/com/shub39/grit/habits/presentation/component/OverallAnalyticsSheet.kt(3 hunks)app/src/main/res/values/strings.xml(2 hunks)gradle/libs.versions.toml(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
app/src/main/res/values/strings.xml (1)
Learnt from: istudyatuni
PR: shub39/Grit#103
File: app/src/main/res/values-ru/strings.xml:0-0
Timestamp: 2025-07-05T13:36:09.250Z
Learning: When adding plural resources for Russian strings in Android apps, switching from `stringResource()` to `getQuantityString()` (or `pluralStringResource()` in Compose) creates breaking changes for existing translations. A practical approach is to add commented-out plural forms in the Russian strings file for future migration while keeping the current string resources intact.
🧬 Code Graph Analysis (3)
app/src/main/java/com/shub39/grit/core/data/NotificationReceiver.kt (1)
app/src/main/java/com/shub39/grit/core/presentation/util.kt (1)
habitNotification(135-168)
app/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsPage.kt (1)
app/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsCard.kt (1)
AnalyticsCard(15-37)
app/src/main/java/com/shub39/grit/habits/presentation/component/OverallAnalyticsSheet.kt (1)
app/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsCard.kt (1)
AnalyticsCard(15-37)
🔇 Additional comments (40)
gradle/libs.versions.toml (3)
2-2: LGTM: Standard maintenance updateThe Android Gradle Plugin version update from 8.11.0 to 8.11.1 is a typical patch release.
16-16: LGTM: Minor version updateThe Kotlin serialization library update from 1.8.1 to 1.9.0 is a standard minor version increment.
17-17: Verify compatibility with MaterialKolor 3.0.0
The jump from 2.x to 3.0.0 is a major version bump and may introduce breaking changes. Grepping your code showed usages of:
- PaletteStyle
- DynamicMaterialExpressiveTheme
- rememberDynamicColorScheme
- com.materialkolor.ktx.from
- TonalPalette
Please:
- Review the MaterialKolor 3.0.0 changelog/migration guide for any renamed or removed APIs.
- Build the app and run your UI/visual tests to catch any runtime or compile-time errors.
- Pay special attention to these files where the library is imported:
• app/src/main/java/com/shub39/grit/tasks/presentation/Tasks.kt
• app/src/main/java/com/shub39/grit/habits/presentation/Habits.kt
• app/src/main/java/com/shub39/grit/core/presentation/theme/GritTheme.kt
• app/src/main/java/com/shub39/grit/core/presentation/settings/components/LookAndFeelPage.kt
• app/src/main/java/com/shub39/grit/core/data/DataStoreImpl.kt
• app/src/main/java/com/shub39/grit/core/domain/GritDatastore.ktEnsure all imports and APIs still exist or update them per the new version’s API.
app/src/main/java/com/shub39/grit/habits/presentation/component/HabitsList.kt (1)
235-238: Approve component rename: OverallAnalyticsSheetThe
OverallAnalyticsSheetfunction is defined with the expected signature (takesstate,onDismiss, plus a defaultmodifier) and matches the call inHabitsList.kt. No further changes are needed.• Verified in
app/src/main/java/com/shub39/grit/habits/presentation/component/OverallAnalyticsSheet.kt
• Usage updated correctly inapp/src/main/java/com/shub39/grit/habits/presentation/component/HabitsList.ktapp/src/main/java/com/shub39/grit/core/presentation/settings/components/LookAndFeelPage.kt (1)
405-405: LGTM: Theme consistency improvementRemoving the explicit color parameter allows the Surface to use the default background color, which aligns with the broader theme refactoring.
app/src/main/java/com/shub39/grit/habits/presentation/Habits.kt (4)
15-15: LGTM: Required import for theme configurationThe Color import is needed for the new seedColor parameter in the theme configuration.
79-79: LGTM: Typo fixFixed the variable name typo from
habitsWithStatuesestohabitsWithStatuses.
97-98: LGTM: Consistent variable namingUpdated variable references to use the corrected
habitsWithStatusesname.
104-107: LGTM: Theme configuration updatesThe theme configuration changes align with the new theme system, testing different styling options including disabled MaterialYou, custom seed color, and different font/palette style.
app/src/main/java/com/shub39/grit/core/presentation/theme/GritTheme.kt (5)
5-5: LGTM: Required import for expressive theme APIThe ExperimentalMaterial3ExpressiveApi import is needed for the new expressive theme functionality.
8-8: LGTM: API migration to expressive themeUpdated import from
DynamicMaterialThemetoDynamicMaterialExpressiveThemeas part of the theme API migration.
11-11: LGTM: Experimental API opt-inThe experimental API opt-in is required for using the Material3 expressive theme features.
17-17: LGTM: Theme component updateUpdated from
DynamicMaterialThemetoDynamicMaterialExpressiveThemeto use the new expressive theme API.
23-23: LGTM: Parameter name updatesThe parameter names were correctly updated to match the new API:
useDarkTheme→isDarkandwithAmoled→isAmoled.Also applies to: 28-28
app/src/main/java/com/shub39/grit/habits/domain/HabitRepo.kt (2)
11-11: LGTM! Well-designed interface addition.The new
getHabitByIdmethod follows good practices with appropriate nullable return type and consistent naming conventions.
15-15: LGTM! Consistent interface design.The
getStatusForHabitmethod provides clean ID-based access to habit statuses, maintaining consistency with the existing interface patterns.app/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsCard.kt (2)
26-32: LGTM! Well-implemented title display.The title implementation follows Material Design guidelines with appropriate typography, font weight, and spacing. The 8dp spacer provides good visual separation.
17-17: All AnalyticsCard calls include the title parameter
Verified that every invocation ofAnalyticsCard(in OverallAnalyticsSheet.kt and both usages in AnalyticsPage.kt) provides the requiredtitleargument. Implementation is approved—no further changes needed.app/src/main/java/com/shub39/grit/core/presentation/util.kt (2)
135-135: LGTM! Parameter type change aligns with domain architecture.The change from
HabitEntitytoHabitdomain model is consistent with the broader refactoring effort and improves architectural separation.
137-167: LGTM! All references properly updated.All internal references have been correctly updated to use the
habitparameter instead ofhabitEntity, maintaining the same functionality while working with the domain model.app/src/main/java/com/shub39/grit/habits/presentation/component/OverallAnalyticsSheet.kt (3)
74-75: LGTM! Better responsive design with heightIn.The change from fixed height to
heightIn(max = 400.dp)provides better responsive behavior, allowing the card to adapt to content size while preventing it from becoming too large.
67-67: Confirmed:overall_analyticsstring resource exists
The resource is defined in app/src/main/res/values/strings.xml:<string name="overall_analytics">Overall Analytics</string>No further action required.
34-34: Function rename verified across codebaseNo occurrences of the old
AllAnalyticsSheetremain—rename toOverallAnalyticsSheetis complete.
- Ran
rg "AllAnalyticsSheet" --type kotlin: zero matches.app/src/main/java/com/shub39/grit/habits/data/repository/HabitRepository.kt (3)
41-43: LGTM! Proper null handling and domain model conversion.The
getHabitByIdimplementation correctly handles the nullable return from the DAO and converts to the domain model using the safe call operator.
66-68: LGTM! Consistent implementation pattern.The
getStatusForHabitimplementation follows the same pattern as other methods in the repository, properly mapping from entities to domain models.
41-68: Methods Verified: DAO Signatures CorrectConfirmed that both DAO methods exist with the expected signatures:
- app/src/main/java/com/shub39/grit/habits/data/database/HabitDao.kt
•suspend fun getHabitById(habitId: Long): HabitEntity?- app/src/main/java/com/shub39/grit/habits/data/database/HabitStatusDao.kt
•suspend fun getStatusForHabit(habitId: Long): List<HabitStatusEntity>No further changes required.
app/src/main/res/values/strings.xml (1)
107-109: LGTM! New string resources align with UI updates.The addition of
weekly_progress,overall_analytics, andprogressstrings supports the analytics components mentioned in the AI summary. These localized strings enhance the user experience by providing proper titles for the analytics UI elements.app/src/main/java/com/shub39/grit/habits/presentation/component/HabitCard.kt (4)
61-65: LGTM! Improved color scheme with Material 3 roles.The color scheme updates use more appropriate Material 3 color roles:
onPrimaryContainer/onSurfacefor content provides better contrast- The animation label correction ensures proper animation tracking
83-83: Good removal of alpha transparency for better accessibility.Removing the alpha modifier from the container color improves accessibility by ensuring proper contrast ratios are maintained according to Material 3 guidelines.
97-99: LGTM! Comprehensive color theming for list items.The addition of
supportingColor,trailingIconColor, andleadingIconColorensures consistent theming across all list item elements using the animatedcardContentcolor.
183-203: Excellent calendar styling improvements.The calendar day styling updates enhance visual consistency:
secondaryContainerbackground provides better semantic meaning for completed daysonSecondaryContainertext color ensures proper contrast- Using animated
cardContentcolor for incomplete days maintains visual hierarchyapp/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsPage.kt (5)
278-280: LGTM! Proper title parameter usage.The addition of the
titleparameter withstringResource(R.string.weekly_progress)aligns with the updatedAnalyticsCardsignature from the relevant code snippet. This provides proper localized titles for the analytics components.
292-312: Excellent Material 3 theming consistency.The color scheme updates for the heatmap calendar elements use appropriate Material 3 color roles:
secondaryfor month headerssecondaryContainerbackground withonSecondaryContainertext for week headersThis creates a cohesive visual hierarchy that aligns with the overall app theming.
356-356: Good use of consistent string resources.Using
stringResource(R.string.weekly_graph)for the title maintains consistency with the other analytics card and ensures proper localization.
373-373: Good label update for clarity.Changing the line chart label from
weekly_graphtoprogressmakes the chart more generic and appropriately describes the data being visualized.
481-481: Critical validation fix! Excellent catch.The error condition was incorrectly checking
newHabitDescription.length > 20instead ofnewHabitTitle.length > 20. This would have caused the title field to show error states based on the description length, which is a significant UX bug.app/src/main/java/com/shub39/grit/core/data/NotificationReceiver.kt (4)
11-12: LGTM! Proper dependency injection with repository pattern.The import changes from direct DAO usage to
HabitRepoand domain modelHabitStatusimprove the architecture by following the repository pattern and using domain models instead of database entities.
30-30: Good use of unified repository interface.Using
HabitRepoinstead of direct DAO access provides better abstraction and follows clean architecture principles.
42-57: Excellent domain model integration.The function calls have been properly updated to use repository methods:
habitRepo.getHabitById()replaces direct DAO accesshabitRepo.getStatusForHabit()centralizes status retrieval- Domain model
habitis used throughout, aligning with thehabitNotificationfunction signature from the relevant code snippet- Scheduler uses domain model consistently
68-72: Proper domain model usage for habit status.Creating
HabitStatusdomain model and usinghabitRepo.insertHabitStatus()maintains consistency with the repository pattern while preserving the same functionality.
Signed-off-by: shub39 <[email protected]>
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Refactor
Dependency Updates