Files
mobile-ios/Rosetta/Core/Utils/ReleaseNotes.swift

58 lines
2.0 KiB
Swift

import Foundation
/// Desktop parity: version constants and release notes.
/// Desktop equivalent: `app/version.ts` `APP_VERSION`, `RELEASE_NOTICE`.
enum ReleaseNotes {
/// Current release notes entries, newest first.
/// Each entry contains a version string and either a `body` (free-form markdown)
/// or a `changes` list (auto-formatted as bullets).
static let entries: [Entry] = [
Entry(
version: appVersion,
body: """
**Пуш-уведомления**
Только системные баннеры iOS — убраны кастомные in-app оверлеи, звуки и вибрации. Desktop-suppression: если читаешь на компьютере, телефон молчит 30 секунд.
"""
)
]
/// Current app version from bundle (matches desktop `APP_VERSION`).
static var appVersion: String {
Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0"
}
/// Current build number from bundle.
static var buildNumber: String {
Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1"
}
/// Formatted release notice text for the current version (desktop parity: `RELEASE_NOTICE`).
/// Sent as a system message from the "Rosetta Updates" account.
static var releaseNoticeText: String {
guard let latest = entries.first else { return "" }
if let body = latest.body {
return "**Update v\(latest.version)**\n\n\(body)"
}
// Fallback: auto-format from changes array.
var lines = ["**Update v\(latest.version)**"]
for change in latest.changes {
lines.append("- \(change)")
}
return lines.joined(separator: "\n")
}
// MARK: - Entry
struct Entry: Identifiable {
let version: String
var changes: [String] = []
var body: String? = nil
var id: String { version }
}
}