Quit after delay
This commit is contained in:
parent
e4f93d94a9
commit
03735d9e72
@ -41,7 +41,7 @@ struct ContentView: View {
|
|||||||
.aspectRatio(contentMode: .fit)
|
.aspectRatio(contentMode: .fit)
|
||||||
.fontWeight(.ultraLight)
|
.fontWeight(.ultraLight)
|
||||||
.padding()
|
.padding()
|
||||||
.onTapGesture { unlock(quit: true) }
|
.onTapGesture { coordinator.startUnlock() }
|
||||||
if coordinator.isPerformingRequest {
|
if coordinator.isPerformingRequest {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.progressViewStyle(CircularProgressViewStyle())
|
.progressViewStyle(CircularProgressViewStyle())
|
||||||
@ -59,14 +59,10 @@ struct ContentView: View {
|
|||||||
guard launched else {
|
guard launched else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
unlock(quit: true)
|
coordinator.startUnlock(quitAfterSuccess: true)
|
||||||
didLaunchFromComplication = false
|
didLaunchFromComplication = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func unlock(quit: Bool) {
|
|
||||||
coordinator.startUnlock(quitAfterSuccess: quit)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
|
@ -65,13 +65,16 @@ final class RequestCoordinator: ObservableObject {
|
|||||||
isPerformingRequest = true
|
isPerformingRequest = true
|
||||||
Task {
|
Task {
|
||||||
let finalResult = await performFullChallengeResponse()
|
let finalResult = await performFullChallengeResponse()
|
||||||
if finalResult == .unlocked, quitAfterSuccess {
|
|
||||||
exit(EXIT_SUCCESS)
|
|
||||||
}
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.state = finalResult
|
self.state = finalResult
|
||||||
self.isPerformingRequest = false
|
self.isPerformingRequest = false
|
||||||
}
|
}
|
||||||
|
if finalResult == .unlocked, quitAfterSuccess {
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) {
|
||||||
|
exit(EXIT_SUCCESS)
|
||||||
|
}
|
||||||
|
}
|
||||||
scheduleReturnToReadyState()
|
scheduleReturnToReadyState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user