Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@shub39
Copy link
Owner

@shub39 shub39 commented Jul 15, 2025

Summary by CodeRabbit

  • New Features

    • Added new analytics titles and labels for improved clarity in analytics cards and sheets.
    • Introduced new string resources for weekly progress, overall analytics, and progress.
  • Improvements

    • Enhanced theming and color schemes for analytics, habit cards, and preview screens for a more consistent and expressive UI.
    • Updated theme implementation to use a more expressive dynamic material theme.
    • Improved error validation for habit title input in analytics editing.
    • Renamed analytics sheet component for clarity and updated related UI text.
  • Bug Fixes

    • Fixed typo in variable naming within preview components.
    • Corrected error state logic for habit title input field.
  • Refactor

    • Streamlined data access and notification logic for habits.
    • Updated function and parameter names for clarity and consistency.
  • Dependency Updates

    • Updated Android Gradle Plugin, Kotlin serialization, and materialKolor library to newer versions.

@coderabbitai
Copy link

coderabbitai bot commented Jul 15, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (22)
  • app/src/main/res/mipmap-hdpi/ic_launcher.png is excluded by !**/*.png
  • app/src/main/res/mipmap-hdpi/ic_launcher_background.png is excluded by !**/*.png
  • app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-mdpi/ic_launcher.png is excluded by !**/*.png
  • app/src/main/res/mipmap-mdpi/ic_launcher_background.png is excluded by !**/*.png
  • app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xhdpi/ic_launcher.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xhdpi/ic_launcher_background.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxhdpi/ic_launcher.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxxhdpi/ic_launcher.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png is excluded by !**/*.png
  • fastlane/metadata/android/en-US/images/icon.png is excluded by !**/*.png
  • fastlane/metadata/android/en-US/images/icon200x200.png is excluded by !**/*.png

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This 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

File(s) Change Summary
.../NotificationReceiver.kt, .../util.kt Refactored to use domain models and repository interface for habit data; updated function signatures accordingly.
.../repository/HabitRepository.kt, .../domain/HabitRepo.kt Added getHabitById and getStatusForHabit suspend functions to repository and interface.
.../LookAndFeelPage.kt Removed explicit background color from Surface in SelectableMiniPalette.
.../theme/GritTheme.kt Switched to DynamicMaterialExpressiveTheme, updated parameter names, and opted into experimental API.
.../presentation/Habits.kt Fixed variable typo; updated theme preview parameters (color, font, palette style).
.../component/AnalyticsCard.kt Added required title parameter; displays title in card with styling and spacing.
.../component/AnalyticsPage.kt Passed new title to AnalyticsCard; improved color theming and validation logic.
.../component/HabitCard.kt Updated card and calendar color roles for improved theming and clarity.
.../component/HabitsList.kt Replaced AllAnalyticsSheet with OverallAnalyticsSheet for analytics display.
.../component/OverallAnalyticsSheet.kt Renamed composable; updated UI title and card height; passed title to AnalyticsCard.
.../res/values/strings.xml Added "weekly_progress", "overall_analytics", "progress" strings; modified "days_ago_format".
gradle/libs.versions.toml Updated versions: agp (8.11.0→8.11.1), serialization (1.8.1→1.9.0), materialKolor (2.1.1→3.0.0).

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)
Loading

Poem

🐇
A hop and a skip, the code’s anew,
With colors and themes in a vibrant hue!
Analytics cards now proudly display
Titles and charts in a clearer way.
Repos unite, dependencies climb—
This bunny’s code is feeling sublime!
🌱✨


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 84c524b and 0c263bf.

⛔ Files ignored due to path filters (1)
  • fastlane/metadata/android/en-US/images/featureGraphic.png is 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 update

The Android Gradle Plugin version update from 8.11.0 to 8.11.1 is a typical patch release.


16-16: LGTM: Minor version update

The 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.kt

Ensure 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: OverallAnalyticsSheet

The OverallAnalyticsSheet function is defined with the expected signature (takes state, onDismiss, plus a default modifier) and matches the call in HabitsList.kt. No further changes are needed.

• Verified in app/src/main/java/com/shub39/grit/habits/presentation/component/OverallAnalyticsSheet.kt
• Usage updated correctly in app/src/main/java/com/shub39/grit/habits/presentation/component/HabitsList.kt

app/src/main/java/com/shub39/grit/core/presentation/settings/components/LookAndFeelPage.kt (1)

405-405: LGTM: Theme consistency improvement

Removing 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 configuration

The Color import is needed for the new seedColor parameter in the theme configuration.


79-79: LGTM: Typo fix

Fixed the variable name typo from habitsWithStatueses to habitsWithStatuses.


97-98: LGTM: Consistent variable naming

Updated variable references to use the corrected habitsWithStatuses name.


104-107: LGTM: Theme configuration updates

The 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 API

The ExperimentalMaterial3ExpressiveApi import is needed for the new expressive theme functionality.


8-8: LGTM: API migration to expressive theme

Updated import from DynamicMaterialTheme to DynamicMaterialExpressiveTheme as part of the theme API migration.


11-11: LGTM: Experimental API opt-in

The experimental API opt-in is required for using the Material3 expressive theme features.


17-17: LGTM: Theme component update

Updated from DynamicMaterialTheme to DynamicMaterialExpressiveTheme to use the new expressive theme API.


23-23: LGTM: Parameter name updates

The parameter names were correctly updated to match the new API: useDarkThemeisDark and withAmoledisAmoled.

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 getHabitById method follows good practices with appropriate nullable return type and consistent naming conventions.


15-15: LGTM! Consistent interface design.

The getStatusForHabit method 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 of AnalyticsCard (in OverallAnalyticsSheet.kt and both usages in AnalyticsPage.kt) provides the required title argument. 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 HabitEntity to Habit domain 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 habit parameter instead of habitEntity, 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_analytics string 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 codebase

No occurrences of the old AllAnalyticsSheet remain—rename to OverallAnalyticsSheet is 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 getHabitById implementation 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 getStatusForHabit implementation follows the same pattern as other methods in the repository, properly mapping from entities to domain models.


41-68: Methods Verified: DAO Signatures Correct

Confirmed 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, and progress strings 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/onSurface for 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, and leadingIconColor ensures consistent theming across all list item elements using the animated cardContent color.


183-203: Excellent calendar styling improvements.

The calendar day styling updates enhance visual consistency:

  • secondaryContainer background provides better semantic meaning for completed days
  • onSecondaryContainer text color ensures proper contrast
  • Using animated cardContent color for incomplete days maintains visual hierarchy
app/src/main/java/com/shub39/grit/habits/presentation/component/AnalyticsPage.kt (5)

278-280: LGTM! Proper title parameter usage.

The addition of the title parameter with stringResource(R.string.weekly_progress) aligns with the updated AnalyticsCard signature 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:

  • secondary for month headers
  • secondaryContainer background with onSecondaryContainer text for week headers

This 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_graph to progress makes 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 > 20 instead of newHabitTitle.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 HabitRepo and domain model HabitStatus improve the architecture by following the repository pattern and using domain models instead of database entities.


30-30: Good use of unified repository interface.

Using HabitRepo instead 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 access
  • habitRepo.getStatusForHabit() centralizes status retrieval
  • Domain model habit is used throughout, aligning with the habitNotification function signature from the relevant code snippet
  • Scheduler uses domain model consistently

68-72: Proper domain model usage for habit status.

Creating HabitStatus domain model and using habitRepo.insertHabitStatus() maintains consistency with the repository pattern while preserving the same functionality.

Signed-off-by: shub39 <[email protected]>
@shub39 shub39 merged commit 15ca946 into master Jul 16, 2025
2 checks passed
@shub39 shub39 deleted the dev branch July 16, 2025 03:30
@coderabbitai coderabbitai bot mentioned this pull request Aug 22, 2025
This was referenced Sep 4, 2025
Merged
This was referenced Nov 6, 2025
@coderabbitai coderabbitai bot mentioned this pull request Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants