File tree Expand file tree Collapse file tree
Normal/Views/BlockUnblockViews/KeySelect Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,11 +108,13 @@ struct KeySelectModifier: ViewModifier {
108108 private func handleSelection ( _ choice : KeyType ) {
109109 switch choice {
110110 case . nfc :
111+ let pending = action
111112 showKeySelect = false
112- Task { await authenticate ( with : . nfc ) }
113+ Task { await authenticate ( with : . nfc , action : pending ) }
113114 case . qr :
115+ let pending = action
114116 showQRScanner = true
115- Task { await authenticate ( with : . qr ) }
117+ Task { await authenticate ( with : . qr , action : pending ) }
116118 case . location :
117119 pendingLocationAction = action
118120 if showKeySelect {
@@ -129,14 +131,14 @@ struct KeySelectModifier: ViewModifier {
129131 showKeySelect = false
130132 }
131133
132- private func authenticate ( with choice : KeyType ) async {
133- guard let pendingAction = action else { return }
134+ private func authenticate ( with choice : KeyType , action pending : ( @ MainActor ( ) -> Void ) ? ) async {
135+ guard let pending else { return }
134136 let method : KeyMethod = switch choice {
135137 case . nfc : NFCKeyMethod ( nfcService : nfcService , keys : scopedKeys )
136138 case . qr : QRKeyMethod ( qrService : qrService , keys : scopedKeys )
137139 case . location : preconditionFailure ( " location uses its own popup " )
138140 }
139- _ = await keyManager . performWithKeyCheck ( using : method ) { pendingAction ( ) }
141+ _ = await keyManager . performWithKeyCheck ( using : method ) { pending ( ) }
140142 showKeySelect = false
141143 action = nil
142144 }
You can’t perform that action at this time.
0 commit comments