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 21 #1777

Merged
merged 1 commit into from Nov 14, 2022
Merged

Conversation

chabroA
Copy link
Contributor

@chabroA chabroA commented Nov 9, 2022

πŸ“ Description

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: ``
  • 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.

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

use setWindowOpenHandler on the webview webContents to handle openning new

cf. electron/electron#31117 (comment)

also, there seem to be issues between webview and React
cf. electron/electron#6046
@chabroA chabroA requested a review from gre November 9, 2022 17:05
@vercel
Copy link

vercel bot commented Nov 9, 2022

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated
live-common-tools βœ… Ready (Inspect) Visit Preview Nov 9, 2022 at 5:05PM (UTC)
3 Ignored Deployments
Name Status Preview Updated
ledger-live-github-bot ⬜️ Ignored (Inspect) Nov 9, 2022 at 5:05PM (UTC)
native-ui-storybook ⬜️ Ignored (Inspect) Nov 9, 2022 at 5:05PM (UTC)
react-ui-storybook ⬜️ Ignored (Inspect) Nov 9, 2022 at 5:05PM (UTC)

@changeset-bot
Copy link

changeset-bot bot commented Nov 9, 2022

⚠️ No Changeset found

Latest commit: 0e3a6d1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added the desktop Has changes in LLD label Nov 9, 2022
@chabroA chabroA mentioned this pull request Nov 9, 2022
4 tasks
@codecov
Copy link

codecov bot commented Nov 9, 2022

Codecov Report

Base: 47.66% // Head: 47.66% // No change to project coverage πŸ‘

Coverage data is based on head (0e3a6d1) compared to base (926f5b8).
Patch has no changes to coverable lines.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/electron-21    #1777     +/-   ##
===================================================
  Coverage             47.66%   47.66%             
===================================================
  Files                   691      691             
  Lines                 30426    30426             
  Branches               7978     7954     -24     
===================================================
  Hits                  14502    14502             
- Misses                14706    15860   +1154     
+ Partials               1218       64   -1154     
Flag Coverage Ξ”
test 47.66% <ΓΈ> (ΓΈ)

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

Impacted Files Coverage Ξ”
libs/ledger-live-common/src/env.ts 74.50% <0.00%> (ΓΈ)
libs/ledger-live-common/src/convert.ts 12.50% <0.00%> (ΓΈ)
libs/ledger-live-common/src/network.ts 70.93% <0.00%> (ΓΈ)
libs/ledger-live-common/src/promise.ts 57.44% <0.00%> (ΓΈ)
libs/ledger-live-common/src/api/Tron.ts 16.53% <0.00%> (ΓΈ)
libs/ledger-live-common/src/hw/index.ts 20.00% <0.00%> (ΓΈ)
libs/ledger-live-common/src/nft/hook.ts 33.33% <0.00%> (ΓΈ)
libs/ledger-live-common/src/api/Ripple.ts 29.16% <0.00%> (ΓΈ)
libs/ledger-live-common/src/api/socket.ts 8.19% <0.00%> (ΓΈ)
libs/ledger-live-common/src/apps/logic.ts 60.74% <0.00%> (ΓΈ)
... and 259 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 Nov 9, 2022

@chabroA

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.

macos

Actual Diff Expected
manager-app-catalog-w-l10n-actual manager-app-catalog-w-l10n-diff manager-app-catalog-w-l10n-expected
manager-app-catalog-w-l10n-actual manager-app-catalog-w-l10n-diff manager-app-catalog-w-l10n-expected

@chabroA chabroA requested a review from a team November 10, 2022 08:48
@gre gre merged commit 273d01c into feat/electron-21 Nov 14, 2022
@gre gre deleted the bugfix/electron-21-webview branch November 14, 2022 09:48
@valpinkman
Copy link
Member

valpinkman commented Nov 16, 2022

@chabroA Please use changeset next time as this is pretty important !

@gre @hedi-edelbloute please make sure a changeset is included when reviewing critical topics like these

I know this is not going directly into develop but it's always good to have tracking of the changes we do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop Has changes in LLD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants