- Add 10 new fonts (Literata, Merriweather, Source Serif, Lato, Montserrat, Source Sans) - Support Apple system fonts and Google Fonts (OFL 1.1 licensed) - Extend FontFamily enum with new fonts and categories - Update FontSettingsViewModel and WebView with font support - Force WebView reload when font settings change - Refactor OfflineSyncManager with protocol and improved error handling - Add test mocks and OfflineSyncManagerTests with 9 test cases - Add OpenSourceLicensesView and FontDebugView - Bump build number - Update localization strings
39 lines
963 B
Swift
39 lines
963 B
Swift
import Foundation
|
|
|
|
class VersionManager {
|
|
static let shared = VersionManager()
|
|
|
|
private let lastSeenVersionKey = "lastSeenAppVersion"
|
|
private let userDefaults = UserDefaults.standard
|
|
|
|
var currentVersion: String {
|
|
Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "1.0"
|
|
}
|
|
|
|
var currentBuild: String {
|
|
Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "1"
|
|
}
|
|
|
|
var fullVersion: String {
|
|
"\(currentVersion) (\(currentBuild))"
|
|
}
|
|
|
|
var lastSeenVersion: String? {
|
|
userDefaults.string(forKey: lastSeenVersionKey)
|
|
}
|
|
|
|
var isNewVersion: Bool {
|
|
guard let lastSeen = lastSeenVersion else {
|
|
// First launch
|
|
return true
|
|
}
|
|
return lastSeen != currentVersion
|
|
}
|
|
|
|
func markVersionAsSeen() {
|
|
userDefaults.set(currentVersion, forKey: lastSeenVersionKey)
|
|
}
|
|
|
|
private init() {}
|
|
}
|