mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 23:58:39 +00:00
iOS: extract device/platform info into DeviceInfoHelper, keep Settings platform string as iOS X.Y.Z
This commit is contained in:
committed by
Peter Steinberger
parent
e3ac491da3
commit
32d7756d8c
@@ -26,12 +26,12 @@ final class DeviceStatusService: DeviceStatusServicing {
|
||||
|
||||
func info() -> OpenClawDeviceInfoPayload {
|
||||
let device = UIDevice.current
|
||||
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "dev"
|
||||
let appBuild = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "0"
|
||||
let appVersion = DeviceInfoHelper.appVersion()
|
||||
let appBuild = DeviceStatusService.fallbackAppBuild(DeviceInfoHelper.appBuild())
|
||||
let locale = Locale.preferredLanguages.first ?? Locale.current.identifier
|
||||
return OpenClawDeviceInfoPayload(
|
||||
deviceName: device.name,
|
||||
modelIdentifier: Self.modelIdentifier(),
|
||||
modelIdentifier: DeviceInfoHelper.modelIdentifier(),
|
||||
systemName: device.systemName,
|
||||
systemVersion: device.systemVersion,
|
||||
appVersion: appVersion,
|
||||
@@ -75,13 +75,8 @@ final class DeviceStatusService: DeviceStatusServicing {
|
||||
return OpenClawStorageStatusPayload(totalBytes: total, freeBytes: free, usedBytes: used)
|
||||
}
|
||||
|
||||
private static func modelIdentifier() -> String {
|
||||
var systemInfo = utsname()
|
||||
uname(&systemInfo)
|
||||
let machine = withUnsafeBytes(of: &systemInfo.machine) { ptr in
|
||||
String(bytes: ptr.prefix { $0 != 0 }, encoding: .utf8)
|
||||
}
|
||||
let trimmed = machine?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
return trimmed.isEmpty ? "unknown" : trimmed
|
||||
/// Fallback for payloads that require a non-empty build (e.g. "0").
|
||||
private static func fallbackAppBuild(_ build: String) -> String {
|
||||
build.isEmpty ? "0" : build
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user