@@ -330,8 +330,10 @@ class FlutterNfcKitPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
330330 val timeout = call.argument<Int >(" timeout" )!!
331331 // technology and option bits are set in Dart code
332332 val technologies = call.argument<Int >(" technologies" )!!
333+ val extraPresenceDelay = call.argument<Int >(" extra_reader_presence_check_delay" )
334+
333335 runOnNfcThread(result, " Poll" ) {
334- pollTag(nfcAdapter, result, timeout, technologies)
336+ pollTag(nfcAdapter, result, timeout, technologies, extraPresenceDelay )
335337 }
336338 }
337339
@@ -584,8 +586,7 @@ class FlutterNfcKitPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
584586
585587 override fun onDetachedFromActivityForConfigChanges () {}
586588
587- private fun pollTag (nfcAdapter : NfcAdapter , result : Result , timeout : Int , technologies : Int ) {
588-
589+ private fun pollTag (nfcAdapter : NfcAdapter , result : Result , timeout : Int , technologies : Int , extraReaderPresenceCheckDelay : Int? ) {
589590 pollingTimeoutTask = Timer ().schedule(timeout.toLong()) {
590591 try {
591592 if (activity.get() != null ) {
@@ -605,11 +606,10 @@ class FlutterNfcKitPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
605606 result.success(jsonResult)
606607 }
607608
608- // The EXTRA_READER_PRESENCE_CHECK_DELAY is for fixing an obscure bug with
609- // some Android versions like LineageOS 17.1 that caused the PACE authentication to fail.
610- // See https://github.com/privacybydesign/vcmrtd/issues/91 for more info.
611609 val options = Bundle ()
612- options.putInt(EXTRA_READER_PRESENCE_CHECK_DELAY , 2000 )
610+ if (extraReaderPresenceCheckDelay != null ) {
611+ options.putInt(EXTRA_READER_PRESENCE_CHECK_DELAY , extraReaderPresenceCheckDelay)
612+ }
613613 nfcAdapter.enableReaderMode(activity.get(), pollHandler, technologies, options)
614614 }
615615
0 commit comments