diff --git a/device/android/src/main/java/com/capacitorjs/plugins/device/DevicePlugin.java b/device/android/src/main/java/com/capacitorjs/plugins/device/DevicePlugin.java index 9fed0725d..d62fae5bd 100644 --- a/device/android/src/main/java/com/capacitorjs/plugins/device/DevicePlugin.java +++ b/device/android/src/main/java/com/capacitorjs/plugins/device/DevicePlugin.java @@ -39,6 +39,7 @@ public void getInfo(PluginCall call) { r.put("model", android.os.Build.MODEL); r.put("operatingSystem", "android"); r.put("osVersion", android.os.Build.VERSION.RELEASE); + r.put("osBuild", android.os.Build.VERSION.INCREMENTAL); r.put("androidSDKVersion", Build.VERSION.SDK_INT); r.put("platform", implementation.getPlatform()); r.put("manufacturer", android.os.Build.MANUFACTURER); diff --git a/device/ios/Sources/DevicePlugin/Device.swift b/device/ios/Sources/DevicePlugin/Device.swift index cf2a0e832..5b5a468fb 100644 --- a/device/ios/Sources/DevicePlugin/Device.swift +++ b/device/ios/Sources/DevicePlugin/Device.swift @@ -106,4 +106,15 @@ import UIKit return Int(combined.joined()) } + + func getVersionInfo() -> (version: String, build: String) { + let string = ProcessInfo.processInfo.operatingSystemVersionString + let cleaned = string.replacingOccurrences(of: "Version ", with: "").replacingOccurrences(of: "Build ", with: "") + let components = cleaned.split(separator: "(") + + let version = components.first?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "Unknown" + let build = components.count > 1 ? components[1].replacingOccurrences(of: ")", with: "").trimmingCharacters(in: .whitespacesAndNewlines) : "Unknown" + + return (version, build) + } } diff --git a/device/ios/Sources/DevicePlugin/DevicePlugin.swift b/device/ios/Sources/DevicePlugin/DevicePlugin.swift index 7b18c82ef..3a0a56699 100644 --- a/device/ios/Sources/DevicePlugin/DevicePlugin.swift +++ b/device/ios/Sources/DevicePlugin/DevicePlugin.swift @@ -38,6 +38,7 @@ public class DevicePlugin: CAPPlugin, CAPBridgedPlugin { let realDiskFree = implementation.getRealFreeDiskSize() ?? 0 let diskTotal = implementation.getTotalDiskSize() ?? 0 let systemVersionNum = implementation.getSystemVersionInt() ?? 0 + let systemVersionInfo = implementation.getVersionInfo() call.resolve([ "memUsed": memUsed, @@ -48,7 +49,8 @@ public class DevicePlugin: CAPPlugin, CAPBridgedPlugin { "name": UIDevice.current.name, "model": modelName, "operatingSystem": "ios", - "osVersion": UIDevice.current.systemVersion, + "osVersion": systemVersionInfo.version, + "osBuild": systemVersionInfo.build, "iOSVersion": systemVersionNum, "platform": "ios", "manufacturer": "Apple",