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

Allow opening device settings from modal after Bluetooth permission is denied #14573

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

staskus
Copy link
Collaborator

@staskus staskus commented Dec 2, 2024

Closes: #14561
Depends on #14561

Description

When Bluetooth permission is denied during card reader connection, show a modal that allows opening device settings.

Solution

It turns out CardPresentModalBluetoothRequired already exists, but it's only used in CardReaderSettingsAlerts which is a provider that is used to displaying some alerts from CardReaderSettingsConnectedViewController but not for scanningFailed issues.

The solution is to use CardPresentModalBluetoothRequired in BluetoothReaderConnectionAlertsProvider when .bluetoothDenied error happens. To be safe, added the same code to CardReaderSettingsAlerts

Steps to reproduce

  1. Freshly install the WooCommerce iOS app
  2. Navigate to payments settings (more menu -> payments)
  3. Click on "Manage card reader" / Collect payment with card reader
  4. Ensure Bluetooth is turned off
  5. Try connecting to the card reader
  6. When asked for Bluetooth permission, deny it
  7. Confirm a Bluetooth-denied modal is shown with "Open Device Settings" option
  8. Tap Device Settings option, and confirm device's Woo settings are opened
  9. Come back to the app
  10. Close the modal
  11. Make additional connection attempts
  12. Confirm a Bluetooth-denied modal is shown with "Open Device Settings" option

Testing information

Tested different payment entry points. All result in the expected error now. iPhone 14 Po 17.7.

Screenshots

Permissions.mov

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@staskus staskus added type: enhancement A request for an enhancement. feature: mobile payments Related to mobile payments / card present payments / Woo Payments. labels Dec 2, 2024
@staskus staskus added this to the 21.3 milestone Dec 2, 2024
@staskus staskus changed the title Allow opening device settings from modal Bluetooth after permission is denied Allow opening device settings from modal after Bluetooth permission is denied Dec 2, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 2, 2024

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

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14573-5edfeb9
Version21.2
Bundle IDcom.automattic.alpha.woocommerce
Commit5edfeb9
App Center BuildWooCommerce - Prototype Builds #11930
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

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

Works well, good find – I'd forgotten about that one.

One suggestion on the imports.

@@ -1,4 +1,6 @@
import Foundation
import Yosemite
import Hardware
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to typealias what you need from Hardware in Yosemite's Model.swift. Strictly, the app layer shouldn't know about Hardware or Networking.

@@ -1,5 +1,6 @@
import UIKit
import Yosemite
import Hardware
Copy link
Contributor

Choose a reason for hiding this comment

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

As above

@staskus staskus merged commit f351bf6 into trunk Dec 3, 2024
13 of 14 checks passed
@staskus staskus deleted the fix/13987-open-settings-from-bluetooth-denied-error branch December 3, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: mobile payments Related to mobile payments / card present payments / Woo Payments. type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants