Skip to content

Commit

Permalink
chore(LLD): add deeplink support in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Justkant committed Apr 17, 2024
1 parent 8dbb76b commit 7ed0dd3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 37 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-laws-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

chore(LLD): add deeplink support in dev mode
1 change: 1 addition & 0 deletions apps/ledger-live-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"chart.js": "2.9.4",
"color": "^4.0.0",
"dotenv": "^16.0.3",
"electron-app-universal-protocol-client": "^1.3.0",
"electron-context-menu": "^3.6.0",
"electron-store": "^8.1.0",
"electron-updater": "^6.1.7",
Expand Down
15 changes: 15 additions & 0 deletions apps/ledger-live-desktop/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import debounce from "lodash/debounce";
import sentry from "~/sentry/main";
import { SettingsState } from "~/renderer/reducers/settings";
import { User } from "~/renderer/storage";
import electronAppUniversalProtocolClient from "electron-app-universal-protocol-client";

Store.initRenderer();

Expand Down Expand Up @@ -167,6 +168,20 @@ app.on("ready", async () => {
});
}, 300),
);

if (__DEV__) {
electronAppUniversalProtocolClient.on("request", requestUrl => {
// Handle the request
const win = getMainWindow();
if (win) win.webContents.send("deep-linking", requestUrl);
});

await electronAppUniversalProtocolClient.initialize({
protocol: "ledgerlive",
mode: "development",
});
}

await clearSessionCache(window.webContents.session);
});

Expand Down
58 changes: 21 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ed0dd3

Please sign in to comment.