Attempt to quit app when launched from complication

This commit is contained in:
Christoph Hagen
2023-12-29 22:18:41 +01:00
parent e9d870bd12
commit 973f0cb1c1
4 changed files with 23 additions and 14 deletions

View File

@ -58,13 +58,16 @@ final class RequestCoordinator: ObservableObject {
}
}
func startUnlock() {
func startUnlock(quitAfterSuccess: Bool = false) {
guard !isPerformingRequest else {
return
}
isPerformingRequest = true
Task {
let finalResult = await performFullChallengeResponse()
if finalResult == .unlocked, quitAfterSuccess {
exit(EXIT_SUCCESS)
}
DispatchQueue.main.async {
self.state = finalResult
self.isPerformingRequest = false