fix(controller): align device events and hvigor version#42
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughArkTS 测试视图新增 Changes手柄 D-Pad 状态与设备信息初始化
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@nativelib/src/main/cpp/game_controller_native.cpp`:
- Around line 1024-1026: The variable deviceType is declared without
initialization before being passed to OH_GameDevice_DeviceInfo_GetDeviceType. If
the API call fails or behaves unexpectedly, this uninitialized variable would
result in undefined values being assigned to info.deviceType. Initialize the
deviceType variable to a default value (such as 0) at the point of declaration
to ensure a known state. Apply this fix in all three locations where this
pattern occurs: around line 1024 in the primary location, and also at the
similar code sections around lines 458 and 1190.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f61c2592-76de-4bdd-bfec-ad55dad09738
⛔ Files ignored due to path filters (2)
hvigor/hvigor-config.json5is excluded by!hvigor/**hvigor/package.jsonis excluded by!hvigor/**
📒 Files selected for processing (2)
entry/src/main/ets/components/test/GameControllerTestView.etsnativelib/src/main/cpp/game_controller_native.cpp
改了啥呀
为啥要改
验证
git diff --checkclang++ --target=aarch64-linux-ohos --sysroot=/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/native/sysroot -D__OHOS__ -std=c++17 -I nativelib/src/main/cpp -fsyntax-only nativelib/src/main/cpp/game_controller_native.cppNODE_PATH="$PWD/node_modules" DEVECO_SDK_HOME="/Applications/DevEco-Studio.app/Contents/sdk" OHOS_BASE_SDK_HOME="/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony" JAVA_HOME="/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home" PATH="/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home/bin:$PATH" bash hvigorw --stacktrace --mode module -p module=entry assembleHap --no-daemonSummary by CodeRabbit
发行说明