Enhance onboarding flow with allergy selection, AI ChatBot, and UI updates#19
Enhance onboarding flow with allergy selection, AI ChatBot, and UI updates#19Gaurav-eightinity01 wants to merge 18 commits intodevelopfrom
Conversation
Improved the reliability of allergy selection by ensuring `AddAllergiesSheet` correctly recomposes when chips are toggled or members are switched. Key changes: - Introduced `allergySelectionRevision` and `activeMemberSelections` states to explicitly track and force UI updates. - Wrapped `AddAllergiesSheet` in a `key` block to ensure recomposition when the active member, selection revision, or specific selections change. - Updated `onToggleAllergy` logic to perform immutable updates on `selectedAllergiesByMember` (SnapshotStateMap) to properly trigger state observers. - Added comprehensive logging to track member switching and chip toggle events.
- Refactor `CapsuleStepperRow` to use dynamic width for the active capsule via `onGloballyPositioned`, ensuring the background line length matches the real UI. - Update `CapsuleStepperRow` styling including adjusted padding, spacing, and icon sizes. - Introduce `primaryChipEffect` modifier in `PrimaryButton.kt` to provide a gradient and shadow effect without an outer border, specifically for selected chips. - Update `AllergyScreens.kt` to use the new `primaryChipEffect` for selected onboarding chips.
- Introduced `RegionDefinition` data class and a comprehensive list of regional food traditions (India, Africa, Middle East, East Asia, etc.) to `OnboardingChipData`.
- Implemented `RegionSelectionSection` and `RegionSectionRow` in `AllergyScreens` to support expandable/collapsible region groups.
- Added a `SimpleFlowRow` layout utility for flexible chip arrangement within region sections.
- Updated `OnboardingHost` and `AllergyScreens` to use the new regional UI for step index 4, including a fixed-position navigation button and scrollable content area.
- Refined UI spacing, font sizes, and progress line calculations for better alignment and consistency.
- Added `@SuppressLint("SuspiciousIndentation")` to `OnboardingHost`.
Introduced `StackedCardsComponent`, a swipeable card stack UI with smooth rotation and drag animations. This component is integrated into the onboarding flow for the "Avoid" step, allowing users to navigate through categorized dietary restrictions (Oils & Fats, Animal-Based, etc.) via card swipes. Key changes: - Created `StackedCardsComponent` with support for horizontal dragging, exit animations, and "stack" visual effects. - Added `AvoidOptionChip` and `SimpleFlowRow` to support the new card-based selection UI. - Expanded `OnboardingChipData` to include `avoidCards` definitions and additional chip categories for ethical and taste preferences. - Updated `AllergyScreens` to utilize the new stacked cards UI for the specific "Avoid" question step. - Added a new vector resource `leaf_arrow_circlepath.xml` used as a background element in the cards. - Removed the legacy `StackCards.kt` implementation.
Introduced `StackedCardsComponent`, a swipeable card stack UI with smooth rotation and drag animations. This component is integrated into the onboarding flow for the "Avoid" step, allowing users to navigate through categorized dietary restrictions (Oils & Fats, Animal-Based, etc.) via card swipes. Key changes: - Created `StackedCardsComponent` with support for horizontal dragging, exit animations, and "stack" visual effects. - Added `AvoidOptionChip` and `SimpleFlowRow` to support the new card-based selection UI. - Expanded `OnboardingChipData` to include `avoidCards` definitions and additional chip categories for ethical and taste preferences. - Updated `AllergyScreens` to utilize the new stacked cards UI for the specific "Avoid" question step. - Added a new vector resource `leaf_arrow_circlepath.xml` used as a background element in the cards. - Removed the legacy `StackCards.kt` implementation.
- Consolidate the forward arrow button into a single global component positioned at the bottom-right of the onboarding sheet, replacing multiple redundant instances across different steps. - Update the forward arrow icon to use a new custom vector drawable (`forward_arow_line_1`) with refined styling. - Replace `FlowRowWithRightAlignedButton` with a simpler `SimpleFlowRow` for allergy chip layouts. - Enhance the `AllergyRegionCard` by wrapping sub-region chips in an `AnimatedVisibility` container for smoother expansion transitions. - Adjust header styling in `AllergyRegionCard` to only apply the primary selection effect when a sub-region is actually selected, improving visual clarity.
- Add `emoji_warning` vector drawable asset. - Update `OnboardingHost` to detect if any selected chip ID contains the term "other". - Display a warning icon and a "Something else too, don't worry we'll ask later!" message when an "other" option is selected during onboarding.
…e, fine-tune buttons - OnboardingHost: default selected member to Everyone (ALL) on first launch - AllergyScreens: member avatar uses memoji background color (backgroundColorId/colorHex); fixed 52dp container to prevent layout shift; scaling inner circle with avatar; no-memoji placeholder uses member color + initial letter - OnboardingStep: ADD_FAMILY_FALLING_CAPSULES renamed to FALLING_CAPSULES (both flows) - AuthViewModel: update reference to FALLING_CAPSULES - Fine-tune decision: All Set! text #75990E, both buttons 16sp Nunito SemiBold Co-authored-by: Cursor <cursoragent@cursor.com>
…ned) Reusable: - OnboardingAvatarUtils: shared avatarBackgroundColorForId + memberAvatarBackgroundColor - OnboardingData: EVERYONE_MEMBER_ID constant, labelForChipId for preference text - OnboardingAnimations: AvatarSelectionTween for avatar selection animation - AllergyScreens, OnboardingHost, OnboardingStepScreens use shared color/constant/anim Dietary Preference: - dietary/: DTOs, DietaryPreferenceRepository (GET/POST/PUT/DELETE preferencelists/default) - AuthViewModel.syncDietaryPreferencesFromOnboarding(preferenceText) with logs - OnboardingHost: buildDietaryPreferenceText(), sync on All Set! and on last-step complete - DIETARY_PREFERENCE.md explains flow and logs Co-authored-by: Cursor <cursoragent@cursor.com>
- Add persistence methods in OnboardingPersistence for saving/restoring allergy selections state (selected chips per member, active member ID, step index) - Restore allergy selections on app restart and rebuild flat union set for UI display - Add comprehensive logging throughout persistence layer and OnboardingHost for debugging selection state issues - Fix issue where restored selections weren't being applied to UI immediately after restart - Clear allergy selections state when onboarding is reset Co-authored-by: Cursor <cursoragent@cursor.com>
…ber + Everyone)
- Add FoodNotesRepository: GET family/food-notes/all, PUT family/food-notes (Everyone), PUT family/members/{id}/food-notes (per member), 409 retry
- Add FoodNotesDto: FoodNotesAllResponse, FoodNotesResponse (JsonObject content)
- Add OnboardingChipData.foodNotesStepIds and buildFoodNotesContentFromChipIds() for API content shape
- AuthViewModel.syncFoodNotesFromOnboarding(): sync each selectedAllergiesByMember key to family or member note
- OnboardingHost: call syncFoodNotesFromOnboarding() when user taps All Set or completes last step (with dietary preference sync)
- Update DIETARY_PREFERENCE.md with food-notes API section
Co-authored-by: Cursor <cursoragent@cursor.com>
… family flow
- **Dynamic Onboarding:**
- Integrated `dynamicJsonData.json` to drive onboarding step order, questions, and chip options (aligning with iOS).
- Added `DynamicStepsLoader` and `DynamicStepsDto` to handle loading and parsing of the asset-based step configuration.
- Updated `OnboardingChipData` to dynamically generate chip definitions and mapping from the loaded JSON data.
- Enhanced `OnboardingHost` to auto-scroll to the current card step and handle initial restoration of selections more reliably.
- **UI & Animation:**
- Added Lottie-based confetti animation to the family member assignment success screen.
- Updated `FallingCapsulesScreen` with refined gravity physics, mass scaling, and updated labels/emojis.
- Fine-tuned avatar selection UI with updated icons and background color logic.
- Updated launcher icons and background color assets.
- **Family & Auth:**
- Implemented "Bite Buddy" default family creation for the "Just Me" onboarding flow.
- Updated `SignInWhoIsThisForSheet` to support independent loading states for different family creation paths.
- Enhanced `FoodNotesRepository` and `AuthViewModel` with improved logging and success tracking for onboarding data sync.
- **Misc:**
- Added `lottie-compose` dependency.
- Fixed step index bounds checking in `AllergyScreens`.
- **New Feature**: Added `ChatBotIntroScreen`, a bottom-sheet UI for introducing "IngrediBot" when users select "Other" dietary options.
- **Onboarding Restoration**:
- Refactored `OnboardingHost` to restore allergy selections and step progress asynchronously from persistence without blocking the main thread.
- Fixed a UI flicker by showing a blank background until restoration is complete.
- Updated `CapsuleStepperRow` to derive and maintain the furthest reached step (`maxReachedIndex`) across app restarts, ensuring visited steps remain highlighted.
- **UI/UX Refinements**:
- Updated `AllergyScreens` chip styling to use white text when selected for better contrast.
- Improved `DynamicStepsLoader` by moving JSON asset loading to a background dispatcher (`Dispatchers.IO`).
- **Dependency/Project**:
- Added `androidx.compose.material:material-icons-extended` to `libs.versions.toml`.
- Updated local deployment target to Pixel 8 Pro emulator.
Introduce an AI-driven interaction layer and a final preference summary screen to the onboarding flow. This includes a new ChatBot conversation interface, an intro screen for AI suggestions, and a "Food Notes" summary view.
Key Changes:
- **New AI ChatBot Flow**:
- Added `ChatBotIntroScreen` to transition users into the AI interaction.
- Created `ChatBotConversationScreen` featuring a scrollable message list with bot/user bubbles and an IME-aware input field.
- Integrated logic to detect "Other" selections and trigger specific AI prompts.
- **Preference Summary**:
- Introduced `PreferenceSummaryScreen` to provide a categorized "Food Notes" overview of all user selections (Allergies, Avoid, Lifestyle, etc.).
- Added `PreferenceCapsuleCard` and `SelectedChipPill` components to display summarized preferences with member-specific avatars.
- **Refactored Onboarding UI**:
- Extracted auth-related sheet content into `OnboardingAuthSheetContent`.
- Moved family invite logic and UI into `OnboardingFamilySheet`.
- Organized shared components (FlowRow, Falling Capsules, Stepper utils) into a dedicated `onboarding.ui.components` package.
- Updated `OnboardingAllergyBackground` to support the new summary state and auto-scrolling to active preference cards.
- **UI/UX Enhancements**:
- Refined `FallingCapsulesScreen` physics (increased sub-stepping, adjusted gravity/restitution) for smoother animations aligned with iOS.
- Standardized member avatar small components (`CapsuleMemberAvatarSmall`) for use within summary chips.
- Added `hugeicons_ai_magic` and `msg_send_arrow` vector assets.
Co-authored-by: Cursor <cursoragent@cursor.com>
…ietary_preference_2
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
iAmVishal16
left a comment
There was a problem hiding this comment.
IDE files committed.
Excessive Log.d statements in production code — should be gated behind BuildConfig.DEBUG
app/src/main/java/lc/fungee/Ingredicheck/onboarding/ui/PreferenceSummaryScreen.kt
Show resolved
Hide resolved
app/src/main/java/lc/fungee/Ingredicheck/onboarding/ui/OnboardingHost.kt
Show resolved
Hide resolved
app/src/main/java/lc/fungee/Ingredicheck/onboarding/ui/AllergyScreens.kt
Show resolved
Hide resolved
- Gate Auth, onboarding, repo, and WebView debug logs behind BuildConfig.DEBUG - Fix typos in dynamicJsonData.json and preference summary copy to match product wording Made-with: Cursor
Standardized `BuildConfig` references across multiple modules by updating the import path from the local package to `com.russhwolf.settings.BuildConfig`. Affected components: - `AppleLoginWebViewActivity` - `DietaryPreferenceRepository` - `FoodNotesRepository` - `OnboardingFamilySheet` - `OnboardingAuthSheet` - `AuthViewModel`
iAmVishal16
left a comment
There was a problem hiding this comment.
Code Review — Remaining Issues
5 of the originally flagged issues have been fixed (great work!), but the following still need attention:
1. Infinite recursion risk in 409 retry (FoodNotesRepository.kt)
updateFamilyFoodNotes and updateMemberFoodNotes recursively call themselves on a 409 conflict with no max retry limit. If the server keeps returning 409, this will stack overflow. Please add a max retry count (e.g., 2-3 attempts).
2. Wrong app name — "IngredientCheck" should be "IngrediCheck"
OnboardingStepScreens.kt:1243OnboardingHost.kt:536
Both have: "Add profiles so IngredientCheck can personalize results for each person."
3. Commented-out code in ChatBotConversationScreen.kt
Line 175 still has a commented-out .shadow( block. Please remove before merge.
4. Modifier.Companion instead of idiomatic Modifier
98 occurrences across 8 files. Modifier.Companion is functionally equivalent but non-idiomatic — should be just Modifier. Lower priority but widespread.
5. Hardcoded invite code check — "ABCXYZ" (OnboardingAuthSheet.kt:64)
if (vm.inviteCode == "ABCXYZ") {
vm.inviteCodeError = true
}This looks like placeholder/test logic. Should this be replaced with actual server-side validation, or is it intentional? Please clarify or remove.
Add AI ChatBot and Preference Summary flow to onboarding
Introduce an AI-driven interaction layer and a final preference summary screen to the onboarding flow. This includes a new ChatBot conversation interface, an intro screen for AI suggestions, and a "Food Notes" summary view.
Key Changes:
ChatBotIntroScreento transition users into the AI interaction.ChatBotConversationScreenfeaturing a scrollable message list with bot/user bubbles and an IME-aware input field.PreferenceSummaryScreento provide a categorized "Food Notes" overview of all user selections (Allergies, Avoid, Lifestyle, etc.).PreferenceCapsuleCardandSelectedChipPillcomponents to display summarized preferences with member-specific avatars.OnboardingAuthSheetContent.OnboardingFamilySheet.onboarding.ui.componentspackage.OnboardingAllergyBackgroundto support the new summary state and auto-scrolling to active preference cards.FallingCapsulesScreenphysics (increased sub-stepping, adjusted gravity/restitution) for smoother animations aligned with iOS.CapsuleMemberAvatarSmall) for use within summary chips.hugeicons_ai_magicandmsg_send_arrowvector assets.Co-authored-by: Cursor cursoragent@cursor.com