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

Terminal.shared.connectedReader doesn't get reset sometimes in manual reader reconnect setup #339

Open
ronzohan opened this issue Dec 9, 2024 · 1 comment

Comments

@ronzohan
Copy link

ronzohan commented Dec 9, 2024

Summary

I'm encountering a bug right now where when I try to collect payment and then background the app, the Terminal.shared.connectedReader doesn't get to set to nil.

In most cases, the reader(_: Reader, didDisconnect _: DisconnectReason) delegate gets called when I try to background the app but there are times when it won't get called and in that time, Terminal.shared.connectedReader is still holding to the connectedReader instead of nil

The TapToPayConnectionConfigurationBuilder.setAutoReconnectOnUnexpectedDisconnect(:) is set to false in the setup above.

Code to reproduce

Here is a video showing me trying to reproduce it (at around 00:15 where I got to reproduce it).
https://drive.google.com/file/d/1iTTuZTLN07XNUdafoN-A3h1Neug9APUl/view?usp=sharing

iOS version

18.1.1

Installation method

SPM

SDK version

4.1.0

Other information

@henryx-stripe
Copy link
Contributor

Hi, sorry for the delays. I have not been able to reproduce the issue with my setup. Are there any other logs emitted by the Terminal SDK between the connect / disconnect logs? Also I see that connecting is being emitted twice, is that because of some sort of mapping that you are using of the ConnectionStatus enum?

For some detail, the disconnect delegate will be called when applicationDidEnterBackgroundNotification is triggered, unless the reader is already disconnected, which I suspect is causing the issue (i.e. applicationDidEnterBackgroundNotification is getting triggered before the connection progresses far enough to set the reader connection state to connected). I will see if we can lessen the risk of this happening in the next release but as I can't reproduce the issue locally, I can't guarantee that it will address your issue.

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

No branches or pull requests

2 participants