@@ -17,9 +17,17 @@ class CardGridViewModel: ObservableObject {
17
17
}
18
18
19
19
// 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
+
21
28
var deviceInfo : [ ( String , Any ) ] {
22
29
[
30
+ ( " --------------------- Device --------------------- " , " " ) ,
23
31
( " Host Name: " , appState. deviceInfoManager. deviceInfo? . hostName ?? " " ) ,
24
32
( " Serial Number: " , appState. deviceInfoManager. deviceInfo? . serialNumber ?? " " ) ,
25
33
( " Model: " , appState. deviceInfoManager. deviceInfo? . model ?? " " ) ,
@@ -28,7 +36,15 @@ class CardGridViewModel: ObservableObject {
28
36
( " OS Version: " , appState. deviceInfoManager. deviceInfo? . osVersion ?? " " ) ,
29
37
( " OS Build: " , appState. deviceInfoManager. deviceInfo? . osBuild ?? " " ) ,
30
38
( " 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
+
32
48
]
33
49
}
34
50
0 commit comments