Skip to content

Commit 48779ea

Browse files
committed
Add additional info to copy info button
1 parent b891174 commit 48779ea

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

SupportCompanion/ViewModels/CardGridViewModel.swift

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ class CardGridViewModel: ObservableObject {
1717
}
1818

1919
// MARK: - Device Information Helpers
20-
20+
private var healthPercentage: Int {
21+
if appState.batteryInfoManager.batteryInfo.designCapacity > 0 {
22+
return Int(round((Double(appState.batteryInfoManager.batteryInfo.maxCapacity) / Double(appState.batteryInfoManager.batteryInfo.designCapacity)) * 100))
23+
} else {
24+
return 0
25+
}
26+
}
27+
2128
var deviceInfo: [(String, Any)] {
2229
[
30+
("--------------------- Device ---------------------", ""),
2331
("Host Name:", appState.deviceInfoManager.deviceInfo?.hostName ?? ""),
2432
("Serial Number:", appState.deviceInfoManager.deviceInfo?.serialNumber ?? ""),
2533
("Model:", appState.deviceInfoManager.deviceInfo?.model ?? ""),
@@ -28,7 +36,15 @@ class CardGridViewModel: ObservableObject {
2836
("OS Version:", appState.deviceInfoManager.deviceInfo?.osVersion ?? ""),
2937
("OS Build:", appState.deviceInfoManager.deviceInfo?.osBuild ?? ""),
3038
("IP Address:", appState.deviceInfoManager.deviceInfo?.ipAddress ?? ""),
31-
("Last Reboot:", "\(appState.deviceInfoManager.deviceInfo?.lastRestart ?? 0) days")
39+
("Last Reboot:", "\(appState.deviceInfoManager.deviceInfo?.lastRestart ?? 0) days"),
40+
("--------------------- Battery ---------------------", ""),
41+
("Health:", "\(healthPercentage)%"),
42+
("Cycle Count:", appState.batteryInfoManager.batteryInfo.cycleCount),
43+
("Temperature:", "\((String(format: "%.1f", appState.batteryInfoManager.batteryInfo.temperature)))°C"),
44+
("--------------------- Storage ---------------------", ""),
45+
("Used:", "\(appState.storageInfoManager.storageInfo.usage)%"),
46+
("FileVault:", appState.storageInfoManager.storageInfo.fileVault ? "Enabled" : "Disabled"),
47+
3248
]
3349
}
3450

0 commit comments

Comments
 (0)