Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba121f1df4 |
@@ -1,189 +0,0 @@
|
||||
name: Build iOS IPA
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ["main"]
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
ios:
|
||||
name: iOS Build (IPA)
|
||||
runs-on: macos-latest
|
||||
permissions:
|
||||
contents: write
|
||||
env:
|
||||
APPLE_DEVELOPMENT_TEAM: "ABCDE12345"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 对齐版本号
|
||||
id: ver
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||
V="${GITHUB_REF_NAME#v}"
|
||||
else
|
||||
V="$(node -p "require('./src-tauri/tauri.conf.json').version")"
|
||||
fi
|
||||
echo "version=$V" >> "$GITHUB_OUTPUT"
|
||||
node -e "const fs=require('fs');for(const p of ['src-tauri/tauri.conf.json','package.json']){const j=JSON.parse(fs.readFileSync(p));j.version=process.argv[1];fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n')}" "$V"
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-ios,aarch64-apple-ios-sim
|
||||
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri -> target
|
||||
key: ios-build
|
||||
|
||||
- name: 安装依赖
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: 初始化 iOS Xcode 工程
|
||||
run: |
|
||||
pnpm tauri ios init --ci || pnpm tauri ios init
|
||||
# 确保 iOS Info.plist(含 ~iphone / ~ipad 变体)支持横竖屏切换及 ATS
|
||||
for plist in $(find src-tauri/gen/apple -name "Info.plist" 2>/dev/null); do
|
||||
for key in "UISupportedInterfaceOrientations" "UISupportedInterfaceOrientations~iphone" "UISupportedInterfaceOrientations~ipad"; do
|
||||
/usr/libexec/PlistBuddy -c "Delete :${key}" "$plist" 2>/dev/null || true
|
||||
/usr/libexec/PlistBuddy -c "Add :${key} array" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :${key}:0 string UIInterfaceOrientationPortrait" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :${key}:1 string UIInterfaceOrientationLandscapeLeft" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :${key}:2 string UIInterfaceOrientationLandscapeRight" "$plist"
|
||||
done
|
||||
/usr/libexec/PlistBuddy -c "Delete :NSAppTransportSecurity" "$plist" 2>/dev/null || true
|
||||
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity dict" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" "$plist"
|
||||
done
|
||||
env:
|
||||
APPLE_DEVELOPMENT_TEAM: "ABCDE12345"
|
||||
|
||||
- name: 构建 iOS 应用与打包 IPA
|
||||
shell: bash
|
||||
env:
|
||||
APPLE_DEVELOPMENT_TEAM: "ABCDE12345"
|
||||
run: |
|
||||
V="${{ steps.ver.outputs.version }}"
|
||||
mkdir -p artifacts
|
||||
|
||||
# 1. 确保前端编译产物就绪
|
||||
pnpm build
|
||||
|
||||
# 2. 执行 Tauri iOS 自动化构建(免证书签名,激活 custom-protocol 确保为生产打包模式)
|
||||
echo "=== 执行 Tauri iOS 构建 (--no-sign --features custom-protocol) ==="
|
||||
pnpm tauri ios build --no-sign --ci --features custom-protocol || true
|
||||
|
||||
# 3. 检查是否已直接生成 IPA
|
||||
IPA_PATH=$(find src-tauri/gen/apple -name "*.ipa" 2>/dev/null | head -n 1 || true)
|
||||
if [ -n "$IPA_PATH" ] && [ -f "$IPA_PATH" ]; then
|
||||
echo "=== 发现生成的 IPA: $IPA_PATH ==="
|
||||
cp "$IPA_PATH" "artifacts/HGhub_${V}_ios.ipa"
|
||||
fi
|
||||
|
||||
# 4. 若未直接生成 IPA,寻找 .app 或通过 xcodebuild 归档编译
|
||||
if [ ! -s "artifacts/HGhub_${V}_ios.ipa" ]; then
|
||||
APP_PATH=$(find src-tauri/gen/apple -name "*.app" -type d 2>/dev/null | head -n 1 || true)
|
||||
if [ -z "$APP_PATH" ]; then
|
||||
echo "=== 未在 gen/apple 找到 .app,调用 xcodebuild 编译 Release ==="
|
||||
PROJECT_PATH=$(find src-tauri/gen/apple -name "*.xcodeproj" 2>/dev/null | head -n 1 || true)
|
||||
SCHEME_NAME=$(xcodebuild -list -project "$PROJECT_PATH" 2>/dev/null | awk '/Schemes:/{flag=1;next} flag && NF{print $1;exit}' || true)
|
||||
if [ -z "$SCHEME_NAME" ]; then
|
||||
SCHEME_NAME="huangguo-client_iOS"
|
||||
fi
|
||||
echo "项目: $PROJECT_PATH, Scheme: $SCHEME_NAME"
|
||||
xcodebuild build \
|
||||
-project "$PROJECT_PATH" \
|
||||
-scheme "$SCHEME_NAME" \
|
||||
-configuration Release \
|
||||
-destination "generic/platform=iOS" \
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
-derivedDataPath build_output
|
||||
APP_PATH=$(find build_output -name "*.app" -type d 2>/dev/null | head -n 1 || true)
|
||||
fi
|
||||
|
||||
if [ -n "$APP_PATH" ] && [ -d "$APP_PATH" ]; then
|
||||
echo "=== 打包 APP 目录: $APP_PATH 为 IPA ==="
|
||||
rm -rf Payload
|
||||
mkdir -p Payload
|
||||
cp -r "$APP_PATH" Payload/
|
||||
zip -qr "artifacts/HGhub_${V}_ios.ipa" Payload
|
||||
rm -rf Payload
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -s "artifacts/HGhub_${V}_ios.ipa" ]; then
|
||||
echo "=== IPA 打包成功 ==="
|
||||
ls -lh artifacts/
|
||||
|
||||
# 5. 校验 IPA 是否为真正的生产包(验证不含 localhost:1420 且静态资源嵌入)
|
||||
echo "=== 校验生产包模式 ==="
|
||||
mkdir -p /tmp/verify_ipa
|
||||
unzip -q -o "artifacts/HGhub_${V}_ios.ipa" -d /tmp/verify_ipa
|
||||
BIN_PATH=$(find /tmp/verify_ipa -type f -name "HGhub" | head -n 1 || true)
|
||||
if [ -n "$BIN_PATH" ]; then
|
||||
if strings "$BIN_PATH" | grep -q "localhost:1420"; then
|
||||
echo "::error::警告:构建产物依然包含 localhost:1420,处于 dev 模式!"
|
||||
exit 1
|
||||
fi
|
||||
echo "=== 生产模式校验通过:未包含 devUrl,静态前端资源已内置 ==="
|
||||
fi
|
||||
rm -rf /tmp/verify_ipa
|
||||
else
|
||||
echo "::error::未能生成有效的 iOS IPA 文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 上传 IPA 产物
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: HGhub-iOS-IPA
|
||||
path: artifacts/*
|
||||
if-no-files-found: error
|
||||
|
||||
- name: 发布 iOS GitHub Release
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
V="${{ steps.ver.outputs.version }}"
|
||||
TAG="v${V}-ios"
|
||||
NOTES="## HGhub iOS 增强版 (v${V})
|
||||
|
||||
### ✨ 核心特性
|
||||
- **沉浸式竖屏刷剧流**:支持首页无限推荐流、题材分类、三大榜单(热门/推荐/潜力)、搜索、吃瓜社区图文与视频帖、选集与历史续播。
|
||||
- **原生横竖屏智能切换**:横屏视频支持一键「横屏全屏」(调用 iOS 原生屏幕方向旋转),支持手机物理横置自动全屏、竖回自动退出,独立固定舞台层渲染不跑偏、不闪封面。
|
||||
- **丰富触控手势**:
|
||||
- **双指自由缩放(1x~4x)与平移**:竖屏观看横屏视频可自由缩放,并提供「放大铺满 / 完整适应 / 还原缩放」胶囊按钮;
|
||||
- **单击清屏 / 双击暂停**:单击屏幕隐藏所有控件与遮罩纯享画面,双击屏幕暂停/播放;
|
||||
- **长按 2.0x 倍速 + 上滑锁定**:长按画面开启 2.0x 倍速,上滑即可锁定倍速;
|
||||
- **左右横滑预览定位**:任意位置横滑精准跳转进度。
|
||||
- **HLS 播放稳定性加固**:内置 AES Key 与分片内存缓存、拖动进度条防卡死自愈重连、全屏旋转过渡期持续保活与片尾自动连播下一集。
|
||||
- **多线路与镜像测速**:内置固定主备线路 + 自动抓取最新镜像域名 + 一键延迟测速切换。
|
||||
|
||||
### 📲 安装说明(免证书生产包 \`.ipa\`)
|
||||
1. **TrollStore(巨魔商店)**:下载 \`HGhub_${V}_ios.ipa\` 后直接导入巨魔永久安装。
|
||||
2. **AltStore / SideStore / Sideloadly**:使用个人 Apple ID 自签安装。
|
||||
3. **轻松签(ESign)/ 牛蛙助手 / Feather / 全能签**:导入证书签名后直接安装。"
|
||||
|
||||
if gh release view "$TAG" >/dev/null 2>&1; then
|
||||
gh release upload "$TAG" artifacts/*.ipa --clobber
|
||||
gh release edit "$TAG" --title "HGhub v${V} iOS 正式版" --notes "$NOTES" --prerelease=false --latest
|
||||
else
|
||||
gh release create "$TAG" artifacts/*.ipa \
|
||||
--title "HGhub v${V} iOS 正式版" \
|
||||
--notes "$NOTES" \
|
||||
--latest
|
||||
fi
|
||||
@@ -1,147 +0,0 @@
|
||||
name: Build macOS Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
macos:
|
||||
name: macOS (${{ matrix.name }})
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: aarch64-apple-darwin
|
||||
name: Apple Silicon (arm64)
|
||||
arch: arm64
|
||||
- target: x86_64-apple-darwin
|
||||
name: Intel (x64)
|
||||
arch: x64
|
||||
- target: universal-apple-darwin
|
||||
name: Universal (通用版)
|
||||
arch: universal
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 对齐版本号
|
||||
id: ver
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||
V="${GITHUB_REF_NAME#v}"
|
||||
else
|
||||
V="$(node -p "require('./src-tauri/tauri.conf.json').version")"
|
||||
fi
|
||||
echo "version=$V" >> "$GITHUB_OUTPUT"
|
||||
node -e "const fs=require('fs');for(const p of ['src-tauri/tauri.conf.json','package.json']){const j=JSON.parse(fs.readFileSync(p));j.version=process.argv[1];fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n')}" "$V"
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-darwin,x86_64-apple-darwin
|
||||
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri -> target
|
||||
key: macos-${{ matrix.target }}
|
||||
|
||||
- name: 安装前端依赖
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: 构建 macOS 应用 (DMG + APP)
|
||||
run: |
|
||||
pnpm tauri build --config src-tauri/tauri.macos.conf.json --target ${{ matrix.target }}
|
||||
|
||||
- name: 整理构建产物
|
||||
shell: bash
|
||||
run: |
|
||||
V="${{ steps.ver.outputs.version }}"
|
||||
mkdir -p artifacts
|
||||
|
||||
# 收集 dmg 安装包
|
||||
found_dmg=0
|
||||
for f in $(find src-tauri/target -name '*.dmg'); do
|
||||
echo "发现 DMG: $f"
|
||||
cp "$f" "artifacts/HGhub_${V}_${{ matrix.arch }}.dmg"
|
||||
found_dmg=1
|
||||
done
|
||||
|
||||
# 打包 .app 绿色压缩包(便于不需要 DMG 安装的用户直接拖拽)
|
||||
for app in $(find src-tauri/target -name 'HGhub.app' -type d); do
|
||||
echo "发现 APP: $app"
|
||||
tar -czf "artifacts/HGhub_${V}_${{ matrix.arch }}.app.tar.gz" -C "$(dirname "$app")" "HGhub.app"
|
||||
done
|
||||
|
||||
ls -lh artifacts/
|
||||
if [ "$found_dmg" -eq 0 ]; then
|
||||
echo "::error::未找到 DMG 构建产物"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 上传构建产物
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: HGhub-macOS-${{ matrix.arch }}
|
||||
path: artifacts/*
|
||||
if-no-files-found: error
|
||||
|
||||
publish-release:
|
||||
name: 发布 GitHub Release
|
||||
needs: [macos]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 下载所有 macOS 产物
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: 查看产物列表
|
||||
run: ls -lh artifacts
|
||||
|
||||
- name: 获取版本号
|
||||
id: ver
|
||||
run: |
|
||||
V="$(node -p "require('./src-tauri/tauri.conf.json').version")"
|
||||
echo "version=$V" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: 发布 Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.ver.outputs.version }}-macos
|
||||
name: HGhub v${{ steps.ver.outputs.version }} macOS 专属版
|
||||
body: |
|
||||
## HGhub macOS 编译发布版 (v${{ steps.ver.outputs.version }})
|
||||
|
||||
本项目为 [Minireel/HGhub](https://github.com/Minireel/HGhub) 官方源码针对 macOS 平台的编译产物。
|
||||
原项目已在 PR #1 完成 macOS 适配支持,但官方尚未在 Release 页面发布 Mac 版产物。
|
||||
|
||||
### 下载说明
|
||||
- **Apple Silicon (M1/M2/M3/M4 系列芯片)**: 推荐下载 `HGhub_${{ steps.ver.outputs.version }}_arm64.dmg`
|
||||
- **Intel 芯片**: 推荐下载 `HGhub_${{ steps.ver.outputs.version }}_x64.dmg`
|
||||
- **通用双架构版 (全机型支持)**: 推荐下载 `HGhub_${{ steps.ver.outputs.version }}_universal.dmg`
|
||||
|
||||
### macOS 首次打开说明(绕过未签名提示)
|
||||
由于开源个人构建未购买苹果开发者企业证书签名与公证,首次打开若提示“已损坏”或“无法打开”,请在「终端」中执行以下命令清除隔离属性:
|
||||
```bash
|
||||
sudo xattr -rd com.apple.quarantine /Applications/HGhub.app
|
||||
```
|
||||
files: artifacts/*
|
||||
fail_on_unmatched_files: true
|
||||
draft: false
|
||||
prerelease: false
|
||||
@@ -3,8 +3,6 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=no" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="theme-color" content="#1a1a1a" />
|
||||
<title>HGhub · 黄果短剧</title>
|
||||
<script>
|
||||
|
||||
@@ -11,10 +11,6 @@ rust-version = "1.90"
|
||||
name = "huangguo_client_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[features]
|
||||
default = ["custom-protocol"]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
|
||||
@@ -170,6 +170,114 @@ pub async fn open_url(app: tauri::AppHandle, url: String) -> Result<(), String>
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// 切换移动端屏幕方向(iOS 原生旋转屏幕方向:横屏 Landscape / 竖屏 Portrait)。
|
||||
#[tauri::command]
|
||||
pub async fn set_orientation(app: tauri::AppHandle, landscape: bool) -> Result<(), String> {
|
||||
#[cfg(target_os = "ios")]
|
||||
{
|
||||
let _ = app.run_on_main_thread(move || {
|
||||
request_ios_orientation(landscape);
|
||||
});
|
||||
}
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
{
|
||||
let _ = (&app, landscape);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
fn request_ios_orientation(landscape: bool) {
|
||||
use std::ffi::{c_char, c_void};
|
||||
extern "C" {
|
||||
fn objc_getClass(name: *const c_char) -> *mut c_void;
|
||||
fn sel_registerName(name: *const c_char) -> *mut c_void;
|
||||
fn objc_msgSend();
|
||||
}
|
||||
unsafe {
|
||||
let msg0: unsafe extern "C" fn(*mut c_void, *mut c_void) -> *mut c_void =
|
||||
std::mem::transmute(objc_msgSend as *const ());
|
||||
let msg0_usize: unsafe extern "C" fn(*mut c_void, *mut c_void) -> usize =
|
||||
std::mem::transmute(objc_msgSend as *const ());
|
||||
let msg1_usize: unsafe extern "C" fn(*mut c_void, *mut c_void, usize) -> *mut c_void =
|
||||
std::mem::transmute(objc_msgSend as *const ());
|
||||
let msg2_ptr: unsafe extern "C" fn(*mut c_void, *mut c_void, *mut c_void, *mut c_void) =
|
||||
std::mem::transmute(objc_msgSend as *const ());
|
||||
let msg1_void: unsafe extern "C" fn(*mut c_void, *mut c_void) =
|
||||
std::mem::transmute(objc_msgSend as *const ());
|
||||
|
||||
// 1. iOS 16+ UIWindowScene.requestGeometryUpdateWithPreferences:errorHandler:
|
||||
// UIInterfaceOrientationMaskPortrait = 1 << 1 = 2
|
||||
// UIInterfaceOrientationMaskLandscapeRight = 1 << 3 = 8
|
||||
let mask: usize = if landscape { 8 } else { 2 };
|
||||
let prefs_cls = objc_getClass(b"UIWindowSceneGeometryPreferencesIOS\0".as_ptr() as *const c_char);
|
||||
let app_cls = objc_getClass(b"UIApplication\0".as_ptr() as *const c_char);
|
||||
if !prefs_cls.is_null() && !app_cls.is_null() {
|
||||
let sel_alloc = sel_registerName(b"alloc\0".as_ptr() as *const c_char);
|
||||
let sel_init = sel_registerName(b"initWithInterfaceOrientations:\0".as_ptr() as *const c_char);
|
||||
let raw_prefs = msg0(prefs_cls, sel_alloc);
|
||||
let prefs = if !raw_prefs.is_null() {
|
||||
msg1_usize(raw_prefs, sel_init, mask)
|
||||
} else {
|
||||
std::ptr::null_mut()
|
||||
};
|
||||
|
||||
let sel_shared = sel_registerName(b"sharedApplication\0".as_ptr() as *const c_char);
|
||||
let app = msg0(app_cls, sel_shared);
|
||||
if !app.is_null() && !prefs.is_null() {
|
||||
let sel_scenes = sel_registerName(b"connectedScenes\0".as_ptr() as *const c_char);
|
||||
let scenes_set = msg0(app, sel_scenes);
|
||||
if !scenes_set.is_null() {
|
||||
let sel_all = sel_registerName(b"allObjects\0".as_ptr() as *const c_char);
|
||||
let arr = msg0(scenes_set, sel_all);
|
||||
if !arr.is_null() {
|
||||
let sel_count = sel_registerName(b"count\0".as_ptr() as *const c_char);
|
||||
let sel_at = sel_registerName(b"objectAtIndex:\0".as_ptr() as *const c_char);
|
||||
let sel_req = sel_registerName(
|
||||
b"requestGeometryUpdateWithPreferences:errorHandler:\0".as_ptr() as *const c_char,
|
||||
);
|
||||
let sel_responds = sel_registerName(b"respondsToSelector:\0".as_ptr() as *const c_char);
|
||||
let msg_responds: unsafe extern "C" fn(*mut c_void, *mut c_void, *mut c_void) -> bool =
|
||||
std::mem::transmute(objc_msgSend as *const ());
|
||||
let count = msg0_usize(arr, sel_count);
|
||||
for i in 0..count {
|
||||
let scene = msg1_usize(arr, sel_at, i);
|
||||
if !scene.is_null() && msg_responds(scene, sel_responds, sel_req) {
|
||||
msg2_ptr(scene, sel_req, prefs, std::ptr::null_mut());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Fallback: UIDevice setValue:forKey:@"orientation" + attemptRotationToDeviceOrientation
|
||||
let dev_cls = objc_getClass(b"UIDevice\0".as_ptr() as *const c_char);
|
||||
let num_cls = objc_getClass(b"NSNumber\0".as_ptr() as *const c_char);
|
||||
let str_cls = objc_getClass(b"NSString\0".as_ptr() as *const c_char);
|
||||
let vc_cls = objc_getClass(b"UIViewController\0".as_ptr() as *const c_char);
|
||||
if !dev_cls.is_null() && !num_cls.is_null() && !str_cls.is_null() {
|
||||
let sel_cur = sel_registerName(b"currentDevice\0".as_ptr() as *const c_char);
|
||||
let dev = msg0(dev_cls, sel_cur);
|
||||
let sel_num = sel_registerName(b"numberWithInteger:\0".as_ptr() as *const c_char);
|
||||
let orient_val: usize = if landscape { 3 } else { 1 };
|
||||
let num = msg1_usize(num_cls, sel_num, orient_val);
|
||||
let sel_str = sel_registerName(b"stringWithUTF8String:\0".as_ptr() as *const c_char);
|
||||
let msg_str: unsafe extern "C" fn(*mut c_void, *mut c_void, *const c_char) -> *mut c_void =
|
||||
std::mem::transmute(objc_msgSend as *const ());
|
||||
let key = msg_str(str_cls, sel_str, b"orientation\0".as_ptr() as *const c_char);
|
||||
if !dev.is_null() && !num.is_null() && !key.is_null() {
|
||||
let sel_set_val = sel_registerName(b"setValue:forKey:\0".as_ptr() as *const c_char);
|
||||
msg2_ptr(dev, sel_set_val, num, key);
|
||||
}
|
||||
if !vc_cls.is_null() {
|
||||
let sel_attempt = sel_registerName(b"attemptRotationToDeviceOrientation\0".as_ptr() as *const c_char);
|
||||
msg1_void(vc_cls, sel_attempt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ───────────────────────── 会话 ───────────────────────── */
|
||||
|
||||
#[tauri::command]
|
||||
|
||||
@@ -140,6 +140,7 @@ pub fn run() {
|
||||
api::line_probe,
|
||||
api::check_update,
|
||||
api::open_url,
|
||||
api::set_orientation,
|
||||
api::api_login,
|
||||
api::api_register,
|
||||
api::api_logout,
|
||||
|
||||
@@ -43,9 +43,6 @@
|
||||
],
|
||||
"android": {
|
||||
"minSdkVersion": 24
|
||||
},
|
||||
"iOS": {
|
||||
"developmentTeam": "ABCDE12345"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"build": {
|
||||
"devUrl": null
|
||||
},
|
||||
"bundle": {
|
||||
"iOS": {
|
||||
"minimumSystemVersion": "15.0"
|
||||
|
||||
+21
-4
@@ -34,6 +34,7 @@
|
||||
}
|
||||
.plat-windows { --r-sm: 4px; --r-md: 8px; --r-lg: 8px; --r-ctl: 4px; --nav-h: 0px; }
|
||||
.plat-macos { --r-sm: 6px; --r-md: 10px; --r-lg: 12px; --r-ctl: 6px; --nav-h: 0px; }
|
||||
.plat-ios { --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-ctl: 999px; -webkit-touch-callout: none; }
|
||||
html.theme-light {
|
||||
color-scheme: light;
|
||||
--p-canvas: #f3f3f3;
|
||||
@@ -152,7 +153,7 @@ html.theme-light .elev-3 { box-shadow: 0 10px 30px rgba(0,0,0,.1); }
|
||||
.a-panel-out { animation: kf-panel-out .2s ease-in both; }
|
||||
@keyframes kf-scale-in { from{opacity:0;transform:scale(.92)} to{opacity:1;transform:scale(1)} }
|
||||
.a-scale-in { animation: kf-scale-in .22s cubic-bezier(.2,0,0,1) both; }
|
||||
@keyframes kf-page-in { from{transform:translateX(100%)} to{transform:translateX(0)} }
|
||||
@keyframes kf-page-in { from{transform:translateX(100%)} to{transform:none} }
|
||||
.a-page-in { animation: kf-page-in .3s cubic-bezier(.2,0,0,1) both; }
|
||||
@keyframes kf-page-out { from{transform:translateX(0)} to{transform:translateX(100%)} }
|
||||
.a-page-out { animation: kf-page-out .22s cubic-bezier(.3,0,.8,.15) both; }
|
||||
@@ -250,7 +251,8 @@ input[type="range"].hg-range::-webkit-slider-thumb { -webkit-appearance: none; w
|
||||
原生全屏时红绿灯被系统隐藏(is-native-fs),让位收回,避免留一条空白。 */
|
||||
.plat-macos .win-titlebar { padding-left: 84px; }
|
||||
.plat-macos .win-titlebar.is-native-fs { padding-left: 14px; }
|
||||
.plat-android .win-main { background: var(--p-bg); overflow: hidden; }
|
||||
.plat-android .win-main,
|
||||
.plat-ios .win-main { background: var(--p-bg); overflow: hidden; }
|
||||
.win-page-in { animation: kf-page-in .26s cubic-bezier(.2,0,0,1) both; }
|
||||
.win-page-out { animation: kf-page-out .2s ease-in both; }
|
||||
|
||||
@@ -483,13 +485,28 @@ input[type="range"].hg-range::-webkit-slider-thumb { -webkit-appearance: none; w
|
||||
.player-surface .player-root,
|
||||
.player-root { background: #15181d; }
|
||||
|
||||
/* —— 安卓沉浸全屏:横屏视频把舞台旋转 90°(不依赖系统旋转) —— */
|
||||
/* —— 移动端沉浸全屏:固定铺满全屏视口,脱离外层滚动容器 scrollTop 影响 —— */
|
||||
.fs-immersive {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
width: 100vw; height: 100vh;
|
||||
width: 100dvw; height: 100dvh;
|
||||
z-index: 45;
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* —— 移动端沉浸全屏(系统仍处于竖屏时的 CSS 90° 旋转兜底) —— */
|
||||
.fs-landscape {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 50%; left: 50%; right: auto; bottom: auto;
|
||||
width: 100vh; height: 100vw;
|
||||
width: 100dvh; height: 100dvw;
|
||||
transform: translate(-50%, -50%) rotate(90deg);
|
||||
transform-origin: center center;
|
||||
z-index: 45;
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.desktop-dock-panel {
|
||||
|
||||
Reference in New Issue
Block a user