mirror of
https://github.com/Aminark/legado-ios.git
synced 2026-10-23 12:21:23 +08:00
fix: 修复书源导入、阅读外观和书签状态
- 修复书源文件选择、访问权限与导入预览流程,支持查看分组内的书源 - 修复背景图片、字体选择与主题切换,限制背景图片解码尺寸 - 根据已保存书签恢复当前位置状态,避免重复添加 - 补充模型、阅读器和文件选择回归测试及测试样本 - 更新应用版本为 0.1.10(build 16) Fixes #1
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import UIKit
|
||||
|
||||
// Standalone simulator-only file provider; never bundled with Legado.
|
||||
@main
|
||||
@MainActor
|
||||
final class FixtureAppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
let documents = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
|
||||
let fixtures = [
|
||||
("JSON-Source.json", "https://file-import.test/json", "文件导入 JSON 测试"),
|
||||
("JSON-Uppercase.JSON", "https://file-import.test/uppercase", "文件导入大写扩展名测试"),
|
||||
("JSON-Text.txt", "https://file-import.test/text", "文件导入文本扩展名测试")
|
||||
]
|
||||
for (name, url, title) in fixtures {
|
||||
let source = [["bookSourceUrl": url, "bookSourceName": title]]
|
||||
if let data = try? JSONSerialization.data(withJSONObject: source) {
|
||||
try? data.write(to: documents.appendingPathComponent(name), options: .atomic)
|
||||
}
|
||||
}
|
||||
let controller = UIViewController()
|
||||
controller.view.backgroundColor = .systemBackground
|
||||
let label = UILabel()
|
||||
label.text = "书源导入测试文件已准备好"
|
||||
label.frame = CGRect(x: 20, y: 100, width: 350, height: 80)
|
||||
controller.view.addSubview(label)
|
||||
window = UIWindow(frame: UIScreen.main.bounds)
|
||||
window?.rootViewController = controller
|
||||
window?.makeKeyAndVisible()
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
printf 'Usage: sh scripts/prepare-source-import-fixture.sh <booted-simulator-UUID>\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
legado_fixture_device="$1"
|
||||
legado_fixture_repo="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
||||
legado_fixture_build="$(mktemp -d "${TMPDIR:-/tmp}/legado-source-import.XXXXXX")"
|
||||
trap 'rm -rf "$legado_fixture_build"' EXIT HUP INT TERM
|
||||
legado_fixture_app="$legado_fixture_build/SourceImportFixtures.app"
|
||||
legado_fixture_sdk="$(xcrun --sdk iphonesimulator --show-sdk-path)"
|
||||
legado_fixture_arch="$(uname -m)"
|
||||
mkdir -p "$legado_fixture_app"
|
||||
|
||||
cat > "$legado_fixture_app/Info.plist" <<'PLIST'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict>
|
||||
<key>CFBundleIdentifier</key><string>com.epiboly.legado.source-import-fixtures</string>
|
||||
<key>CFBundleExecutable</key><string>SourceImportFixtures</string>
|
||||
<key>CFBundleName</key><string>SourceImportFixtures</string>
|
||||
<key>CFBundleDisplayName</key><string>书源导入测试</string>
|
||||
<key>CFBundlePackageType</key><string>APPL</string>
|
||||
<key>CFBundleVersion</key><string>1</string>
|
||||
<key>CFBundleShortVersionString</key><string>1.0</string>
|
||||
<key>MinimumOSVersion</key><string>15.0</string>
|
||||
<key>LSRequiresIPhoneOS</key><true/>
|
||||
<key>UIFileSharingEnabled</key><true/>
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key><true/>
|
||||
<key>UILaunchScreen</key><dict/>
|
||||
<key>UISupportedInterfaceOrientations</key><array><string>UIInterfaceOrientationPortrait</string></array>
|
||||
</dict></plist>
|
||||
PLIST
|
||||
|
||||
xcrun --sdk iphonesimulator swiftc -parse-as-library -swift-version 6 \
|
||||
-sdk "$legado_fixture_sdk" -target "$legado_fixture_arch-apple-ios15.0-simulator" \
|
||||
-module-cache-path "$legado_fixture_repo/DerivedData/ModuleCache.noindex" \
|
||||
"$legado_fixture_repo/scripts/fixtures/SourceImportFixture.swift" \
|
||||
-o "$legado_fixture_app/SourceImportFixtures"
|
||||
xcrun simctl install "$legado_fixture_device" "$legado_fixture_app"
|
||||
xcrun simctl launch --terminate-running-process "$legado_fixture_device" com.epiboly.legado.source-import-fixtures
|
||||
printf 'JSON file import fixtures are ready in Files > On My iPhone > 书源导入测试.\n'
|
||||
Reference in New Issue
Block a user