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

@ -2,6 +2,7 @@ import SwiftUI
import SwiftData
import SFSafeSymbols
import CryptoKit
import UIKit
struct ContentView: View {
@ -40,7 +41,7 @@ struct ContentView: View {
.aspectRatio(contentMode: .fit)
.fontWeight(.ultraLight)
.padding()
.onTapGesture(perform: coordinator.startUnlock)
.onTapGesture { unlock(quit: true) }
if coordinator.isPerformingRequest {
ProgressView()
.progressViewStyle(CircularProgressViewStyle())
@ -58,10 +59,14 @@ struct ContentView: View {
guard launched else {
return
}
unlock(quit: true)
didLaunchFromComplication = false
coordinator.startUnlock()
}
}
private func unlock(quit: Bool) {
coordinator.startUnlock(quitAfterSuccess: quit)
}
}
#Preview {