Skip to content

Conversation

@kidinov
Copy link
Contributor

@kidinov kidinov commented Dec 2, 2025

WOOMOB-1647

Description

This PR implements proper handling of the card reader reconnecting status introduced in Stripe SDK 5.0.0. When the SDK automatically attempts to reconnect to a card reader, users now see a "Reconnecting…" status message in the UI with cancelation option

Changes:

  • Add CardReaderStatus.Reconnecting to the sealed class
  • Implement reconnect callbacks in BluetoothReaderListenerImpl and TapToPayReaderListenerImpl
  • Display reconnecting status in WooPos floating toolbar with amber indicator
  • Handle reconnecting status in all relevant ViewModels

Test Steps

  1. Connect a card reader in WooPos/IPP
  2. Simulate a connection interruption (e.g., turn it off while connected)
  3. Observe "Reconnecting…" status
  4. Verify status returns to "Connected" when reconnection succeeds
  5. Verify reconnection is cancelable

Images/gif

Screenshot 2025-12-02 at 19 06 12 Screenshot 2025-12-02 at 18 31 11
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@dangermattic
Copy link
Collaborator

dangermattic commented Dec 2, 2025

1 Error
🚫 This PR is tagged with status: do not merge label(s).

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

Project dependencies changes

list
! Upgraded Dependencies
androidx.datastore:datastore:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-android:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-core:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-core-android:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-core-okio:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-core-okio-jvm:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-preferences:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-preferences-android:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-preferences-core:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-preferences-core-android:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-preferences-external-protobuf:1.2.0, (changed from 1.1.7)
androidx.datastore:datastore-preferences-proto:1.2.0, (changed from 1.1.7)
tree
 +--- com.google.firebase:firebase-messaging -> 25.0.1
 |    \--- com.google.firebase:firebase-common:22.0.1
-|         \--- androidx.datastore:datastore-preferences:1.1.7
-|              \--- androidx.datastore:datastore-preferences-android:1.1.7
-|                   +--- androidx.datastore:datastore:1.1.7
-|                   |    \--- androidx.datastore:datastore-android:1.1.7
-|                   |         +--- androidx.annotation:annotation:1.2.0 -> 1.9.1 (*)
-|                   |         +--- androidx.datastore:datastore-core:1.1.7
-|                   |         |    \--- androidx.datastore:datastore-core-android:1.1.7
-|                   |         |         +--- androidx.annotation:annotation:1.7.0 -> 1.9.1 (*)
-|                   |         |         +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 -> 2.2.21
-|                   |         |         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.2.21 (*)
-|                   |         |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.2.21 (*)
-|                   |         |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 -> 1.10.2 (*)
-|                   |         |         +--- androidx.datastore:datastore:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-core-okio:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-preferences:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-preferences-core:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-preferences-proto:1.1.7 (c)
-|                   |         |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-core-okio:1.1.7
-|                   |         |    \--- androidx.datastore:datastore-core-okio-jvm:1.1.7
-|                   |         |         +--- androidx.datastore:datastore-core:1.1.7 (*)
-|                   |         |         +--- com.squareup.okio:okio:3.4.0 -> 3.16.4
-|                   |         |         |    \--- com.squareup.okio:okio-jvm:3.16.4
-|                   |         |         |         \--- org.jetbrains.kotlin:kotlin-stdlib:2.2.20 -> 2.2.21 (*)
-|                   |         |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.2.21 (*)
-|                   |         |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 -> 1.10.2 (*)
-|                   |         |         +--- androidx.datastore:datastore:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-core:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-preferences:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-preferences-core:1.1.7 (c)
-|                   |         |         +--- androidx.datastore:datastore-preferences-proto:1.1.7 (c)
-|                   |         |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.1.7 (c)
-|                   |         +--- com.squareup.okio:okio:3.4.0 -> 3.16.4 (*)
-|                   |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.2.21 (*)
-|                   |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 -> 1.10.2 (*)
-|                   |         +--- androidx.datastore:datastore-core:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-core-okio:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-preferences:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-preferences-core:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-preferences-proto:1.1.7 (c)
-|                   |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.1.7 (c)
-|                   +--- androidx.datastore:datastore-preferences-core:1.1.7
-|                   |    \--- androidx.datastore:datastore-preferences-core-android:1.1.7
-|                   |         +--- androidx.datastore:datastore-core:1.1.7 (*)
-|                   |         +--- androidx.datastore:datastore-core-okio:1.1.7 (*)
-|                   |         +--- androidx.datastore:datastore-preferences-proto:1.1.7
-|                   |         |    +--- androidx.datastore:datastore-preferences-external-protobuf:1.1.7
-|                   |         |    |    +--- androidx.datastore:datastore:1.1.7 (c)
-|                   |         |    |    +--- androidx.datastore:datastore-core:1.1.7 (c)
-|                   |         |    |    +--- androidx.datastore:datastore-core-okio:1.1.7 (c)
-|                   |         |    |    +--- androidx.datastore:datastore-preferences:1.1.7 (c)
-|                   |         |    |    +--- androidx.datastore:datastore-preferences-core:1.1.7 (c)
-|                   |         |    |    \--- androidx.datastore:datastore-preferences-proto:1.1.7 (c)
-|                   |         |    +--- androidx.datastore:datastore:1.1.7 (c)
-|                   |         |    +--- androidx.datastore:datastore-core:1.1.7 (c)
-|                   |         |    +--- androidx.datastore:datastore-core-okio:1.1.7 (c)
-|                   |         |    +--- androidx.datastore:datastore-preferences:1.1.7 (c)
-|                   |         |    +--- androidx.datastore:datastore-preferences-core:1.1.7 (c)
-|                   |         |    \--- androidx.datastore:datastore-preferences-external-protobuf:1.1.7 (c)
-|                   |         +--- com.squareup.okio:okio:3.4.0 -> 3.16.4 (*)
-|                   |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.2.21 (*)
-|                   |         +--- androidx.datastore:datastore:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-core:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-core-okio:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-preferences:1.1.7 (c)
-|                   |         +--- androidx.datastore:datastore-preferences-proto:1.1.7 (c)
-|                   |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.1.7 (c)
-|                   +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.2.21 (*)
-|                   +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 -> 1.10.2 (*)
-|                   +--- androidx.datastore:datastore:1.1.7 (c)
-|                   +--- androidx.datastore:datastore-preferences-core:1.1.7 (c)
-|                   +--- androidx.datastore:datastore-core:1.1.7 (c)
-|                   +--- androidx.datastore:datastore-core-okio:1.1.7 (c)
-|                   +--- androidx.datastore:datastore-preferences-proto:1.1.7 (c)
-|                   \--- androidx.datastore:datastore-preferences-external-protobuf:1.1.7 (c)
+|         \--- androidx.datastore:datastore-preferences:1.1.7 -> 1.2.0
+|              \--- androidx.datastore:datastore-preferences-android:1.2.0
+|                   +--- androidx.datastore:datastore:1.2.0
+|                   |    \--- androidx.datastore:datastore-android:1.2.0
+|                   |         +--- androidx.annotation:annotation:1.9.1 (*)
+|                   |         +--- androidx.datastore:datastore-core:1.2.0
+|                   |         |    \--- androidx.datastore:datastore-core-android:1.2.0
+|                   |         |         +--- androidx.annotation:annotation:1.9.1 (*)
+|                   |         |         +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.2.21 (*)
+|                   |         |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0 -> 1.10.2 (*)
+|                   |         |         +--- androidx.datastore:datastore:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-core-okio:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-preferences:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-preferences-core:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-preferences-proto:1.2.0 (c)
+|                   |         |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-core-okio:1.2.0
+|                   |         |    \--- androidx.datastore:datastore-core-okio-jvm:1.2.0
+|                   |         |         +--- androidx.datastore:datastore-core:1.2.0 (*)
+|                   |         |         +--- com.squareup.okio:okio:3.9.1 -> 3.16.4
+|                   |         |         |    \--- com.squareup.okio:okio-jvm:3.16.4
+|                   |         |         |         \--- org.jetbrains.kotlin:kotlin-stdlib:2.2.20 -> 2.2.21 (*)
+|                   |         |         +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.2.21 (*)
+|                   |         |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0 -> 1.10.2 (*)
+|                   |         |         +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3
+|                   |         |         |    \--- org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.7.3
+|                   |         |         |         +--- org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.3 (*)
+|                   |         |         |         +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.20 -> 2.2.21 (*)
+|                   |         |         |         \--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3 (*)
+|                   |         |         +--- androidx.datastore:datastore:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-core:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-preferences:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-preferences-core:1.2.0 (c)
+|                   |         |         +--- androidx.datastore:datastore-preferences-proto:1.2.0 (c)
+|                   |         |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.2.0 (c)
+|                   |         +--- com.squareup.okio:okio:3.9.1 -> 3.16.4 (*)
+|                   |         +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.2.21 (*)
+|                   |         +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0 -> 1.10.2 (*)
+|                   |         +--- androidx.datastore:datastore-core:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-core-okio:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-preferences:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-preferences-core:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-preferences-proto:1.2.0 (c)
+|                   |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.2.0 (c)
+|                   +--- androidx.datastore:datastore-preferences-core:1.2.0
+|                   |    \--- androidx.datastore:datastore-preferences-core-android:1.2.0
+|                   |         +--- androidx.datastore:datastore-core:1.2.0 (*)
+|                   |         +--- androidx.datastore:datastore-core-okio:1.2.0 (*)
+|                   |         +--- androidx.datastore:datastore-preferences-proto:1.2.0
+|                   |         |    +--- androidx.datastore:datastore-preferences-external-protobuf:1.2.0
+|                   |         |    |    +--- androidx.datastore:datastore:1.2.0 (c)
+|                   |         |    |    +--- androidx.datastore:datastore-core:1.2.0 (c)
+|                   |         |    |    +--- androidx.datastore:datastore-core-okio:1.2.0 (c)
+|                   |         |    |    +--- androidx.datastore:datastore-preferences:1.2.0 (c)
+|                   |         |    |    +--- androidx.datastore:datastore-preferences-core:1.2.0 (c)
+|                   |         |    |    \--- androidx.datastore:datastore-preferences-proto:1.2.0 (c)
+|                   |         |    +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.2.21 (*)
+|                   |         |    +--- androidx.datastore:datastore:1.2.0 (c)
+|                   |         |    +--- androidx.datastore:datastore-core:1.2.0 (c)
+|                   |         |    +--- androidx.datastore:datastore-core-okio:1.2.0 (c)
+|                   |         |    +--- androidx.datastore:datastore-preferences:1.2.0 (c)
+|                   |         |    +--- androidx.datastore:datastore-preferences-core:1.2.0 (c)
+|                   |         |    \--- androidx.datastore:datastore-preferences-external-protobuf:1.2.0 (c)
+|                   |         +--- com.squareup.okio:okio:3.9.1 -> 3.16.4 (*)
+|                   |         +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.2.21 (*)
+|                   |         +--- androidx.datastore:datastore:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-core:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-core-okio:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-preferences:1.2.0 (c)
+|                   |         +--- androidx.datastore:datastore-preferences-proto:1.2.0 (c)
+|                   |         \--- androidx.datastore:datastore-preferences-external-protobuf:1.2.0 (c)
+|                   +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.21 -> 2.2.21 (*)
+|                   +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0 -> 1.10.2 (*)
+|                   +--- androidx.datastore:datastore:1.2.0 (c)
+|                   +--- androidx.datastore:datastore-preferences-core:1.2.0 (c)
+|                   +--- androidx.datastore:datastore-core:1.2.0 (c)
+|                   +--- androidx.datastore:datastore-core-okio:1.2.0 (c)
+|                   +--- androidx.datastore:datastore-preferences-proto:1.2.0 (c)
+|                   \--- androidx.datastore:datastore-preferences-external-protobuf:1.2.0 (c)
-+--- androidx.datastore:datastore-preferences:1.1.7 (*)
++--- androidx.datastore:datastore-preferences:1.2.0 (*)
-+--- androidx.datastore:datastore:1.1.7 (*)
++--- androidx.datastore:datastore:1.2.0 (*)
 +--- project :libs:fluxc
-|    \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.21 (*)
+|    \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.21
+|         \--- org.jetbrains.kotlin:kotlin-stdlib:2.2.21 (*)
 +--- project :libs:cardreader
 |    \--- com.stripe:stripeterminal-core:5.0.0
 |         \--- com.stripe:stripeterminal-internal-common:5.0.0
-|              \--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3 -> 1.7.3
-|                   \--- org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.7.3
-|                        +--- org.jetbrains.kotlinx:kotlinx-serialization-bom:1.7.3 (*)
-|                        +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.20 -> 2.2.21 (*)
-|                        \--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3 (*)
+|              \--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3 -> 1.7.3 (*)
 \--- org.wordpress:mediapicker:0.3.4
-     \--- androidx.datastore:datastore-preferences:1.0.0 -> 1.1.7 (*)
+     \--- androidx.datastore:datastore-preferences:1.0.0 -> 1.2.0 (*)

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 2, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit6f47449
Direct Downloadwoocommerce-wear-prototype-build-pr15047-6f47449.apk

@kidinov kidinov added feature: mobile payments Related to mobile payments / card present payments / Woo Payments. dependencies Pull requests that update a dependency file labels Dec 2, 2025
@kidinov kidinov added this to the 23.9 milestone Dec 2, 2025
@kidinov kidinov added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Dec 2, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 2, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit6f47449
Direct Downloadwoocommerce-prototype-build-pr15047-6f47449.apk

@kidinov kidinov force-pushed the woomob-1647-pr2-handle-reconnecting-status branch from 3232f07 to 96d7194 Compare December 2, 2025 11:04
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 1.38889% with 71 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.58%. Comparing base (22181c1) to head (96d7194).

Files with missing lines Patch % Lines
...internal/connection/BluetoothReaderListenerImpl.kt 0.00% 16 Missing ⚠️
.../internal/connection/TapToPayReaderListenerImpl.kt 0.00% 16 Missing ⚠️
...nts/cardreader/detail/CardReaderDetailViewModel.kt 0.00% 12 Missing ⚠️
...ardreader/internal/connection/ConnectionManager.kt 0.00% 8 Missing ⚠️
...i/woopos/home/toolbar/WooPosHomeFloatingToolbar.kt 0.00% 5 Missing ⚠️
...home/toolbar/WooPosHomeFloatingToolbarViewModel.kt 0.00% 3 Missing ⚠️
...droid/cardreader/internal/CardReaderManagerImpl.kt 0.00% 3 Missing ⚠️
...oid/ui/woopos/cardreader/WooPosCardReaderFacade.kt 0.00% 2 Missing ⚠️
...eader/WooPosSettingsHardwareCardReaderViewModel.kt 0.00% 2 Missing ⚠️
...s/cardreader/connect/CardReaderConnectViewModel.kt 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@                                   Coverage Diff                                   @@
##             woomob-1647-pr1-version-bump-and-breaking-changes   #15047      +/-   ##
=======================================================================================
- Coverage                                                38.61%   38.58%   -0.03%     
- Complexity                                               10311    10312       +1     
=======================================================================================
  Files                                                     2163     2163              
  Lines                                                   122674   122737      +63     
  Branches                                                 16935    16943       +8     
=======================================================================================
- Hits                                                     47366    47363       -3     
- Misses                                                   70501    70562      +61     
- Partials                                                  4807     4812       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kidinov kidinov changed the title [WOOMOB-1647] Handle CardReaderStatus.Reconnecting in UI [WOOMOB-1647] Handle CardReaderStatus Reconnecting Dec 2, 2025
@kidinov kidinov requested a review from malinajirka December 2, 2025 11:57
@kidinov kidinov marked this pull request as ready for review December 2, 2025 12:01
@kidinov kidinov changed the title [WOOMOB-1647] Handle CardReaderStatus Reconnecting [WOOMOB-1647] Handle CardReaderStatus Reconnecting flow Dec 2, 2025
@malinajirka malinajirka self-assigned this Dec 3, 2025
Copy link
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

I noticed the toolbar is duplicated on one of your screenshots (and many other screens). Seems like the Stripe SDK transitively updates the material library to the broken version we reverted a couple weeks ago. Is this on your radar?

@kidinov
Copy link
Contributor Author

kidinov commented Dec 3, 2025

@malinajirka Thanks for the review

I noticed the toolbar is duplicated on one of your screenshots (and many other screens). Seems like the Stripe SDK transitively updates the material library to the broken version we reverted a couple weeks ago. Is this on your radar?

Yes! I noticed this as well and confirmed the reason behind that. We have a ticket on Kiwi already to handle this, so we will be blocked from merging this until it's resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file feature: mobile payments Related to mobile payments / card present payments / Woo Payments. status: do not merge Dependent on another PR, ready for review but not ready for merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants