Skip to content

Commit 862f984

Browse files
committed
Fix last reboot clipboard
1 parent 18ac767 commit 862f984

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

SupportCompanion/Models/DeviceInfo.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct DeviceInfo: Identifiable, Equatable {
1717
var ipAddress: String
1818
let serialNumber: String
1919
var lastRestart: Int
20+
var lastRestartDays: Int
2021
let model: String
2122

2223
static func == (lhs: DeviceInfo, rhs: DeviceInfo) -> Bool {
@@ -76,6 +77,12 @@ struct DeviceInfo: Identifiable, Equatable {
7677
value: .int(lastRestart),
7778
category: Constants.DeviceInfo.Categories.systemInfo
7879
),
80+
(
81+
key: "lastRestartDays",
82+
display: Constants.DeviceInfo.Labels.lastRestart,
83+
value: .int(lastRestartDays),
84+
category: Constants.DeviceInfo.Categories.systemInfo
85+
),
7986

8087
// Network Information
8188
(

SupportCompanion/ViewModels/CardGridViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CardGridViewModel: ObservableObject {
3636
("OS Version:", appState.deviceInfoManager.deviceInfo?.osVersion ?? ""),
3737
("OS Build:", appState.deviceInfoManager.deviceInfo?.osBuild ?? ""),
3838
("IP Address:", appState.deviceInfoManager.deviceInfo?.ipAddress ?? ""),
39-
("Last Reboot:", "\(appState.deviceInfoManager.deviceInfo?.lastRestart ?? 0) days"),
39+
("Last Reboot:", "\(appState.deviceInfoManager.deviceInfo?.lastRestartDays ?? 0) days"),
4040
("--------------------- Battery ---------------------", ""),
4141
("Health:", "\(healthPercentage)%"),
4242
("Cycle Count:", appState.batteryInfoManager.batteryInfo.cycleCount),

SupportCompanion/ViewModels/DeviceInfoManager.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class DeviceInfoManager: ObservableObject {
2323
ipAddress: "",
2424
serialNumber: "",
2525
lastRestart: 0,
26+
lastRestartDays: 0,
2627
model: ""
2728
)
2829
)
@@ -60,6 +61,7 @@ class DeviceInfoManager: ObservableObject {
6061
ipAddress: currentIPAddress,
6162
serialNumber: getSerialNumber(),
6263
lastRestart: getLastRestartMinutes() ?? 0,
64+
lastRestartDays: getLastRebootDays() ?? 0,
6365
model: getModelName()
6466
)
6567
}
@@ -81,6 +83,7 @@ class DeviceInfoManager: ObservableObject {
8183
ipAddress: updatedIPAddress,
8284
serialNumber: currentDeviceInfo.serialNumber,
8385
lastRestart: currentDeviceInfo.lastRestart,
86+
lastRestartDays: currentDeviceInfo.lastRestartDays,
8487
model: currentDeviceInfo.model
8588
)
8689
}

0 commit comments

Comments
 (0)