fix(update): 按语言加载三语更新日志并重发 v1.0.8

This commit is contained in:
xweiba
2026-09-24 23:36:23 +08:00
parent ca239411ee
commit 4aa4c6aa6c
14 changed files with 178 additions and 24 deletions
@@ -77,8 +77,44 @@ final class AppRemoteConfigurationTests: XCTestCase {
"raw.githubusercontent.com"
)
let releaseNotesURLs = AppRemoteConfigurationService.releaseNotesURLs(version: "1.0.5")
let releaseNotesURLs = AppRemoteConfigurationService.releaseNotesURLs(version: "1.0.8", language: "en")
XCTAssertEqual(releaseNotesURLs.first?.host, "gh-proxy.org")
XCTAssertEqual(releaseNotesURLs.last?.host, "raw.githubusercontent.com")
XCTAssertTrue(releaseNotesURLs.last?.path.hasSuffix("/docs/releases/v1.0.8.en.md") == true)
XCTAssertTrue(AppRemoteConfigurationService.releaseNotesURLs(
version: "1.0.8", language: "zh-Hans"
).last?.path.hasSuffix("/docs/releases/v1.0.8.md") == true)
XCTAssertTrue(AppRemoteConfigurationService.releaseNotesURLs(
version: "1.0.8", language: "zh-Hant"
).last?.path.hasSuffix("/docs/releases/v1.0.8.zh-Hant.md") == true)
XCTAssertTrue(AppRemoteConfigurationService.releaseNotesURLs(
version: "1.0.8", language: "it"
).last?.path.hasSuffix("/docs/releases/v1.0.8.en.md") == true)
}
func testReleaseNotesSummaryUsesTheSelectedLanguageHeading() {
let english = "# v1.0.8\n\n## Highlights\n\n- English update\n\n## Installation"
let chinese = "# v1.0.8\n\n## 主要更新\n\n- 中文更新\n\n## 安装"
XCTAssertEqual(AppRemoteConfigurationService.releaseNotesSummary(english, language: "en"), "• English update")
XCTAssertEqual(AppRemoteConfigurationService.releaseNotesSummary(chinese, language: "zh-Hans"), "• 中文更新")
XCTAssertEqual(AppRemoteConfigurationService.releaseNotesSummary(chinese, language: "zh-Hant"), "• 中文更新")
XCTAssertNil(AppRemoteConfigurationService.releaseNotesSummary(chinese, language: "en"))
XCTAssertEqual(AppRemoteConfigurationService.releaseNotesSummary(english, language: "it"), "• English update")
}
func testArchivedReleaseNotesParseInEachLanguage() throws {
let root = URL(fileURLWithPath: #filePath)
.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()
for (language, name) in [
("en", "v1.0.8.en.md"),
("zh-Hans", "v1.0.8.md"),
("zh-Hant", "v1.0.8.zh-Hant.md")
] {
let markdown = try String(
contentsOf: root.appendingPathComponent("docs/releases/\(name)"),
encoding: .utf8
)
XCTAssertNotNil(AppRemoteConfigurationService.releaseNotesSummary(markdown, language: language))
}
}
}
+1 -1
View File
@@ -143,6 +143,6 @@ grep -q 'presentSuccessfulOperationTip(.activation)' "$ROOT/App/MapHomeView.swif
grep -q 'presentSuccessfulOperationTip(.deactivation)' "$ROOT/App/MapHomeView.swift" || fail "third-party clear must present the deactivation tip"
grep -q 'if spoofState == .active' "$ROOT/App/MapHomeView.swift" || fail "manual help must follow the shared spoof state"
grep -q 'MARKETING_VERSION: "1.0.8"' "$ROOT/project.yml" || fail "marketing version must be 1.0.8"
grep -q 'CURRENT_PROJECT_VERSION: "9"' "$ROOT/project.yml" || fail "build version must be 9"
grep -q 'CURRENT_PROJECT_VERSION: "10"' "$ROOT/project.yml" || fail "build version must be 10"
echo "PASS: third-party proxy mode contract"
+10 -2
View File
@@ -54,8 +54,16 @@ grep -q 'static let configurationURLs = \[' "$CONFIG" \
|| fail "update detection must retain multiple configuration sources"
! grep -q 'data.count' "$CONFIG" \
|| fail "the client must not impose a remote configuration file-size limit"
grep -q 'docs/releases/v\\(version).md' "$CONFIG" \
|| fail "update notes must come from the archived release document"
grep -Fq 'docs/releases/v\(version)\(suffix).md' "$CONFIG" \
|| fail "update notes must come from the language-specific archived release document"
for locale in '' .en .zh-Hant; do
test -s "$ROOT/docs/releases/v${LATEST_VERSION}${locale}.md" \
|| fail "missing localized v${LATEST_VERSION}${locale} release notes"
done
grep -Fq '## Highlights' "$ROOT/docs/releases/v${LATEST_VERSION}.en.md" \
|| fail "English update highlights are missing"
grep -Fq '## 主要更新' "$ROOT/docs/releases/v${LATEST_VERSION}.zh-Hant.md" \
|| fail "Traditional Chinese update highlights are missing"
grep -q '/releases/latest' "$CONFIG" \
|| fail "missing release notes must fall back to the latest Release page"
grep -q '.task { await checkForUpdates() }' "$CONTENT" \