@@ -2,7 +2,6 @@ import Storage
22import Hardware
33import Networking
44import Combine
5- import PassKit
65
76/// MARK: CardPresentPaymentStore
87///
@@ -19,8 +18,6 @@ public final class CardPresentPaymentStore: Store {
1918 /// We need to be able to cancel the process of collecting a payment.
2019 private var paymentCancellable : AnyCancellable ? = nil
2120
22- private var walletSuppressionRequestToken : PKSuppressionRequestToken ?
23-
2421 public init ( dispatcher: Dispatcher , storageManager: StorageManagerType , network: Network , cardReaderService: CardReaderService ) {
2522 self . cardReaderService = cardReaderService
2623 self . remote = WCPayRemote ( network: network)
@@ -164,15 +161,12 @@ private extension CardPresentPaymentStore {
164161 parameters: PaymentParameters ,
165162 onCardReaderMessage: @escaping ( CardReaderEvent ) -> Void ,
166163 onCompletion: @escaping ( Result < PaymentIntent , Error > ) -> Void ) {
167- suppressPassPresentation ( )
168-
169164 // Observe status events fired by the card reader
170165 let readerEventsSubscription = cardReaderService. readerEvents. sink { event in
171166 onCardReaderMessage ( event)
172167 }
173168
174169 paymentCancellable = cardReaderService. capturePayment ( parameters) . sink { error in
175- self . allowPassPresentation ( )
176170 readerEventsSubscription. cancel ( )
177171 switch error {
178172 case . failure( let error) :
@@ -191,8 +185,6 @@ private extension CardPresentPaymentStore {
191185
192186 cardReaderService. cancelPaymentIntent ( )
193187 . subscribe ( Subscribers . Sink ( receiveCompletion: { value in
194- self . allowPassPresentation ( )
195-
196188 switch value {
197189 case . failure( let error) :
198190 onCompletion ? ( . failure( error) )
@@ -267,43 +259,6 @@ private extension CardPresentPaymentStore {
267259 }
268260}
269261
270- private extension CardPresentPaymentStore {
271- /// Supress wallet presentation. This requires a special entitlement from Apple:
272- /// `com.apple.developer.passkit.pass-presentation-suppression`
273- /// See Woo-*.entitlements in WooCommerce/Resources
274- ///
275- /// Note: iPads don't support NFC passes.
276- ///
277- func suppressPassPresentation( ) {
278- guard UIDevice . current. userInterfaceIdiom != . pad else {
279- return
280- }
281-
282- guard !PKPassLibrary. isSuppressingAutomaticPassPresentation ( ) else {
283- return
284- }
285-
286- walletSuppressionRequestToken = PKPassLibrary . requestAutomaticPassPresentationSuppression ( ) { result in
287- guard result == . success else {
288- DDLogWarn ( " Automatic pass presentation suppression request failed. Reason: \( result. rawValue) " )
289- return
290- }
291- }
292- }
293-
294- func allowPassPresentation( ) {
295- guard UIDevice . current. userInterfaceIdiom != . pad else {
296- return
297- }
298-
299- guard let walletSuppressionRequestToken = walletSuppressionRequestToken, walletSuppressionRequestToken != 0 else {
300- return
301- }
302-
303- PKPassLibrary . endAutomaticPassPresentationSuppression ( withRequestToken: walletSuppressionRequestToken)
304- }
305- }
306-
307262/// Implementation of the CardReaderNetworkingAdapter
308263/// that fetches a token using WCPayRemote
309264private final class WCPayTokenProvider : CardReaderConfigProvider {
0 commit comments