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

Ionic Bluetooth UI #1841

Merged
merged 17 commits into from
May 8, 2024
Merged

Ionic Bluetooth UI #1841

merged 17 commits into from
May 8, 2024

Conversation

lubej
Copy link
Collaborator

@lubej lubej commented Feb 7, 2024

Solution

This PR is build upon #1739, #1784 and #1769. It adds additional steps, for user to choose either USB or BLE Ledger device. BLE Ledger device is currently only enabled and supported on mobile devices(through Ionic), this may be subject to change in the future.

Links

Android test:
https://github.com/oasisprotocol/oasis-wallet-web/assets/9722540/6e0542f4-f92e-4788-aaba-ed9c6ba009cb

@lubej lubej requested review from lukaw3d and buberdds February 7, 2024 14:25
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

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

Project coverage is 80.77%. Comparing base (6e25fc9) to head (c88bb9a).
Report is 104 commits behind head on master.

❗ Current head c88bb9a differs from pull request most recent head 93426e7. Consider uploading reports for the commit 93426e7 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1841      +/-   ##
==========================================
- Coverage   81.18%   80.77%   -0.41%     
==========================================
  Files         193      195       +2     
  Lines        5101     5161      +60     
  Branches      944      949       +5     
==========================================
+ Hits         4141     4169      +28     
- Misses        960      992      +32     
Flag Coverage Δ
cypress 45.21% <5.19%> (-0.68%) ⬇️
jest 76.72% <62.79%> (-0.32%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/app/pages/ConnectDevicePage/index.tsx 100.00% <ø> (ø)
src/app/pages/OpenWalletPage/index.tsx 100.00% <100.00%> (ø)
...pages/OpenWalletPage/Features/FromLedger/index.tsx 96.15% <95.23%> (+18.88%) ⬆️
...ge/Features/ImportAccountsSelectionModal/index.tsx 91.80% <33.33%> (ø)
src/commonRoutes.tsx 32.00% <0.00%> (-2.79%) ⬇️
src/app/pages/OpenWalletPage/webextension.tsx 0.00% <0.00%> (ø)
...es/OpenWalletPage/Features/FromUsbLedger/index.tsx 77.27% <77.27%> (ø)
...es/OpenWalletPage/Features/FromBleLedger/index.tsx 66.66% <66.66%> (ø)
...tPage/Features/ListBleLedgerDevicesModal/index.tsx 41.46% <41.46%> (ø)

... and 13 files with indirect coverage changes

@lubej lubej requested a review from csillag February 7, 2024 18:05
@lubej
Copy link
Collaborator Author

lubej commented Feb 13, 2024

Couple of things I noticed:

  • "Opening Ledger through USB", needs to be replaced with either "Opening Ledger through Bluetooth", or just "Opening Ledger/Connecting with Ledger device";
  • Modal height when listing Bluetooth device overflows for some reason;

@lubej
Copy link
Collaborator Author

lubej commented Feb 13, 2024

@donouwens mentioned really confusing wording on instructions upon connecting Ledger device.

Should be for Bluetooth:

  1. Connect your Ledger to this device via Bluetooth
  2. Make sure your Ledger is paired with this device
  3. Open the Oasis app on your Ledger

Should be for USB:

  1. Connect your Ledger to this device via USB
  2. Close the Ledger Live app on your computer
  3. Open the Oasis app on your Ledger

Copy link
Contributor

@buberdds buberdds left a comment

Choose a reason for hiding this comment

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

I have just looked at tests

@lubej lubej force-pushed the ionic-bluetooth-ui branch 3 times, most recently from a4ca43d to c88bb9a Compare February 27, 2024 15:01
@lubej lubej force-pushed the ionic-bluetooth-ui branch 3 times, most recently from db2d6d1 to 26ae1bc Compare April 25, 2024 05:01
@lubej lubej requested a review from buberdds April 25, 2024 05:17
next: () => void
}

export function ListBleLedgerDevicesModal(props: ListBleLedgerDevicesModalProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

so the difference is that we use native modal for usb and custom one for ble?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, sort of. Listing is not native, connect to a single device is. This will probably be reworked for desktop support - but the API is still not officially released yet(at least the last time I checked).

@buberdds
Copy link
Contributor

buberdds commented Apr 25, 2024

There is one bug compared to master branch which affects extension

master
Ext Open Wallet -> Grant access -> Connect Ledger device -> Connect device -> Modal success -> Popup reloaded with Ledger accounts

PR:
Ext Open Wallet -> Grant access -> Connect Ledger device -> Connect device -> Modal success -> Popup not reloaded

@lubej
Copy link
Collaborator Author

lubej commented Apr 26, 2024

There is one bug compared to master branch which affects extension

master Ext Open Wallet -> Grant access -> Connect Ledger device -> Connect device -> Modal success -> Popup reloaded with Ledger accounts

PR: Ext Open Wallet -> Grant access -> Connect Ledger device -> Connect device -> Modal success -> Popup not reloaded

Can you try again? And make a video of it. As I was unable to reproduce.

@buberdds
Copy link
Contributor

buberdds commented Apr 26, 2024

master
connect Ledger
Screenshot from 2024-04-26 08-04-04

list Ledger accounts in popup
Screenshot from 2024-04-26 08-04-31

side branch

  • nothing happens in popup after successful connection
    Screenshot from 2024-04-26 08-05-03

make sure to turn off / turn on extension while switching branches

@lubej lubej force-pushed the ionic-bluetooth-ui branch from 32dbbb9 to 2f5a7ca Compare April 26, 2024 07:38
@lubej
Copy link
Collaborator Author

lubej commented Apr 29, 2024

There is one bug compared to master branch which affects extension

master Ext Open Wallet -> Grant access -> Connect Ledger device -> Connect device -> Modal success -> Popup reloaded with Ledger accounts

PR: Ext Open Wallet -> Grant access -> Connect Ledger device -> Connect device -> Modal success -> Popup not reloaded

@buberdds this has been fixed now, even though the fix is not really sophisticated. The issue was, that the enumerating modal is not available on the FromLedger component. I know that there was a discussion to show both options on Extension as well (Bluetooth & USB) which breaks the functionality. We can either directly redirect to USB Ledger screen, which may cause problems in the future, if the Bluetooth functionality is ever added to extension. Make the USB Ledger enumeration modal global. Or leave it this way, with redirect to USB Ledger. Which after writing everything down, seems to me like a good enough option.

Thanks for noticing BTW 👍

@buberdds
Copy link
Contributor

buberdds commented Apr 30, 2024

I am still having issues with using this:

  1. desktop
    I hit a case where nothing happens. So if it's only working with capacitor why we are enabling it on desktop?

Screenshot from 2024-04-30 08-04-12

depends on browser or browser's settings we are not showing hint about disabled Ledger button anymore (this affects mobile too when user has BLE disabled)

Screenshot from 2024-04-30 09-13-33

disabled BLE button label - my laptop has BLE enabled, so this message fits mobile devices only

Screenshot from 2024-04-30 09-17-33

  1. extension
    Ledger account list popup has extra scrollbars, which was fixed recently and was one of a blocker for a release

Screenshot from 2024-04-30 08-34-18

new extension popup Ledger options do not make sense - grant Ledger access and disabled Ledger button next to it

Screenshot from 2024-04-30 08-06-38

  • mobile (apk installed on mobile device)
    not longer able to list Ledger devices ?

Screenshot_20240430-093031
Screenshot_20240430-092953

lubej and others added 11 commits May 8, 2024 06:18
- update usb and ble instructions
- change opening Ledger through usb to more general text
- due to "Error: Web Bluetooth API not available in this browser" in CI
- rename webExtensionLedgerAccess to webExtensionUSBLedgerAccess
- use runtimeIs for determining current environment app is running in
- remove unused code
- update FromLedger test, to reflect runtimeIs changes
@lubej lubej force-pushed the ionic-bluetooth-ui branch from e80e3ca to 585ad04 Compare May 8, 2024 04:18
@lubej
Copy link
Collaborator Author

lubej commented May 8, 2024

@buberdds

Desktop - I hit a case where nothing happens. So if it's only working with capacitor why we are enabling it on desktop?

Yes, so currently there is no official support for desktop - due to Web Bluetooth API still being in experimental mode. This has been changed now. Previously it was only disabled in extension. Now it checks if the app is running on native Capacitor platform(Android or iOS)

Desktop - depends on browser or browser's settings we are not showing hint about disabled Ledger button anymore (this affects mobile too when user has BLE disabled)

After our sync, I dropped the check. So now Ledger button is always enabled on this screen. And the unsupported messages will appear in the next screen. Also updated Bluetooth and WebUSB messages, to make it more generic

Extension - Ledger account list popup has extra scrollbars, which was fixed recently and was one of a blocker for a release

After rebase I was unable to reproduce, not sure if this was fixed in the meantime. Can you confirm it works for you as well?

Extension - new extension popup Ledger options do not make sense - grant Ledger access and disabled Ledger button next to it

As per our sync discussion, we want to make it consistent. Also, there might be Bluetooth support coming to extension, when Web Bluetooth API is no longer in experimental mode.

Mobile (apk installed on mobile device) - no longer able to list Ledger devices?

I was unable to reproduce. Did your Ledger maybe run out of battery? Or something similar? I see that you have your Ledger paired. Can you try again, and write the exact steps to reproduce?

@lubej lubej requested a review from buberdds May 8, 2024 05:22
@buberdds
Copy link
Contributor

buberdds commented May 8, 2024

Extension Ledger views are broken

Screenshot from 2024-05-08 09-27-03

Copy link
Contributor

@buberdds buberdds left a comment

Choose a reason for hiding this comment

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

will add GitHub issue to explore modal unification (usb /ble )

@lubej lubej merged commit 1c3546c into oasisprotocol:master May 8, 2024
10 of 11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants