Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using simulated Bluetooth readers, disconnectReader() calls its completion block without error but has not disconnected from the reader. #229

Closed
mikado2005 opened this issue May 26, 2023 · 4 comments · Fixed by #246
Assignees
Labels
bug Bug report

Comments

@mikado2005
Copy link

mikado2005 commented May 26, 2023

Summary

In StripeTerminal v2.20.2 (and some earlier), when developing an iOS app using simulated, Bluetooth readers, the method Terminal.shared.disconnectReader will call its completion block without error, however Terminal is still connected to the simulated reader. When run on real hardware, the same code performs as expected.

Or am I missing something?

Code to reproduce

Here's a tiny app project that demonstrates the issue:
https://github.com/mikado2005/StripeDisconnect

iOS version

iOS 16.4.1

Installation method

Via Cocoapods

SDK version

2.20.2

Other information

@bric-stripe bric-stripe added the bug Bug report label May 26, 2023
@bric-stripe bric-stripe self-assigned this May 26, 2023
@bric-stripe
Copy link
Collaborator

thanks for the sample project that made it easy to reproduce 🙏

it seems the simulated reader implementation has an issue where it doesn't cleanup the connection status and connectedReader until after the completion block has run 😞. So if you put the checks

                    print("disconnectReader -- SUCCESS")
                    print("StripeTerminal status is \(self.describeTerminalStatus())")
                    print("StripeTerminal connected reader is \(Terminal.shared.connectedReader?.serialNumber ?? "<NONE>")")
                    print("Discovering readers again")
                    self.discoverReaders()

in a DispatchQueue.main.async {} it acts correctly. This of course shouldn't be needed though and is a bug. We'll get this fixed, likely for our 2.22.0 release. Thanks again for the report!

@mikado2005
Copy link
Author

Thanks! I suspected it was something like that. ;-)

@mikado2005
Copy link
Author

Can you verify that this bug is only in the simulator code? Or should we use the work-around for production code as well?

@bric-stripe
Copy link
Collaborator

correct, it's a bug in the simulated reader. Disconnecting from a real Bluetooth reader should update the state to disconnected and a nil connectedReader when the disconnect completion is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants