mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 01:26:37 +08:00
21 lines
556 B
Swift
21 lines
556 B
Swift
import Foundation
|
|
|
|
final class AppConfigManager {
|
|
struct AppConfig: Decodable {
|
|
let affineVersion: String
|
|
}
|
|
|
|
static var affineVersion: String? = nil
|
|
|
|
static func getAffineVersion() -> String {
|
|
if affineVersion == nil {
|
|
let file = Bundle(for: AppConfigManager.self).url(forResource: "capacitor.config", withExtension: "json")!
|
|
let data = try! Data(contentsOf: file)
|
|
let config = try! JSONDecoder().decode(AppConfig.self, from: data)
|
|
affineVersion = config.affineVersion
|
|
}
|
|
|
|
return affineVersion!
|
|
}
|
|
}
|