fix(io): accept hardware button names case-insensitively - #479
mobile-kevin wants to merge 1 commit into
Conversation
The help says "Button names are case-insensitive", but PressButton looked the name up in per-platform maps keyed by upper-case names, so `home`, `Home` and `volume_up` were rejected with "unsupported button" while only `HOME` worked. Normalize the name once in ButtonCommand (trim + upper-case) before dispatching to the device, so every platform accepts any case. Adds a unit test for the normalization and an e2e test that presses HOME in several cases.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: mobile-next/mobilecli/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughButton names are trimmed and converted to uppercase before validation, pressing, and reporting. Unit tests cover normalization, and an Android integration test checks HOME button names with different letter casing. ChangesButton name normalization
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Button names now accept mixed casing and surrounding whitespace while rejecting whitespace-only input. No actionable merge-blocking risk is identified; merge after normal checks pass. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
Comment |
Problem
The help states "Button names are case-insensitive", but
io buttonlooked the name up in per-platform maps keyed by upper-case names (HOME,VOLUME_UP). Sohome,Home,volume_upall failed with "unsupported button" and only the exact upper-case form worked, on both Android and iOS.Fix
Normalize the button name once in
ButtonCommand(trim + upper-case) before dispatching to the device, so every platform accepts any case. The empty check and success message use the normalized name.Tests
normalizeButtonName(case folding + trimming, empty/whitespace).home/Home/hOmEand verifies the launcher returns each time.Verified live:
home/Home/HOME/volume_upall succeed on the emulator and simulator; a bogus name is still rejected.Summary by CodeRabbit
home,Home, andhOmEwork consistently. Empty and whitespace-only names are rejected.