From 3c64b37fb91a345f72129401d65ff325de441447 Mon Sep 17 00:00:00 2001 From: kdletters Date: Thu, 18 Jun 2026 10:09:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E5=BC=80=E7=A7=BB=E5=8A=A8=E5=A3=B3?= =?UTF-8?q?=E6=A8=AA=E7=AB=96=E5=B1=8F=E6=96=B9=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 Expo 移动壳方向配置改为随设备方向 补充移动壳方向策略门禁和共享决策文档 --- apps/mobile-shell/app.json | 2 +- apps/mobile-shell/scripts/check-config.mjs | 4 ++++ apps/mobile-shell/scripts/check-expo-config.mjs | 2 +- docs/project-memory/shared-memory/decision-log.md | 1 + ...【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/mobile-shell/app.json b/apps/mobile-shell/app.json index 0b33ae7b9..106e2e6d6 100644 --- a/apps/mobile-shell/app.json +++ b/apps/mobile-shell/app.json @@ -4,7 +4,7 @@ "slug": "genarrative-mobile-shell", "scheme": "genarrative", "version": "0.1.0", - "orientation": "portrait", + "orientation": "default", "icon": "./assets/icon.png", "userInterfaceStyle": "automatic", "splash": { diff --git a/apps/mobile-shell/scripts/check-config.mjs b/apps/mobile-shell/scripts/check-config.mjs index b2d688faf..552058f6b 100644 --- a/apps/mobile-shell/scripts/check-config.mjs +++ b/apps/mobile-shell/scripts/check-config.mjs @@ -196,6 +196,10 @@ if (appConfig.version !== '0.1.0') { throw new Error('mobile shell app version must be 0.1.0'); } +if (appConfig.orientation !== 'default') { + throw new Error('mobile shell must allow device orientation for landscape-capable H5 games'); +} + if (packageConfig.version !== appConfig.version) { throw new Error('mobile shell package version must match app.json version'); } diff --git a/apps/mobile-shell/scripts/check-expo-config.mjs b/apps/mobile-shell/scripts/check-expo-config.mjs index 0f3a7ec26..0a419fd12 100644 --- a/apps/mobile-shell/scripts/check-expo-config.mjs +++ b/apps/mobile-shell/scripts/check-expo-config.mjs @@ -74,7 +74,7 @@ assertEqual(expoConfig.slug, 'genarrative-mobile-shell', 'slug'); assertEqual(expoConfig.scheme, 'genarrative', 'scheme'); assertEqual(expoConfig.version, packageConfig.version, 'version'); assertEqual(expoConfig.version, appConfig.version, 'app version'); -assertEqual(expoConfig.orientation, 'portrait', 'orientation'); +assertEqual(expoConfig.orientation, 'default', 'orientation'); assertEqual(expoConfig.userInterfaceStyle, 'automatic', 'userInterfaceStyle'); assertEqual(expoConfig.icon, './assets/icon.png', 'icon'); assertEqual(expoConfig.splash?.image, './assets/icon.png', 'splash image'); diff --git a/docs/project-memory/shared-memory/decision-log.md b/docs/project-memory/shared-memory/decision-log.md index 0367adf87..26b629139 100644 --- a/docs/project-memory/shared-memory/decision-log.md +++ b/docs/project-memory/shared-memory/decision-log.md @@ -40,6 +40,7 @@ - 2026-06-18 移动图片拍摄导入:Expo 壳新增 `file.captureImage` HostBridge capability,通过 `expo-image-picker` 请求相机权限并打开系统相机拍摄图片,沿用 `file.importImage` 的 MIME、体积、base64 和文件名清洗规则,成功回传 `action=captured`,不暴露设备本地 URI,也不请求麦克风权限;Tauri 壳不声明该能力,不伪造桌面拍摄。 - 2026-06-18 H5 图片上传接入宿主导入:`CreativeImageInputPanel` 在 `native_app` 且声明 `file.importImage` / `file.captureImage` 时,主图上传和描述参考图上传可分别调用 `importHostImageFile()` / `captureHostImageFile()`,并把宿主返回的 base64 图片转换为现有 `File` 回调;浏览器、小程序和未声明能力的裁剪壳继续走原生 `` 路径,不新增玩法侧上传分叉。 - 2026-06-18 移动壳安全区:Expo 壳根布局使用 `react-native-safe-area-context` 的 `SafeAreaProvider` 与四边 `SafeAreaView` 保护 WebView,避免 H5 主站内容贴进 iOS 刘海、底部 Home Indicator、Android 状态栏或横屏边缘;该能力属于宿主壳布局保护,不新增 H5 占位 UI,不改变玩法 runtime 或 HostBridge capability。 +- 2026-06-18 移动壳方向策略:Expo 壳 `orientation` 固定为 `default`,不锁竖屏或横屏;后续固定玩法和 AI H5 sandbox 的方向需求由设备方向、H5 响应式布局和玩法自身画布适配承接,壳层只负责安全区、WebView 容器和 HostBridge。移动壳配置检查和 Expo public config smoke 会拒绝重新锁定 portrait / landscape。 - 2026-06-18 移动壳启动 URL 归一:Expo 壳的 `EXPO_PUBLIC_GENARRATIVE_WEB_URL` 和 deep link 基准地址只接受 `http:` / `https:` 绝对 URL,空值、相对路径、`file:`、`javascript:` 等非法配置回退到默认 H5 地址后再附加 `native_app` 宿主上下文;deep link 仍只映射同源 H5 路径,禁止把外域或危险协议页面装进带完整 HostBridge 的 WebView。 - 2026-06-18 移动壳默认入口:Expo 壳默认 H5 地址固定为 `https://app.genarrative.world/`,开发联调本机 Vite 必须显式设置 `EXPO_PUBLIC_GENARRATIVE_WEB_URL=http://127.0.0.1:3000/` 或其它允许的 `http:` / `https:` 地址;生产包不得在未配置环境变量时加载设备本机 localhost。 - 2026-06-18 移动壳安装包身份:Expo 移动壳的 iOS bundle identifier 与 Android package 统一固定为 `world.genarrative.mobile`,应用版本固定为 `0.1.0`,iOS `buildNumber` 从字符串 `"1"` 起步,Android `versionCode` 从整数 `1` 起步;后续分发安装包时递增构建号 / versionCode,产品版本号按发布节奏调整。移动壳配置检查会校验 `app.json` 与 `package.json` 版本一致,并拒绝缺失或漂移的包标识,当前不写入假商店元数据、假更新端点或占位渠道 SDK 配置。 diff --git a/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md b/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md index 1f966f666..6401a5bde 100644 --- a/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md +++ b/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md @@ -273,6 +273,8 @@ GameBridge 禁止: 2026-06-18 追加:移动壳根布局接入 `react-native-safe-area-context`,用 `SafeAreaProvider` 和四边 `SafeAreaView` 承接 iOS 刘海、底部 Home Indicator、Android 状态栏和横屏边缘安全区;WebView 仍加载同一 H5 主站,不改变 H5 路由、玩法 runtime 或 HostBridge capability。该能力属于宿主壳布局保护,不在 H5 内补额外占位 UI。 +2026-06-18 追加:移动壳不锁定竖屏,Expo `orientation` 固定为 `default`,由 iOS / Android 设备方向和 H5 响应式布局共同承接竖屏、横屏与后续横屏玩法;壳层只负责安全区、WebView 容器和 HostBridge,不为某一类玩法硬编码方向。`npm run mobile-shell:typecheck` 与 `npm run mobile-shell:config` 会拒绝重新锁回 portrait / landscape。 + 2026-06-18 追加:移动壳启动 H5 URL 增加宿主侧归一。`EXPO_PUBLIC_GENARRATIVE_WEB_URL` 和 deep link 基准地址只接受 `http:` / `https:` 绝对 URL,空值、相对路径、`file:`、`javascript:` 等非法配置统一回退到默认 H5 地址,再附加 `native_app` 宿主上下文;deep link 仍只允许映射到同源 H5 路径。该保护只防止移动壳启动崩溃或加载危险协议,不把外域页面装进带完整 HostBridge 的 WebView。 2026-06-18 追加:移动壳默认 H5 地址固定为 `https://app.genarrative.world/`。开发联调如需加载本机 Vite,必须显式设置 `EXPO_PUBLIC_GENARRATIVE_WEB_URL=http://127.0.0.1:3000/` 或其它允许的 `http:` / `https:` 地址;生产包不得在未配置环境变量时默认加载设备本机 localhost。