Files
zellyy-finance/ios/App/App/BuildInfoPlugin.swift
gpt-engineer-app[bot] 1ce73d9354 Implement BuildInfo plugin for iOS
This commit implements the BuildInfo Capacitor plugin for iOS to retrieve the app version and build number from Info.plist. This resolves an issue where the version information was not being updated on iOS devices due to the absence of a native plugin implementation.
2025-03-23 10:56:42 +00:00

23 lines
792 B
Swift

import Foundation
import Capacitor
@objc(BuildInfoPlugin)
public class BuildInfoPlugin: CAPPlugin {
@objc func getBuildInfo(_ call: CAPPluginCall) {
let versionName = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0"
let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1"
let result = [
"versionName": versionName,
"buildNumber": Int(buildNumber) ?? 1,
"platform": "ios",
//
"bundleId": Bundle.main.bundleIdentifier ?? "unknown",
"buildDate": DateFormatter.localizedString(from: Date(), dateStyle: .short, timeStyle: .short)
] as [String : Any]
call.resolve(result)
}
}