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

fix: webview usage with electron 22 #2182

Merged
merged 165 commits into from
Dec 23, 2022
Merged

Conversation

Justkant
Copy link
Contributor

📝 Description

Description from: #1777

cf. https://ledgerhq.atlassian.net/browse/LIVE-4335?focusedCommentId=247299

In a breaking change in Electron 18 the nativeWindowOpen web preference (used here) have been removed (cf. this PR)

Now, Ledger live does not seem to receive (and handle) new-window events when a live-apps wants to open a new window (regularly used throughout Live Apps to open external contextual info like redirect to Twitter account, open ToS page, etc…)

webview are deprecated and not formerly integrated / maintained in electron.
updating electron broke previous handleding of new window opened from a webview

use setWindowOpenHandler on the webview webContents to handle opening new window.
cf. electron/electron#31117 (comment)

also, there seem to be issues between webview and React
cf. electron/electron#6046

PS: this solution works as is. It might not be the most beautiful. Feel free to use it as a base version and improve on it if need be.

❓ Context

  • Impacted projects: ledger-live-mobile, ledger-live-desktop
  • Linked resource(s): ``

✅ Checklist

  • Test coverage
  • Atomic delivery
  • No breaking changes

📸 Demo

🚀 Expectations to reach

Please make sure you follow these Important Steps.

Pull Requests must pass the CI and be internally validated in order to be merged.

sarneijim and others added 30 commits November 18, 2022 15:22
* Revert ":fire: hotfix release [skip ci]"

This reverts commit e0e5bb6.

* Revert ":fire: hotfix prerelease [LLD(2.51.0-hotfix.0)]"

This reverts commit 252aa67.

* Revert ":rocket: entering LLD hotfix mode"

This reverts commit 8f708eb.

* Revert ":fire: hotfix release [skip ci]"

This reverts commit 4ca8f86.

* Revert "Update wording"

This reverts commit fea165d.

* Revert "add energy lt for warning message to be display"

This reverts commit 693e44e.

* Revert "add more feelimit to tron trc20"

This reverts commit 1910b23.

* Revert ":fire: hotfix prerelease [LLM(3.12.0)]"

This reverts commit de77a92.

* Revert ":rocket: entering LLM hotfix mode"

This reverts commit 42df4fc.
[support] Manually merge hotfix to main
…2122)

* Fix start of post onboarding not being called in the right place

* changeset
Add blockcerts BCERT token icon
Removed the complex file, verifying the file can be converted to react native, verifying the requirements are present and avoid what is prohibited.
Added the latest requirements and removed what was asked to remove
@Justkant Justkant self-assigned this Dec 22, 2022
@changeset-bot
Copy link

changeset-bot bot commented Dec 22, 2022

🦋 Changeset detected

Latest commit: 0809051

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
@ledgerhq/live-common Minor
ledger-live-desktop Minor
live-mobile Minor
@ledgerhq/devices Patch
@ledgerhq/types-devices Patch
@ledgerhq/live-cli Minor
@ledgerhq/native-ui Patch
dummy-wallet-app Patch
live-common-tools Patch
@ledgerhq/hw-transport-node-ble Patch
@ledgerhq/hw-transport-node-hid-noevents Patch
@ledgerhq/hw-transport-node-hid-singleton Patch
@ledgerhq/hw-transport-node-hid Patch
@ledgerhq/hw-transport-web-ble Patch
@ledgerhq/hw-transport-webhid Patch
@ledgerhq/hw-transport-webusb Patch
@ledgerhq/hw-transport Patch
@ledgerhq/react-native-hid Patch
@ledgerhq/react-native-hw-transport-ble Patch
@ledgerhq/hw-app-algorand Patch
@ledgerhq/hw-app-btc Patch
@ledgerhq/hw-app-cosmos Patch
@ledgerhq/hw-app-eth Patch
@ledgerhq/hw-app-helium Patch
@ledgerhq/hw-app-near Patch
@ledgerhq/hw-app-polkadot Patch
@ledgerhq/hw-app-solana Patch
@ledgerhq/hw-app-str Patch
@ledgerhq/hw-app-tezos Patch
@ledgerhq/hw-app-trx Patch
@ledgerhq/hw-app-xrp Patch
@ledgerhq/hw-transport-http Patch
@ledgerhq/hw-transport-mocker Patch
@ledgerhq/hw-transport-node-speculos-http Patch
@ledgerhq/hw-transport-node-speculos Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 22, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
live-common-tools ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Dec 22, 2022 at 7:06PM (UTC)
3 Ignored Deployments
Name Status Preview Comments Updated
ledger-live-github-bot ⬜️ Ignored (Inspect) Dec 22, 2022 at 7:06PM (UTC)
native-ui-storybook ⬜️ Ignored (Inspect) Dec 22, 2022 at 7:06PM (UTC)
react-ui-storybook ⬜️ Ignored (Inspect) Dec 22, 2022 at 7:06PM (UTC)

@Justkant Justkant marked this pull request as ready for review December 22, 2022 17:28
@Justkant Justkant requested review from gre and a team as code owners December 22, 2022 17:28
@Justkant Justkant requested a review from a team December 22, 2022 17:28
@github-actions github-actions bot added automation CI/CD stuff cli common Has changes in live-common desktop Has changes in LLD ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM tools Has changes in tools translations Translation files have been touched ui Has changes in the design system library labels Dec 22, 2022
@Justkant Justkant mentioned this pull request Dec 22, 2022
3 tasks
@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Base: 0.00% // Head: 45.94% // Increases project coverage by +45.94% 🎉

Coverage data is based on head (66391df) compared to base (feb0fa6).
Patch has no changes to coverable lines.

❗ Current head 66391df differs from pull request most recent head 0809051. Consider uploading reports for the commit 0809051 to get more accurate results

Additional details and impacted files
@@                  Coverage Diff                  @@
##           feat/electron-22    #2182       +/-   ##
=====================================================
+ Coverage                  0   45.94%   +45.94%     
=====================================================
  Files                     0      740      +740     
  Lines                     0    31929    +31929     
  Branches                  0     8368     +8368     
=====================================================
+ Hits                      0    14669    +14669     
- Misses                    0    15937    +15937     
- Partials                  0     1323     +1323     
Flag Coverage Δ
test 45.94% <ø> (?)

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

Impacted Files Coverage Δ
...ger-live-common/src/families/algorand/bridge/js.ts 93.33% <0.00%> (ø)
.../src/families/bitcoin/wallet-btc/crypto/factory.ts 100.00% <0.00%> (ø)
...n/src/families/algorand/js-estimateMaxSpendable.ts 28.00% <0.00%> (ø)
...ger-live-common/src/bridge/useBridgeTransaction.ts 88.79% <0.00%> (ø)
libs/ledger-live-common/src/api/Ripple.ts 29.16% <0.00%> (ø)
...mon/src/families/hedera/js-estimateMaxSpendable.ts 90.00% <0.00%> (ø)
...rjs/packages/hw-app-btc/src/signP2SHTransaction.ts 11.11% <0.00%> (ø)
...-live-common/src/families/tezos/synchronisation.ts 9.55% <0.00%> (ø)
...mmon/src/hw/hooks/useGetLatestAvailableFirmware.ts 75.86% <0.00%> (ø)
...ledger-live-common/src/families/bitcoin/account.ts 21.21% <0.00%> (ø)
... and 730 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented Dec 22, 2022

@Justkant

Screenshots: ❌

It seems this PR contains screenshots that are different from the base branch.
If you are sure all those changes are correct, you can comment on this PR with /generate-screenshots to update those screenshots.

Make sure all the changes are correct before running the command, as it will commit and push the new result to the PR.

windows

Actual Diff Expected
live-app-verify-address-actual live-app-verify-address-diff live-app-verify-address-expected
live-app-verify-address-actual live-app-verify-address-diff live-app-verify-address-expected

@gre
Copy link
Contributor

gre commented Dec 22, 2022

/generate-screenshots

@github-actions
Copy link

github-actions bot commented Dec 22, 2022

@gre gre merged commit a4444ce into feat/electron-22 Dec 23, 2022
@gre gre deleted the bugfix/electron-22-conflicts branch December 23, 2022 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation CI/CD stuff cli common Has changes in live-common desktop Has changes in LLD ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM tools Has changes in tools translations Translation files have been touched ui Has changes in the design system library
Projects
None yet
Development

Successfully merging this pull request may close these issues.