Improve uptime
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user