Restart service when settings change

This commit is contained in:
世界
2025-12-07 10:28:51 +08:00
parent bd5e5f3a79
commit 39338ab133
10 changed files with 77 additions and 22 deletions
@@ -32,17 +32,7 @@ public final class OverviewViewModel: BaseViewModel {
try LibboxNewStandaloneCommandClient()!.setSystemProxyEnabled(enabled)
} else {
await MainActor.run { reasserting = true }
try await profile.stop()
var waitSeconds = 0
while await profile.status != .disconnected {
try await Task.sleep(nanoseconds: NSEC_PER_SEC)
waitSeconds += 1
if waitSeconds >= 5 {
throw NSError(domain: "Restart service timeout", code: 0)
}
}
try await profile.start()
try await profile.restart()
await MainActor.run { reasserting = false }
}
} catch {