Improve uptime

This commit is contained in:
世界
2025-12-27 14:32:18 +08:00
parent 265902a011
commit 60ce084862

View File

@@ -445,9 +445,7 @@ class DashboardViewModel : BaseViewModel<DashboardUiState, UiEvent>(), CommandCl
checkDeprecatedNotes()
commandClient.connect()
reloadSystemProxyStatus()
updateState {
copy(serviceStartTime = System.currentTimeMillis())
}
reloadStartedAt()
}
Status.Stopped -> {
@@ -478,6 +476,20 @@ class DashboardViewModel : BaseViewModel<DashboardUiState, UiEvent>(), CommandCl
}
}
private fun reloadStartedAt() {
viewModelScope.launch(Dispatchers.IO) {
try {
val startedAt = Libbox.newStandaloneCommandClient().startedAt
withContext(Dispatchers.Main) {
updateState {
copy(serviceStartTime = startedAt)
}
}
} catch (_: Exception) {
}
}
}
private fun reloadSystemProxyStatus() {
viewModelScope.launch(Dispatchers.IO) {
try {