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

58 lines
2.1 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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: """
**Пуш-уведомления**
In-app баннеры (Telegram parity) — при получении сообщения внутри приложения. Исправлен спам вибраций при входе. Аватарки в пушах совпадают с приложением. Группы без фото — иконка людей. 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 }
}
}