-
Notifications
You must be signed in to change notification settings - Fork 0
Add offline awareness to AI button and update offline FG calculation #90
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
WalkthroughBumps app version metadata to 3.2.6 (Android versionCode 190→191), updates resource/runtime version strings, adds offline-aware logic to the AI analysis button, and changes default attenuation to 0% when no yeast entries exist for FG calculation. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related issues
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Comment |
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: 2
🧹 Nitpick comments (1)
src/components/recipes/AIAnalysisButton.tsx (1)
126-154: Consider adding offline awareness toAIAnalysisIconButton.The main
AIAnalysisButtoncomponent now includes offline detection, butAIAnalysisIconButtondoes not (Line 134 still usesconst isDisabled = disabled || loading;without checkingisOffline). This inconsistency means the icon button could be enabled while offline.If both components should respect offline state, apply similar logic to
AIAnalysisIconButton:export function AIAnalysisIconButton({ loading = false, disabled = false, onPress, testID = TEST_IDS.ai.analysisIconButton, }: Pick<AIAnalysisButtonProps, "loading" | "disabled" | "onPress" | "testID">) { const theme = useTheme(); const styles = createAIStyles(theme); - const isDisabled = disabled || loading; + const { isOffline } = useNetwork(); + const isDisabled = disabled || isOffline || loading;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (6)
android/app/build.gradle(1 hunks)android/app/src/main/res/values/strings.xml(1 hunks)app.json(3 hunks)package.json(1 hunks)src/components/recipes/AIAnalysisButton.tsx(2 hunks)src/services/brewing/OfflineMetricsCalculator.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/recipes/AIAnalysisButton.tsx (1)
src/contexts/NetworkContext.tsx (1)
useNetwork(100-106)
🔇 Additional comments (6)
package.json (1)
4-4: LGTM!Version bump is consistent with the other files in the PR.
app.json (1)
6-6: LGTM!Version metadata updates are consistent across the app configuration, Android build files, and package manifest.
Also applies to: 19-19, 61-61
android/app/src/main/res/values/strings.xml (1)
4-4: LGTM!Runtime version string correctly updated to match the version bump across the project.
src/services/brewing/OfflineMetricsCalculator.ts (1)
107-110: Excellent improvement to brewing science accuracy.Changing the default attenuation from 75% to 0% when no yeast is present is scientifically correct—without yeast, there's no fermentation, so FG should equal OG. This properly aligns the offline calculator with backend behavior.
android/app/build.gradle (1)
95-96: LGTM!Version code and name correctly incremented to align with the 3.2.6 release.
src/components/recipes/AIAnalysisButton.tsx (1)
82-86: Well-designed offline user experience.The conditional label logic clearly communicates to users why the AI feature is unavailable when offline, improving the overall UX. The fallback to offline mode when the context is unavailable is also a sensible defensive approach.
- Add offline awareness to AIAnalysisIconButton
Summary by CodeRabbit
New Features
Improvements
Chores
✏️ Tip: You can customize this high-level summary in your review settings.