Skip to content

fix: request location permission after it is rejected during Ledger connection#8745

Merged
dawnseeker8 merged 73 commits intomainfrom
fix/8643-location-permission-issue
Apr 3, 2024
Merged

fix: request location permission after it is rejected during Ledger connection#8745
dawnseeker8 merged 73 commits intomainfrom
fix/8643-location-permission-issue

Conversation

@dawnseeker8
Copy link
Copy Markdown
Contributor

@dawnseeker8 dawnseeker8 commented Feb 27, 2024

Description

This PR is to fix #8643 and #8718 issue

This PR has done following change:

  1. for Android 12 and above, we only need nearby devices permission for ledger bluetooth connection. not required location permission any more.
  2. for Android 11, system will only require location permission with precise location on to work with ledger.
  3. Add nearby devices permission error message in en.json
  4. styling the ErrorDetail modal to fit the new nearby devices in the screen.

Related issues

Fixes: #8643
#8718

Manual testing steps

  1. From Android settings>connected devices> see all make sure LNX not currently paired
  2. Have LNX unlocked and the Ethereum app opened
  3. Unlock MMM
  4. Tap accounts menu from wallet view
  5. Select add account or hardware wallet
  6. Tap Add hardware wallet
  7. Tap Ledger
  8. When nearby permission is requested, decline it
  9. when error page appear, click view settings which direct to setting page of metamask permission
  10. enable Nearby Devices permission, and click back to app
  11. metamask will go back to scan screen and then find LNX devices.
  12. click continue, LNX account will be imported.

Screenshots/Recordings

Before

After

Screen_Recording_20240227_233546_MetaMask.mp4

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@dawnseeker8 dawnseeker8 added the team-hardware-wallets-deprecated DEPRECATED: please use "team-accounts-framework" instead label Feb 27, 2024
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 91.30435% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 45.93%. Comparing base (b90cb4a) to head (932b18e).

Files Patch % Lines
app/components/Views/LedgerConnect/Scan.tsx 50.00% 2 Missing ⚠️
...s/UI/LedgerModals/Steps/SearchingForDeviceStep.tsx 80.00% 0 Missing and 1 partial ⚠️
app/components/Views/LedgerConnect/index.tsx 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8745      +/-   ##
==========================================
+ Coverage   45.35%   45.93%   +0.58%     
==========================================
  Files        1272     1273       +1     
  Lines       31247    31274      +27     
  Branches     3189     3195       +6     
==========================================
+ Hits        14171    14366     +195     
+ Misses      16234    16066     -168     
  Partials      842      842              

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

@dawnseeker8 dawnseeker8 changed the title Fix/8643 location permission issue Fix: Fix 8643 location permission issue in ledgfer Feb 27, 2024
@dawnseeker8 dawnseeker8 changed the title Fix: Fix 8643 location permission issue in ledgfer fix: a bug fix for 8643 location permission issue in ledger Feb 27, 2024
@dawnseeker8 dawnseeker8 marked this pull request as ready for review February 27, 2024 15:37
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner February 27, 2024 15:37
@github-actions
Copy link
Copy Markdown
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/4607f381-3685-46c9-a234-ae462b621c95
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@dawnseeker8 dawnseeker8 added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) Run Smoke E2E and removed Run Smoke E2E labels Feb 29, 2024
@github-actions
Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 8e051db
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/69c2ff59-8614-4104-84c6-bcdf6ce12473

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@plasmacorral
Copy link
Copy Markdown
Contributor

plasmacorral commented Mar 1, 2024

Android 11
Moto G Play 2021
Testing commit 962b740
LNX fw 2.2.3 w/ Eth App 1.10.3

  • Manual testing steps above do not allow me to pair Ledger after enabling location permission in android 11. Result is error❌
  • Happy path with location on works on Android 11.
  • When location is off pairing error presents without actionable instruction for user (likely related to report in 8643)
  • When bluetooth is off View settings goes to app level info rather than device level bluetooth settings (previously reported in 4920.

Results for Android 11 device

Manual test steps with bluetooth and location both enabled

Recording
Screenshot of where user lands after tapping view settings
Screenshot of error after enabling Location permission in Android 11

  1. From Android settings>connected devices> see all make sure LNX not currently paired
  2. Have LNX unlocked and the Ethereum app opened
  3. Unlock MMM
  4. Tap accounts menu from wallet view
  5. Select add account or hardware wallet
  6. Tap Add hardware wallet
  7. Tap Ledger
  8. When nearby permission Location permission is requested, decline it
  9. NEW STEP: Decline location permission when it is requested for a second time❌
  10. when error page appear, click view settings which direct to setting page of MetaMask permission (ACTUAL- directed to App Info for MetaMask. I had to then know to click Permissions and tap Location and change selection from Don't Allow to Ask every time)❌
  11. enable Nearby Devices Location permission, and click back to app
  12. MetaMask will go back to scan screen and then find LNX devices. (ACTUAL- returned to An error occured with Location permission prompt overtop)❌
  13. NEW STEP: Select Only this time on the location permission prompt
  14. After granting permission returned to An error occured with View settings CTA
  15. NEW STEP: Tap X on error page to return to Connect Ledger
  16. click continue, LNX account will be imported. (ACTUAL- Unable to pair)❌

Bluetooth on/Location on (Happy path)

Recording
Location prompt screenshot

  1. Access Settings>Applications>MetaMask>Storage & Cache and clear storage (to simulate fresh install)
  2. Access Settings>Connected devices> to forget previously paired devices
  3. Have Bluetooth enabled
  4. Have Location enabled
  5. Launch app
  6. import SRP
  7. Access accounts drop down
  8. tap Add account or hardware wallet
  9. tap Add hardware wallet
  10. Tap Ledger
  11. Tap Only this time or Ask every time equivalent on Location permission prompt
  12. Tap continue once device is found
  13. Tap Pair and connect on android
  14. Tap connect on android
  15. Tap both buttons on Ledger to confirm pairing
  16. Confirm Ledger account appears in account list

Bluetooth on/Location off

Recording
Screenshot of pairing error

  1. Access Settings>Applications>MetaMask>Storage & Cache and clear storage (to simulate fresh install)
  2. Access Settings>Connected devices> to forget previously paired devices
  3. Have Bluetooth enabled
  4. Have Location disabled (OFF)
  5. Launch app
  6. import SRP
  7. Access accounts drop down
  8. tap Add account or hardware wallet
  9. tap Add hardware wallet
  10. Tap Ledger
  11. Tap Only this time or Ask every time equivalent on Location permission prompt
  12. Note generic error with no instruction to enable location

Bluetooth off/Location on

Recording
Screenshot of where user lands after tapping view settings

  1. Access Settings>Applications>MetaMask>Storage & Cache and clear storage (to simulate fresh install)
  2. Access Settings>Connected devices> to forget previously paired devices
  3. Have Bluetooth disabled (OFF)
  4. Have Location enabled
  5. Launch app
  6. import SRP
  7. Access accounts drop down
  8. tap Add account or hardware wallet
  9. tap Add hardware wallet
  10. Tap Ledger
  11. Tap Only this time or Ask every time equivalent on Location permission prompt
  12. Error presented Bluetooth is off
  13. Tap View Settings
  14. takes user to Settings>App info>MetaMask, but instead should be Device bluetooth settings at Settings>Connected Devices

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 872b9ae
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1ed8db43-277e-4df1-ac97-7a3a4e5d94ae

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

NicolasMassart
NicolasMassart previously approved these changes Mar 27, 2024
Copy link
Copy Markdown
Contributor

@NicolasMassart NicolasMassart 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.
Thanks again for all the effort you put in following advice and taking account of feedback!

@NicolasMassart NicolasMassart added needs-qa Any New Features that needs a full manual QA prior to being added to a release. and removed needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Mar 28, 2024
@vivek-consensys vivek-consensys added QA Passed QA testing has been completed and passed and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Apr 2, 2024
@vivek-consensys
Copy link
Copy Markdown
Contributor

Tested on Samsung S21 using Android 14.
Bitrise build:- https://app.bitrise.io/build/ce998116-a194-487f-a46d-315a8386cecb?tab=artifacts

Screen_Recording_20240402_152101_MetaMask-QA.mp4

@vivek-consensys vivek-consensys added QA in Progress QA has started on the feature. and removed QA Passed QA testing has been completed and passed labels Apr 2, 2024
@socket-security
Copy link
Copy Markdown

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@ledgerhq/devices@8.2.2 None +1 395 kB ldg-github-ci
npm/@ledgerhq/react-native-hw-transport-ble@6.32.3 None 0 316 kB ldg-github-ci

🚮 Removed packages: npm/@ledgerhq/devices@8.2.1, npm/@ledgerhq/react-native-hw-transport-ble@6.32.0

View full report↗︎

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 932b18e
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/63a0f8de-293d-4fe5-8d1d-8d9fec79cda5

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 3, 2024

Copy link
Copy Markdown
Contributor

@NicolasMassart NicolasMassart 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.

@vivek-consensys vivek-consensys added QA Passed QA testing has been completed and passed and removed QA in Progress QA has started on the feature. labels Apr 3, 2024
@dawnseeker8
Copy link
Copy Markdown
Contributor Author

I have also tested the android 9 with location permission, and all the issue marked by Mike has gone with latest library upgrade.

@dawnseeker8 dawnseeker8 merged commit 9b25acf into main Apr 3, 2024
@dawnseeker8 dawnseeker8 deleted the fix/8643-location-permission-issue branch April 3, 2024 09:54
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2024
@metamaskbot metamaskbot added the release-7.21.0 Issue or pull request that will be included in release 7.21.0 label Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed QA testing has been completed and passed release-7.21.0 Issue or pull request that will be included in release 7.21.0 team-hardware-wallets-deprecated DEPRECATED: please use "team-accounts-framework" instead

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: Rejecting location permission when pairing Ledger Nano X

10 participants