Skip to content

Fix ATM Upgrade Logic and UI Deprecations#119

Merged
candour merged 1 commit into
mainfrom
fix-atm-upgrades-and-deprecations-4676776508390294265
May 4, 2026
Merged

Fix ATM Upgrade Logic and UI Deprecations#119
candour merged 1 commit into
mainfrom
fix-atm-upgrades-and-deprecations-4676776508390294265

Conversation

@candour

@candour candour commented May 4, 2026

Copy link
Copy Markdown
Owner

This PR addresses several minor issues and bugs:

  1. ATM Upgrade Logic: ATMs were incorrectly showing default utility upgrades (Range/Rate). They are now correctly defined as non-upgradeable.
  2. Crash Prevention: Added a guard in MainViewModel to prevent attempts to randomly select upgrades for stalls that have none.
  3. UI Deprecation: Fixed a use of quadraticBezierTo in GameBoard.kt by migrating to the recommended quadraticTo API.
  4. Code Quality: Maintained the robust occupancy check during stall placement to prevent accidental overlaps.

PR created automatically by Jules for task 4676776508390294265 started by @candour

Summary by CodeRabbit

Bug Fixes

  • Fixed an issue where upgrade selection could be attempted when no upgrades were available.
  • Improved armor shield icon rendering.
  • Enhanced upgrade availability handling for ATM stalls.

- 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>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

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

Changes

ATM Stall Upgrade Handling

Layer / File(s) Summary
Upgrade Availability Logic
app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt
getAvailableUpgradeStats now explicitly returns emptyList() for StallType.ATM, preventing any stat upgrades for ATM stalls.
Upgrade Application Flow
app/src/main/java/com/messark/hawker/MainViewModel.kt
applyUpgrade checks if availableStats is empty and early-returns from the update block to skip upgrade processing when no stats are available.

Shield Icon Visual Fix

Layer / File(s) Summary
Enemy Rendering
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
Shield icon path construction now calls quadraticTo(...) instead of quadraticBezierTo(...) for the curved segment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: fixing ATM upgrade logic and addressing UI deprecations with quadraticBezierTo replacement.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-atm-upgrades-and-deprecations-4676776508390294265

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt (1)

33-34: ⚡ Quick win

Remove the now-dead else branch to gain compile-time exhaustiveness.

With all 8 StallType values explicitly covered (lines 27–33), the else at line 34 is unreachable. More importantly, keeping it hides future mistakes: if a new StallType is added, Kotlin will silently route it to the else fallback and assign it a possibly wrong upgrade list. Removing else forces 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6276c09 and de5ea37.

📒 Files selected for processing (3)
  • app/src/main/java/com/messark/hawker/MainViewModel.kt
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
  • app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.kt

@candour
candour merged commit 540c22c into main May 4, 2026
3 checks passed
@candour
candour deleted the fix-atm-upgrades-and-deprecations-4676776508390294265 branch May 4, 2026 04:06
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.

1 participant