stripe / stripe-terminal-ios

Stripe Terminal iOS SDK
https://stripe.com/docs/terminal/sdk/ios
Other
104 stars 65 forks source link

SDK doesn't trigger didReportBatteryLevel after it's connected to BT reader #262

Closed TatsuUkraine closed 1 year ago

TatsuUkraine commented 1 year ago

Summary

-reader:didReportBatteryLevel:status:isCharging: not triggering as soon as SDK established connection to M2 readers.

iOS version

16.6

SDK version

v3.1.0

Other information

bric-stripe commented 1 year ago

Hi, I just gave this a quick try and wasn't able to reproduce. To set some expectations:

so quickest way to test that the delegate is working is to:

  1. connect while having the reader plugged in
  2. unplug the reader
  3. background and foreground the host application to force it to attempt to update the info

at that point, assuming the reader wasn't collecting payment, it should report that the isCharging state changed from true to false.

can you confirm you're not seeing that though?

another thing to confirm is that the ReaderDelegate hasn't been deallocated. The SDK has a weak reference so if your application code doesn't retain a strong reference it could be that its being released. Easiest way to check on that is: are any other delegate methods being called successfully? The didRequestReaderInput is probably the easiest to check on by starting a collectPaymentMethod and confirm you see the request to swipe/insert/tap show up through there. If that's also not firing the released delegate is likely the cause.

if only not seeing the battery method being called can you share a reader serial number and rough time of when you expected to see a change be reported? we can try to look through some logs to see if anything stands out.

also, are you seeing this as a regression? Were you previously successfully getting callbacks in < 3.1?

TatsuUkraine commented 1 year ago

Easiest way to check on that is: are any other delegate methods being called successfully?

yes, I'm getting method call for low-battery warning, so delegate it seems working and attached in a proper way. Also all delegate methods related to software update/install working too

also, are you seeing this as a regression? Were you previously successfully getting callbacks in < 3.1?

yes, tested with v2.x, delegate is invoked as soon as connection is established. Also, (I don't know if it makes any difference) In Android SDK battery level callback also invoked as soon as app connected to BT device on both v2 and v3

TatsuUkraine commented 1 year ago

but when the host application goes to background and then comes back to the foreground the SDK should attempt to update the battery info

@bric-stripe btw, this one actually makes delegate method to invoke. So the delegate works fine, it just doesn't trigger after app is established connection to the BT reader, as it was in v2

TatsuUkraine commented 1 year ago

also, I can reproduce this with both real and simulated BT device. Only one difference there is that "background and then comes back to the foreground" trick doesn't work with simulated one, I can assume because, unlike real device, the battery info on the simulated device doesn't change

TatsuUkraine commented 1 year ago

sorry, probably I didn't describe the problem clear enough) so the delegate it seems working (overall), at least moving the app into the background and back to the foreground forces this delegate method to be triggered (if battery info changed in between).

The problem there is that this delegate method doesn't trigger as soon as you establish the connection to the BT device. Like Android SDK does, or like it was in v2

bric-stripe commented 1 year ago

The problem there is that this delegate method doesn't trigger as soon as you establish the connection to the BT device

ah, thanks for clarifying. We'll look in to that 👍

bric-stripe commented 1 year ago

this should be fixed now in 3.2, please re-open if still seeing issues though