fix: respect system rotation lock in PWA#519
Merged
Merged
Conversation
chenyme
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
问题:Android PWA 在系统未开启自动旋转时,仍会跟随设备旋转为横屏。
根因:后端动态生成的 Web App Manifest 中硬编码了
"orientation": "any"。Android 上安装的 PWA 会被打包为 WebAPK,manifest 中显式声明的
orientation(包括
"any")会被映射为传感器驱动的android:screenOrientation,从而忽略系统的自动旋转开关。只有不声明该字段时,WebAPK 才会遵循系统旋转锁定。
方案:从 manifest 响应中移除
orientation字段(handler + DTO),并同步更新生成物(Swagger 文档与 api-contract 类型)。移除后 manifest
不再包含
orientation键,WebAPK 走系统默认行为:系统锁定旋转时保持竖屏,开启自动旋转时自由旋转。
Fixes #516
Change type
Affected areas
Verification
通过 GitHub Actions 验证并已在 Android 手机上手动验证
Screenshots, API examples, or logs
Configuration, migration, and compatibility notes
Documentation
Security and privacy
Checklist
.pycfiles,.envfiles, and local storage data are not committed.