From 139b8230daf90362a1614eff155e700d29945f7c Mon Sep 17 00:00:00 2001 From: eskimo Date: Sat, 5 Oct 2024 19:47:22 -0400 Subject: [PATCH 1/3] Update DevicePlugin.java Add build number --- .../main/java/com/capacitorjs/plugins/device/DevicePlugin.java | 1 + 1 file changed, 1 insertion(+) 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); From 2dcfaec055e44549640aefe88951595e63ba5c91 Mon Sep 17 00:00:00 2001 From: eskimo Date: Sat, 5 Oct 2024 19:50:05 -0400 Subject: [PATCH 2/3] Update Device.swift Add getVersionInfo --- device/ios/Sources/DevicePlugin/Device.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) 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) + } } From 85450b12b8bf641260157a6b4cfebfad96112f8c Mon Sep 17 00:00:00 2001 From: eskimo Date: Sat, 5 Oct 2024 19:51:23 -0400 Subject: [PATCH 3/3] Update DevicePlugin.swift Add osBuild --- device/ios/Sources/DevicePlugin/DevicePlugin.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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",