Fix ATM Upgrade Logic and UI Deprecations#119
Conversation
- Updated `StallUpgradeManager` to explicitly return an empty upgrade list for ATM stalls, preventing unintended upgrades. - Added a safety check in `MainViewModel.applyUpgrade` to handle stalls with no available upgrades, avoiding potential crashes. - Replaced the deprecated `quadraticBezierTo` call with `quadraticTo` in `GameBoard` to align with the current Jetpack Compose Path API. - Restored the explicit stall occupancy check in `onCellClick` to maintain robust placement logic. Co-authored-by: candour <4670475+candour@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
📝 WalkthroughWalkthroughThe PR adds explicit handling for ATM stall upgrades by returning no available stats, updates the upgrade application flow with an early-return check when no upgrade options exist, and fixes a shield icon path drawing API call. ChangesATM Stall Upgrade Handling
Shield Icon Visual Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt (1)
33-34: ⚡ Quick winRemove the now-dead
elsebranch to gain compile-time exhaustiveness.With all 8
StallTypevalues explicitly covered (lines 27–33), theelseat line 34 is unreachable. More importantly, keeping it hides future mistakes: if a newStallTypeis added, Kotlin will silently route it to theelsefallback and assign it a possibly wrong upgrade list. Removingelseforces a compile error at that point.♻️ Proposed change
StallType.CHICKEN_RICE -> listOf("Damage", "Range", "Rate") StallType.ATM -> emptyList() - else -> if (stall.stallType.isUtility) listOf("Range", "Rate") else listOf("Damage", "Range", "Rate") } }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 04ff3b33-8778-40fb-945b-ebc80a7d66eb
📒 Files selected for processing (3)
app/src/main/java/com/messark/hawker/MainViewModel.ktapp/src/main/java/com/messark/hawker/ui/components/GameBoard.ktapp/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt
This PR addresses several minor issues and bugs:
MainViewModelto prevent attempts to randomly select upgrades for stalls that have none.quadraticBezierToinGameBoard.ktby migrating to the recommendedquadraticToAPI.PR created automatically by Jules for task 4676776508390294265 started by @candour
Summary by CodeRabbit
Bug Fixes